Import Geant4 8.1.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 14:44:26 +02:00
parent 8a51e0bc40
commit 216a75eeb1
8717 changed files with 360418 additions and 141343 deletions
@@ -0,0 +1,139 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: HistoMessenger.cc,v 1.5 2006/06/29 17:24:18 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
/////////////////////////////////////////////////////////////////////////
//
// HistoMessenger
//
// Created: 31.01.2003 V.Ivanchenko
//
// Modified:
// 04.06.2006 Adoptation of hadr01 (V.Ivanchenko)
//
////////////////////////////////////////////////////////////////////////
//
#include "HistoMessenger.hh"
#include "Histo.hh"
#include "G4UIdirectory.hh"
#include "G4UIcommand.hh"
#include "G4UIparameter.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWithAnInteger.hh"
#include <sstream>
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
HistoMessenger::HistoMessenger(Histo* man) : histo (man)
{
factoryCmd = new G4UIcmdWithAString("/testhadr/HistoName",this);
factoryCmd->SetGuidance("set name for the histograms file");
fileCmd = new G4UIcmdWithAString("/testhadr/HistoType",this);
fileCmd->SetGuidance("set type (hbook, root, aida) for the histograms file");
fileCmd->SetCandidates("hbook root aida");
optCmd = new G4UIcmdWithAString("/testhadr/HistoOption",this);
optCmd->SetGuidance("set AIDA option for the histograms file");
printCmd = new G4UIcmdWithAnInteger("/testhadr/HistoPrint",this);
printCmd->SetGuidance("Print histogram by ID, if ID=0 - all.");
printCmd->SetParameterName("pr",false);
printCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
histoCmd = new G4UIcommand("/testhadr/SetHisto",this);
histoCmd->SetGuidance("Set bining of the histo number ih :");
histoCmd->SetGuidance(" nbBins; valMin; valMax; unit (of vmin and vmax)");
//
G4UIparameter* ih = new G4UIparameter("ih",'i',false);
ih->SetGuidance("histo number : from 1 to MaxHisto");
ih->SetParameterRange("ih>0");
histoCmd->SetParameter(ih);
//
G4UIparameter* nbBins = new G4UIparameter("nbBins",'i',false);
nbBins->SetGuidance("number of bins");
nbBins->SetParameterRange("nbBins>0");
histoCmd->SetParameter(nbBins);
//
G4UIparameter* valMin = new G4UIparameter("valMin",'d',false);
valMin->SetGuidance("valMin, expressed in unit");
histoCmd->SetParameter(valMin);
//
G4UIparameter* valMax = new G4UIparameter("valMax",'d',false);
valMax->SetGuidance("valMax, expressed in unit");
histoCmd->SetParameter(valMax);
//
G4UIparameter* unit = new G4UIparameter("unit",'s',true);
unit->SetGuidance("if omitted, vmin and vmax are assumed dimensionless");
unit->SetDefaultValue("none");
histoCmd->SetParameter(unit);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
HistoMessenger::~HistoMessenger()
{
delete fileCmd;
delete histoCmd;
delete factoryCmd;
delete optCmd;
delete printCmd;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void HistoMessenger::SetNewValue(G4UIcommand* command,G4String newValues)
{
if (command == factoryCmd)
histo->setFileName(newValues);
if (command == fileCmd)
histo->setFileType(newValues);
if (command == optCmd)
histo->setFileOption(newValues);
if (command == printCmd)
histo->print(printCmd->GetNewIntValue(newValues));
if (command == histoCmd) {
G4int ih, nbBins;
G4double vmin,vmax;
G4String unit;
std::istringstream is(newValues);
is >> ih >> nbBins >> vmin >> vmax >> unit;
G4double vUnit = 1. ;
if (unit != "none" && unit != "") vUnit = G4UIcommand::ValueOf(unit);
histo->setHisto1D(ih,nbBins,vmin,vmax,vUnit);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......