Import Geant4 9.1.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 15:37:50 +02:00
parent a8e9364cea
commit 96c8bcd0af
6923 changed files with 198390 additions and 41849 deletions
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: DetectorConstruction.cc,v 1.6 2006/10/26 10:18:59 maire Exp $
// GEANT4 tag $Name: geant4-09-00 $
// $Id: DetectorConstruction.cc,v 1.8 2007/11/07 17:22:16 maire Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -91,9 +91,13 @@ void DetectorConstruction::DefineMaterials()
man->FindOrBuildMaterial("G4_Si", isotopes);
man->FindOrBuildMaterial("G4_Fe", isotopes);
man->FindOrBuildMaterial("G4_Ge", isotopes);
man->FindOrBuildMaterial("G4_Mo", isotopes);
man->FindOrBuildMaterial("G4_Ta", isotopes);
man->FindOrBuildMaterial("G4_W" , isotopes);
man->FindOrBuildMaterial("G4_Au", isotopes);
man->FindOrBuildMaterial("G4_Pb", isotopes);
man->FindOrBuildMaterial("G4_Pb", isotopes);
man->FindOrBuildMaterial("G4_PbWO4", isotopes);
man->FindOrBuildMaterial("G4_SODIUM_IODIDE", isotopes);
man->FindOrBuildMaterial("G4_AIR" , isotopes);
///man->FindOrBuildMaterial("G4_WATER", isotopes);
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: DetectorMessenger.cc,v 1.2 2006/06/29 16:40:12 gunter Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: EventAction.cc,v 1.2 2006/06/29 16:40:15 gunter Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: EventActionMessenger.cc,v 1.2 2006/06/29 16:40:18 gunter Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: HistoManager.cc,v 1.4 2006/07/06 15:56:38 maire Exp $
// GEANT4 tag $Name: geant4-09-00 $
// $Id: HistoManager.cc,v 1.6 2007/11/07 17:22:16 maire Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -52,7 +52,7 @@ HistoManager::HistoManager()
}
#endif
fileName[0] = "testem11";
fileName[0] = "dummy";
fileType = "hbook";
fileOption = "--noErrors uncompress";
// histograms
@@ -61,11 +61,13 @@ HistoManager::HistoManager()
exist[k] = false;
Unit[k] = 1.0;
Width[k] = 1.0;
ascii[k] = false;
}
histoMessenger = new HistoMessenger(this);
stepMax = DBL_MAX;
rangeFlag = false;
csdaRange = DBL_MAX;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -128,6 +130,7 @@ void HistoManager::save()
{
#ifdef G4ANALYSIS_USE
if (factoryOn) {
saveAscii(); // Write ascii file, if any
tree->commit(); // Writing the histograms to the file
tree->close(); // and closing the tree (and the file)
G4cout << "\n----> Histogram Tree is saved in " << fileName[1] << G4endl;
@@ -164,7 +167,7 @@ void HistoManager::SetHisto(G4int ih,
return;
}
const G4String id[] = { "0", "1", "2", "3", "4", "5", "6", "7" };
const G4String id[] = { "0", "1", "2", "3", "4", "5", "6", "7", "8" };
const G4String title[] =
{ "dummy", //0
"Edep (MeV/mm) along absorber", //1
@@ -173,7 +176,8 @@ void HistoManager::SetHisto(G4int ih,
"true step size of the primary particle", //4
"projected range of the primary particle", //5
"true track length of charged secondaries", //6
"true step size of charged secondaries" //7
"true step size of charged secondaries", //7
"Edep (MeV.cm2/g) along x/r0" //8
};
@@ -197,15 +201,7 @@ void HistoManager::SetHisto(G4int ih,
G4cout << "----> SetHisto " << ih << ": " << titl << "; "
<< nbins << " bins from "
<< vmin << " " << unit << " to " << vmax << " " << unit << G4endl;
// compute constraint on stepMax from histos 1
//
G4double frac = 1.;
if (ih == 1) {
stepMax = frac*Width[ih];
G4cout << " stepMax = " << G4BestUnit(stepMax,"Length") << G4endl;
}
<< vmin << " " << unit << " to " << vmax << " " << unit << G4endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -237,3 +233,68 @@ void HistoManager::Scale(G4int ih, G4double fac)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void HistoManager::PrintHisto(G4int ih)
{
if (ih < MaxHisto) ascii[ih] = true;
else
G4cout << "---> warning from HistoManager::PrintHisto() : histo " << ih
<< "does not exist" << G4endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include <fstream>
void HistoManager::saveAscii()
{
#ifdef G4ANALYSIS_USE
G4String name = fileName[0] + ".ascii";
std::ofstream File(name, std::ios::out);
File.setf( std::ios::scientific, std::ios::floatfield );
//write selected histograms
for (G4int ih=0; ih<MaxHisto; ih++) {
if (exist[ih] && ascii[ih]) {
File << "\n 1D histogram " << ih << ": " << Title[ih]
<< "\n \n \t X \t\t Y" << G4endl;
for (G4int iBin=0; iBin<Nbins[ih]; ++iBin) {
File << " " << iBin << "\t"
<< histo[ih]->binMean(iBin) << "\t"
<< histo[ih]->binHeight(iBin)
<< G4endl;
}
}
}
#endif
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double HistoManager::ComputeStepMax(G4double range)
{
// compute constraint on stepMax from histos 1 and 8
//
G4double stepMax = DBL_MAX;
G4double frac = 1.;
G4int ih = 1;
if (exist[ih]) {
stepMax = frac*Width[ih];
}
ih = 8;
if (exist[ih]) {
if (!rangeFlag) csdaRange = range;
if (csdaRange > 0.) stepMax = std::min(stepMax,frac*Width[ih]*csdaRange);
}
G4cout << "\n---> stepMax from HistoManager = "
<< G4BestUnit(stepMax,"Length") << G4endl;
return stepMax;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: HistoMessenger.cc,v 1.3 2006/06/29 16:40:22 gunter Exp $
// GEANT4 tag $Name: geant4-09-00 $
// $Id: HistoMessenger.cc,v 1.5 2007/11/07 17:22:16 maire Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -39,6 +39,7 @@
#include "G4UIparameter.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWithAnInteger.hh"
#include "G4UIcmdWithADoubleAndUnit.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -82,17 +83,30 @@ HistoMessenger::HistoMessenger(HistoManager* manager)
unit->SetDefaultValue("none");
histoCmd->SetParameter(unit);
prhistoCmd = new G4UIcmdWithAnInteger("/testem/histo/printHisto",this);
prhistoCmd->SetGuidance("print histo #id on ascii file");
prhistoCmd->SetParameterName("id",false);
prhistoCmd->SetRange("id>0");
rmhistoCmd = new G4UIcmdWithAnInteger("/testem/histo/removeHisto",this);
rmhistoCmd->SetGuidance("desactivate histo #id");
rmhistoCmd->SetParameterName("id",false);
rmhistoCmd->SetRange("id>0");
csdaCmd = new G4UIcmdWithADoubleAndUnit("/testem/histo/setcsdaRange",this);
csdaCmd->SetGuidance("Set csda range for normalisation");
csdaCmd->SetParameterName("csda",false);
csdaCmd->SetRange("csda>0.");
csdaCmd->SetUnitCategory("Length");
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
HistoMessenger::~HistoMessenger()
{
delete csdaCmd;
delete rmhistoCmd;
delete prhistoCmd;
delete histoCmd;
delete typeCmd;
delete factoryCmd;
@@ -119,9 +133,15 @@ void HistoMessenger::SetNewValue(G4UIcommand* command, G4String newValues)
if (unit != "none") vUnit = G4UIcommand::ValueOf(unit);
histoManager->SetHisto (ih,nbBins,vmin*vUnit,vmax*vUnit,unit);
}
if (command == prhistoCmd)
histoManager->PrintHisto(prhistoCmd->GetNewIntValue(newValues));
if (command == rmhistoCmd)
histoManager->RemoveHisto(rmhistoCmd->GetNewIntValue(newValues));
histoManager->RemoveHisto(rmhistoCmd->GetNewIntValue(newValues));
if (command == csdaCmd)
histoManager->SetcsdaRange(csdaCmd->GetNewDoubleValue(newValues));
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -25,7 +25,7 @@
//
//
// $Id: PhysListEmLivermore.cc,v 1.4 2006/09/18 17:26:20 maire Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -25,7 +25,7 @@
//
//
// $Id: PhysListEmPenelope.cc,v 1.3 2006/09/18 17:26:20 maire Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -25,7 +25,7 @@
//
//
// $Id: PhysListEmStandard.cc,v 1.3 2006/06/29 16:40:34 gunter Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: PhysicsList.cc,v 1.5 2006/10/26 10:18:59 maire Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: PhysicsListMessenger.cc,v 1.2 2006/06/29 16:40:38 gunter Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: PrimaryGeneratorAction.cc,v 1.2 2006/06/29 16:40:40 gunter Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: PrimaryGeneratorMessenger.cc,v 1.2 2006/06/29 16:40:43 gunter Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: RunAction.cc,v 1.6 2006/06/29 16:40:45 gunter Exp $
// GEANT4 tag $Name: geant4-09-00 $
// $Id: RunAction.cc,v 1.7 2007/08/19 20:52:53 maire Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -85,14 +85,25 @@ void RunAction::BeginOfRunAction(const G4Run* aRun)
//initialize track status
//
status[0] = status[1] = status[2] = 0;
//get csdaRange from EmCalculator
//
G4EmCalculator emCalculator;
G4Material* material = detector->GetAbsorMaterial();
G4ParticleDefinition* particle = kinematic->GetParticleGun()
->GetParticleDefinition();
G4double energy = kinematic->GetParticleGun()->GetParticleEnergy();
csdaRange = DBL_MAX;
if (particle->GetPDGCharge() != 0.)
csdaRange = emCalculator.GetCSDARange(energy,particle,material);
//histograms
//
histoManager->book();
//set StepMax from histos
//
G4double stepMax = histoManager->GetStepMax();
G4double stepMax = histoManager->ComputeStepMax(csdaRange);
physics->GetStepMaxProcess()->SetMaxStep(stepMax);
}
@@ -154,10 +165,10 @@ void RunAction::EndOfRunAction(const G4Run* aRun)
//compare with csda range
//
G4EmCalculator emCalculator;
G4double csdaRange = 0.;
if (particle->GetPDGCharge() != 0.)
csdaRange = emCalculator.GetCSDARange(energy,particle,material);
//G4EmCalculator emCalculator;
//G4double csdaRange = 0.;
//if (particle->GetPDGCharge() != 0.)
// csdaRange = emCalculator.GetCSDARange(energy,particle,material);
G4cout
<< "\n Range from EmCalculator = " << G4BestUnit(csdaRange,"Length")
<< " (from full dE/dx)" << G4endl;
@@ -204,13 +215,19 @@ void RunAction::EndOfRunAction(const G4Run* aRun)
<< " transmit = " << transmit << " %"
<< " reflected = " << reflected << " %" << G4endl;
// normalize histogram of longitudinal energy profile
// normalize histograms of longitudinal energy profile
//
G4int ih = 1;
G4double binWidth = histoManager->GetBinWidth(ih);
G4double fac = (1./(NbofEvents*binWidth))*(mm/MeV);
histoManager->Scale(ih,fac);
ih = 8;
binWidth = histoManager->GetBinWidth(ih);
G4double range = histoManager->GetcsdaRange();
fac = (1./(NbofEvents*binWidth*range*density))*(g/(MeV*cm2));
histoManager->Scale(ih,fac);
// reset default formats
G4cout.setf(mode,std::ios::floatfield);
G4cout.precision(prec);
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: StepMax.cc,v 1.3 2006/06/29 16:40:47 gunter Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: StepMaxMessenger.cc,v 1.3 2006/06/29 16:40:53 gunter Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: SteppingAction.cc,v 1.4 2006/09/18 17:26:20 maire Exp $
// GEANT4 tag $Name: geant4-09-00 $
// $Id: SteppingAction.cc,v 1.5 2007/08/19 20:52:53 maire Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -69,6 +69,9 @@ void SteppingAction::UserSteppingAction(const G4Step* aStep)
G4double x = point.x() + 0.5*detector->GetAbsorSizeX();
histoManager->FillHisto(1, x, edep);
G4double r0 = histoManager->GetcsdaRange();
if (r0 > 0.) histoManager->FillHisto(8, x/r0, edep);
//step size of primary particle or charged secondaries
//
G4double steplen = aStep->GetStepLength();
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: SteppingVerbose.cc,v 1.2 2006/06/29 16:41:54 gunter Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: TrackingAction.cc,v 1.2 2006/06/29 16:41:56 gunter Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......