Import Geant4 10.2.0 source tree
This commit is contained in:
@@ -25,7 +25,8 @@
|
||||
//
|
||||
// This is the *BASIC* version of IORT, a Geant4-based application
|
||||
//
|
||||
// Main Authors: G.Russo(a,b), C.Casarino*(c), G.C. Candiano(c), G.A.P. Cirrone(d), F.Romano(d)
|
||||
// Main Authors: G.Russo(a,b), C.Casarino*(c), G.C. Candiano(c),
|
||||
// G.A.P. Cirrone(d), F.Romano(d)
|
||||
// Contributor Authors: S.Guatelli(e)
|
||||
// Past Authors: G.Arnetta(c), S.E.Mazzaglia(d)
|
||||
//
|
||||
@@ -47,12 +48,8 @@
|
||||
#include "IORTMatrix.hh"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#ifdef G4ANALYSIS_USE_ROOT
|
||||
IORTAnalysisFileMessenger::IORTAnalysisFileMessenger(IORTAnalysisManager* amgr)
|
||||
:AnalysisManager(amgr)
|
||||
#else
|
||||
IORTAnalysisFileMessenger::IORTAnalysisFileMessenger()
|
||||
#endif
|
||||
IORTAnalysisFileMessenger::IORTAnalysisFileMessenger(IORTAnalysisManager* amgr) :
|
||||
AnalysisManager(amgr)
|
||||
{
|
||||
secondaryCmd = new G4UIcmdWithABool("/analysis/secondary",this);
|
||||
secondaryCmd -> SetParameterName("secondary", true);
|
||||
@@ -69,13 +66,12 @@ IORTAnalysisFileMessenger::IORTAnalysisFileMessenger()
|
||||
// With this messenger you can:
|
||||
// give a name to the generated .root file
|
||||
// One can use this messenger to define a different .root file name other then the default one
|
||||
#ifdef G4ANALYSIS_USE_ROOT
|
||||
FileNameCmd = new G4UIcmdWithAString("/analysis/setAnalysisFile",this);
|
||||
FileNameCmd->SetGuidance("Set the .root filename for the root-output");
|
||||
FileNameCmd->SetDefaultValue("default.root");
|
||||
FileNameCmd->SetParameterName("choice",true); ///<doc did not say what second boolean really does
|
||||
FileNameCmd->AvailableForStates(G4State_Idle,G4State_PreInit);
|
||||
#endif
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -84,9 +80,7 @@ IORTAnalysisFileMessenger::~IORTAnalysisFileMessenger()
|
||||
{
|
||||
delete secondaryCmd;
|
||||
delete DoseMatrixCmd;
|
||||
#ifdef G4ANALYSIS_USE_ROOT
|
||||
delete FileNameCmd;
|
||||
#endif
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
@@ -106,18 +100,15 @@ void IORTAnalysisFileMessenger::SetNewValue(G4UIcommand* command, G4String newVa
|
||||
{
|
||||
pMatrix -> TotalEnergyDeposit();
|
||||
pMatrix -> StoreDoseFluenceAscii(newValue);
|
||||
#ifdef G4ANALYSIS_USE_ROOT
|
||||
pMatrix -> StoreDoseFluenceRoot();
|
||||
IORTAnalysisManager::GetInstance() -> flush(); // Finalize & write the root file
|
||||
#endif
|
||||
// Finalize & write output file
|
||||
IORTAnalysisManager::GetInstance() -> flush();
|
||||
}
|
||||
}
|
||||
#ifdef G4ANALYSIS_USE_ROOT
|
||||
else if (command == FileNameCmd)
|
||||
{
|
||||
{
|
||||
AnalysisManager->SetAnalysisFileName(newValue);
|
||||
IORTAnalysisManager::GetInstance() -> book(); // Book for a new ROOT TFile
|
||||
}
|
||||
#endif
|
||||
IORTAnalysisManager::GetInstance() -> book(); // Book for a new output file
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,9 @@
|
||||
//
|
||||
// This is the *BASIC* version of IORT, a Geant4-based application
|
||||
//
|
||||
// Main Authors: G.Russo(a,b), C.Casarino*(c), G.C. Candiano(c), G.A.P. Cirrone(d), F.Romano(d)
|
||||
// Main Authors: G.Russo(a,b), C.Casarino*(c), G.C. Candiano(c),
|
||||
// G.A.P. Cirrone(d), F.Romano(d)
|
||||
//
|
||||
// Contributor Authors: S.Guatelli(e)
|
||||
// Past Authors: G.Arnetta(c), S.E.Mazzaglia(d)
|
||||
//
|
||||
@@ -45,373 +47,412 @@
|
||||
|
||||
IORTAnalysisManager* IORTAnalysisManager::instance = 0;
|
||||
|
||||
IORTAnalysisManager::IORTAnalysisManager()
|
||||
#ifdef G4ANALYSIS_USE_ROOT
|
||||
:
|
||||
analysisFileName("DoseDistribution.root"),theTFile(0), histo1(0), histo2(0), histo3(0),
|
||||
histo4(0), histo5(0), histo6(0), histo7(0), histo8(0), histo9(0), histo10(0), histo11(0), histo12(0), histo13(0), histo14(0), histo15(0), histo16(0),
|
||||
kinFragNtuple(0),
|
||||
kineticEnergyPrimaryNtuple(0),
|
||||
doseFragNtuple(0),
|
||||
fluenceFragNtuple(0),
|
||||
letFragNtuple(0),
|
||||
theROOTNtuple(0),
|
||||
theROOTIonTuple(0),
|
||||
fragmentNtuple(0),
|
||||
metaData(0),
|
||||
eventCounter(0)
|
||||
#endif
|
||||
IORTAnalysisManager::IORTAnalysisManager() :
|
||||
analysisFileName("DoseDistribution"),
|
||||
eventCounter(0)
|
||||
{
|
||||
#ifdef G4ANALYSIS_USE_ROOT
|
||||
fMess = new IORTAnalysisFileMessenger(this);
|
||||
#else
|
||||
fMess = new IORTAnalysisFileMessenger();
|
||||
#endif
|
||||
fMess = new IORTAnalysisFileMessenger(this);
|
||||
}
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
IORTAnalysisManager::~IORTAnalysisManager()
|
||||
{
|
||||
if (fMess)
|
||||
delete fMess;
|
||||
#ifdef G4ANALYSIS_USE_ROOT
|
||||
Clear();
|
||||
#endif
|
||||
delete G4AnalysisManager::Instance();
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
IORTAnalysisManager* IORTAnalysisManager::GetInstance()
|
||||
{
|
||||
if (instance == 0) instance = new IORTAnalysisManager;
|
||||
return instance;
|
||||
if (instance == 0) instance = new IORTAnalysisManager;
|
||||
return instance;
|
||||
}
|
||||
#ifdef G4ANALYSIS_USE_ROOT
|
||||
void IORTAnalysisManager::Clear()
|
||||
{
|
||||
if (theTFile)
|
||||
{
|
||||
delete metaData;
|
||||
metaData = 0;
|
||||
|
||||
delete fragmentNtuple;
|
||||
fragmentNtuple = 0;
|
||||
|
||||
delete theROOTIonTuple;
|
||||
theROOTIonTuple = 0;
|
||||
|
||||
delete theROOTNtuple;
|
||||
theROOTNtuple = 0;
|
||||
|
||||
delete histo16;
|
||||
histo16 = 0;
|
||||
|
||||
delete histo15;
|
||||
histo15 = 0;
|
||||
|
||||
delete histo14;
|
||||
histo14 = 0;
|
||||
|
||||
delete histo13;
|
||||
histo13 = 0;
|
||||
|
||||
delete histo12;
|
||||
histo12 = 0;
|
||||
|
||||
delete histo11;
|
||||
histo11 = 0;
|
||||
|
||||
delete histo10;
|
||||
histo10 = 0;
|
||||
|
||||
delete histo9;
|
||||
histo9 = 0;
|
||||
|
||||
delete histo8;
|
||||
histo8 = 0;
|
||||
|
||||
delete histo7;
|
||||
histo7 = 0;
|
||||
|
||||
delete histo6;
|
||||
histo6 = 0;
|
||||
|
||||
delete histo5;
|
||||
histo5 = 0;
|
||||
|
||||
delete histo4;
|
||||
histo4 = 0;
|
||||
|
||||
delete histo3;
|
||||
histo3 = 0;
|
||||
|
||||
delete histo2;
|
||||
histo2 = 0;
|
||||
|
||||
delete histo1;
|
||||
histo1 = 0;
|
||||
}
|
||||
}
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void IORTAnalysisManager::SetAnalysisFileName(G4String aFileName)
|
||||
{
|
||||
this->analysisFileName = aFileName;
|
||||
analysisFileName = aFileName;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
G4bool IORTAnalysisManager::IsTheTFile()
|
||||
{
|
||||
return (theTFile) ? true:false;
|
||||
}
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void IORTAnalysisManager::book()
|
||||
{
|
||||
delete theTFile; // this is similar to theTFile->Close() => delete all associated variables created via new, moreover it delete itself.
|
||||
// Create analysis manager
|
||||
G4AnalysisManager* man = G4AnalysisManager::Instance();
|
||||
man->SetVerboseLevel(1);
|
||||
man->SetFirstHistoId(1);
|
||||
man->SetFirstNtupleId(1);
|
||||
|
||||
theTFile = new TFile(analysisFileName, "RECREATE");
|
||||
|
||||
// Create the histograms with the energy deposit along the X axis
|
||||
histo1 = createHistogram1D("braggPeak","slice, energy", 400, 0., 80); //<different waterthicknesses are accoutned for in ROOT-analysis stage
|
||||
histo2 = createHistogram1D("h20","Secondary protons - slice, energy", 400, 0., 400.);
|
||||
histo3 = createHistogram1D("h30","Secondary neutrons - slice, energy", 400, 0., 400.);
|
||||
histo4 = createHistogram1D("h40","Secondary alpha - slice, energy", 400, 0., 400.);
|
||||
histo5 = createHistogram1D("h50","Secondary gamma - slice, energy", 400, 0., 400.);
|
||||
histo6 = createHistogram1D("h60","Secondary electron - slice, energy", 400, 0., 400.);
|
||||
histo7 = createHistogram1D("h70","Secondary triton - slice, energy", 400, 0., 400.);
|
||||
histo8 = createHistogram1D("h80","Secondary deuteron - slice, energy", 400, 0., 400.);
|
||||
histo9 = createHistogram1D("h90","Secondary pion - slice, energy", 400, 0., 400.);
|
||||
histo10 = createHistogram1D("h100","Energy distribution of secondary electrons", 70, 0., 70.);
|
||||
histo11 = createHistogram1D("h110","Energy distribution of secondary photons", 70, 0., 70.);
|
||||
histo12 = createHistogram1D("h120","Energy distribution of secondary deuterons", 70, 0., 70.);
|
||||
histo13 = createHistogram1D("h130","Energy distribution of secondary tritons", 70, 0., 70.);
|
||||
histo14 = createHistogram1D("h140","Energy distribution of secondary alpha particles", 70, 0., 70.);
|
||||
histo15 = createHistogram1D("heliumEnergyAfterPhantom","Energy distribution of secondary helium fragments after the phantom",
|
||||
man->OpenFile(analysisFileName);
|
||||
|
||||
// Create the histograms with the energy deposit along the X axis
|
||||
//ID=1 <different waterthicknesses are accoutned for in ROOT-analysis stage>
|
||||
man->CreateH1("braggPeak","slice, energy", 400, 0., 80); //
|
||||
//ID=2
|
||||
man->CreateH1("h20","Secondary protons - slice, energy", 400, 0., 400.);
|
||||
//ID=3
|
||||
man->CreateH1("h30","Secondary neutrons - slice, energy", 400, 0., 400.);
|
||||
//ID=4
|
||||
man->CreateH1("h40","Secondary alpha - slice, energy", 400, 0., 400.);
|
||||
//ID=5
|
||||
man->CreateH1("h50","Secondary gamma - slice, energy", 400, 0., 400.);
|
||||
//ID=6
|
||||
man->CreateH1("h60","Secondary electron - slice, energy", 400, 0., 400.);
|
||||
//ID=7
|
||||
man->CreateH1("h70","Secondary triton - slice, energy", 400, 0., 400.);
|
||||
//ID=8
|
||||
man->CreateH1("h80","Secondary deuteron - slice, energy", 400, 0., 400.);
|
||||
//ID=9
|
||||
man->CreateH1("h90","Secondary pion - slice, energy", 400, 0., 400.);
|
||||
//ID=10
|
||||
man->CreateH1("h100","Energy distribution of secondary electrons", 70, 0., 70.);
|
||||
//ID=11
|
||||
man->CreateH1("h110","Energy distribution of secondary photons", 70, 0., 70.);
|
||||
//ID=12
|
||||
man->CreateH1("h120","Energy distribution of secondary deuterons", 70, 0., 70.);
|
||||
//ID = 13
|
||||
man->CreateH1("h130","Energy distribution of secondary tritons", 70, 0., 70.);
|
||||
//ID = 14
|
||||
man->CreateH1("h140","Energy distribution of secondary alpha particles", 70, 0., 70.);
|
||||
//ID = 15
|
||||
man->CreateH1("heliumEnergyAfterPhantom",
|
||||
"Energy distribution of secondary helium fragments after the phantom",
|
||||
70, 0., 500.);
|
||||
histo16 = createHistogram1D("hydrogenEnergyAfterPhantom","Energy distribution of secondary helium fragments after the phantom",
|
||||
//ID= 16
|
||||
man->CreateH1("hydrogenEnergyAfterPhantom",
|
||||
"Energy distribution of secondary helium fragments after the phantom",
|
||||
70, 0., 500.);
|
||||
|
||||
kinFragNtuple = new TNtuple("kinFragNtuple",
|
||||
"Kinetic energy by voxel & fragment",
|
||||
"i:j:k:A:Z:kineticEnergy");
|
||||
kineticEnergyPrimaryNtuple= new TNtuple("kineticEnergyPrimaryNtuple",
|
||||
"Kinetic energy by voxel of primary",
|
||||
"i:j:k:kineticEnergy");
|
||||
doseFragNtuple = new TNtuple("doseFragNtuple",
|
||||
"Energy deposit by voxel & fragment",
|
||||
"i:j:k:A:Z:energy");
|
||||
//Now the ntuples
|
||||
//ID = 1
|
||||
man->CreateNtuple("kinFragNtuple",
|
||||
"Kinetic energy by voxel & fragment");
|
||||
man->CreateNtupleIColumn("i");
|
||||
man->CreateNtupleIColumn("j");
|
||||
man->CreateNtupleIColumn("k");
|
||||
man->CreateNtupleIColumn("A");
|
||||
man->CreateNtupleDColumn("Z");
|
||||
man->CreateNtupleDColumn("kineticEnergy");
|
||||
man->FinishNtuple();
|
||||
|
||||
fluenceFragNtuple = new TNtuple("fluenceFragNtuple",
|
||||
"Fluence by voxel & fragment",
|
||||
"i:j:k:A:Z:fluence");
|
||||
//ID = 2
|
||||
man->CreateNtuple("kineticEnergyPrimaryNtuple",
|
||||
"Kinetic energy by voxel of primary");
|
||||
man->CreateNtupleIColumn("i");
|
||||
man->CreateNtupleIColumn("j");
|
||||
man->CreateNtupleIColumn("k");
|
||||
man->CreateNtupleDColumn("kineticEnergy");
|
||||
man->FinishNtuple();
|
||||
|
||||
letFragNtuple = new TNtuple("letFragNtuple",
|
||||
"Let by voxel & fragment",
|
||||
"i:j:k:A:Z:letT:letD");
|
||||
//ID = 3
|
||||
man->CreateNtuple("doseFragNtuple",
|
||||
"Energy deposit by voxel & fragment");
|
||||
man->CreateNtupleIColumn("i");
|
||||
man->CreateNtupleIColumn("j");
|
||||
man->CreateNtupleIColumn("k");
|
||||
man->CreateNtupleIColumn("A");
|
||||
man->CreateNtupleDColumn("Z");
|
||||
man->CreateNtupleDColumn("energy");
|
||||
man->FinishNtuple();
|
||||
|
||||
theROOTNtuple = new TNtuple("theROOTNtuple",
|
||||
"Energy deposit by slice",
|
||||
"i:j:k:energy");
|
||||
// ID =4
|
||||
man->CreateNtuple("fluenceFragNtuple",
|
||||
"Fluence by voxel & fragment");
|
||||
man->CreateNtupleIColumn("i");
|
||||
man->CreateNtupleIColumn("j");
|
||||
man->CreateNtupleIColumn("k");
|
||||
man->CreateNtupleIColumn("A");
|
||||
man->CreateNtupleDColumn("Z");
|
||||
man->CreateNtupleDColumn("fluence");
|
||||
man->FinishNtuple();
|
||||
|
||||
theROOTIonTuple = new TNtuple("theROOTIonTuple",
|
||||
"Generic ion information",
|
||||
"a:z:occupancy:energy");
|
||||
// ID=5
|
||||
man->CreateNtuple("letFragNtuple",
|
||||
"Let by voxel & fragment");
|
||||
man->CreateNtupleIColumn("i");
|
||||
man->CreateNtupleIColumn("j");
|
||||
man->CreateNtupleIColumn("k");
|
||||
man->CreateNtupleIColumn("A");
|
||||
man->CreateNtupleDColumn("Z");
|
||||
man->CreateNtupleDColumn("letT");
|
||||
man->CreateNtupleDColumn("letD");
|
||||
man->FinishNtuple();
|
||||
|
||||
fragmentNtuple = new TNtuple("fragmentNtuple",
|
||||
"Fragments",
|
||||
"A:Z:energy:posX:posY:posZ");
|
||||
//ID=6
|
||||
man->CreateNtuple("theROOTNtuple",
|
||||
"Energy deposit by slice");
|
||||
man->CreateNtupleIColumn("i");
|
||||
man->CreateNtupleIColumn("j");
|
||||
man->CreateNtupleIColumn("k");
|
||||
man->CreateNtupleDColumn("energy");
|
||||
man->FinishNtuple();
|
||||
|
||||
//ID=7
|
||||
man->CreateNtuple("theROOTIonTuple",
|
||||
"Generic ion information");
|
||||
man->CreateNtupleIColumn("a");
|
||||
man->CreateNtupleDColumn("z");
|
||||
man->CreateNtupleIColumn("occupancy");
|
||||
man->CreateNtupleDColumn("energy");
|
||||
man->FinishNtuple();
|
||||
|
||||
//ID=8
|
||||
man->CreateNtuple("fragmentNtuple",
|
||||
"Fragments");
|
||||
man->CreateNtupleIColumn("A");
|
||||
man->CreateNtupleDColumn("Z");
|
||||
man->CreateNtupleDColumn("energy");
|
||||
man->CreateNtupleDColumn("posX");
|
||||
man->CreateNtupleDColumn("posY");
|
||||
man->CreateNtupleDColumn("posZ");
|
||||
man->FinishNtuple();
|
||||
|
||||
metaData = new TNtuple("metaData",
|
||||
"Metadata",
|
||||
"events:detectorDistance:waterThickness:beamEnergy:energyError:phantomCenterDistance");
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
void IORTAnalysisManager::FillEnergyDeposit(G4int i,
|
||||
G4int j,
|
||||
G4int k,
|
||||
G4double energy)
|
||||
G4int j,
|
||||
G4int k,
|
||||
G4double energy)
|
||||
{
|
||||
if (theROOTNtuple)
|
||||
{
|
||||
theROOTNtuple->Fill(i, j, k, energy);
|
||||
}
|
||||
G4AnalysisManager* man = G4AnalysisManager::Instance();
|
||||
man->FillNtupleIColumn(6,0,i);
|
||||
man->FillNtupleIColumn(6,1,j);
|
||||
man->FillNtupleIColumn(6,2,k);
|
||||
man->FillNtupleDColumn(6,3,energy);
|
||||
man->AddNtupleRow(6);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
void IORTAnalysisManager::BraggPeak(G4int slice, G4double energy)
|
||||
{
|
||||
histo1->SetBinContent(slice, energy); //This uses setbincontent instead of fill to get labels correct
|
||||
//FIXME
|
||||
G4AnalysisManager::Instance()->FillH1(1,slice,energy);
|
||||
//histo1->SetBinContent(slice, energy); //This uses setbincontent instead of fill to get labels correct
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
void IORTAnalysisManager::SecondaryProtonEnergyDeposit(G4int slice, G4double energy)
|
||||
{
|
||||
histo2->Fill(slice, energy);
|
||||
G4AnalysisManager::Instance()->FillH1(2,slice,energy);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
void IORTAnalysisManager::SecondaryNeutronEnergyDeposit(G4int slice, G4double energy)
|
||||
{
|
||||
histo3->Fill(slice, energy);
|
||||
G4AnalysisManager::Instance()->FillH1(3,slice,energy);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
void IORTAnalysisManager::SecondaryAlphaEnergyDeposit(G4int slice, G4double energy)
|
||||
{
|
||||
histo4->Fill(slice, energy);
|
||||
G4AnalysisManager::Instance()->FillH1(4,slice,energy);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
void IORTAnalysisManager::SecondaryGammaEnergyDeposit(G4int slice, G4double energy)
|
||||
{
|
||||
histo5->Fill(slice, energy);
|
||||
G4AnalysisManager::Instance()->FillH1(5,slice,energy);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
void IORTAnalysisManager::SecondaryElectronEnergyDeposit(G4int slice, G4double energy)
|
||||
{
|
||||
histo6->Fill(slice, energy);
|
||||
G4AnalysisManager::Instance()->FillH1(6,slice,energy);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
void IORTAnalysisManager::SecondaryTritonEnergyDeposit(G4int slice, G4double energy)
|
||||
{
|
||||
histo7->Fill(slice, energy);
|
||||
G4AnalysisManager::Instance()->FillH1(7,slice,energy);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
void IORTAnalysisManager::SecondaryDeuteronEnergyDeposit(G4int slice, G4double energy)
|
||||
{
|
||||
histo8->Fill(slice, energy);
|
||||
G4AnalysisManager::Instance()->FillH1(8,slice,energy);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
void IORTAnalysisManager::SecondaryPionEnergyDeposit(G4int slice, G4double energy)
|
||||
{
|
||||
histo9->Fill(slice, energy);
|
||||
G4AnalysisManager::Instance()->FillH1(9,slice,energy);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
void IORTAnalysisManager::electronEnergyDistribution(G4double energy)
|
||||
{
|
||||
histo10->Fill(energy);
|
||||
G4AnalysisManager::Instance()->FillH1(10,energy);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
void IORTAnalysisManager::gammaEnergyDistribution(G4double energy)
|
||||
{
|
||||
histo11->Fill(energy);
|
||||
G4AnalysisManager::Instance()->FillH1(11,energy);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
void IORTAnalysisManager::deuteronEnergyDistribution(G4double energy)
|
||||
{
|
||||
histo12->Fill(energy);
|
||||
G4AnalysisManager::Instance()->FillH1(12,energy);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
void IORTAnalysisManager::tritonEnergyDistribution(G4double energy)
|
||||
{
|
||||
histo13->Fill(energy);
|
||||
G4AnalysisManager::Instance()->FillH1(13,energy);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
void IORTAnalysisManager::alphaEnergyDistribution(G4double energy)
|
||||
{
|
||||
histo14->Fill(energy);
|
||||
G4AnalysisManager::Instance()->FillH1(14,energy);
|
||||
}
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
void IORTAnalysisManager::heliumEnergy(G4double secondaryParticleKineticEnergy)
|
||||
{
|
||||
histo15->Fill(secondaryParticleKineticEnergy);
|
||||
G4AnalysisManager::Instance()->FillH1(15,secondaryParticleKineticEnergy);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
void IORTAnalysisManager::hydrogenEnergy(G4double secondaryParticleKineticEnergy)
|
||||
{
|
||||
histo16->Fill(secondaryParticleKineticEnergy);
|
||||
G4AnalysisManager::Instance()->FillH1(16,secondaryParticleKineticEnergy);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// FillKineticFragmentTuple create an ntuple where the voxel indexs, the atomic number and mass and the kinetic
|
||||
// energy of all the particles interacting with the phantom, are stored
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// FillKineticFragmentTuple create an ntuple where the voxel indexs, the atomic number and mass and the kinetic
|
||||
// energy of all the particles interacting with the phantom, are stored
|
||||
void IORTAnalysisManager::FillKineticFragmentTuple(G4int i, G4int j, G4int k, G4int A, G4double Z, G4double kinEnergy)
|
||||
{
|
||||
kinFragNtuple -> Fill(i, j, k, A, Z, kinEnergy);
|
||||
G4AnalysisManager* man = G4AnalysisManager::Instance();
|
||||
man->FillNtupleIColumn(1,0,i);
|
||||
man->FillNtupleIColumn(1,1,j);
|
||||
man->FillNtupleIColumn(1,2,k);
|
||||
man->FillNtupleIColumn(1,3,A);
|
||||
man->FillNtupleDColumn(1,4,Z);
|
||||
man->FillNtupleDColumn(1,5,kinEnergy);
|
||||
man->AddNtupleRow(1);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// FillKineticEnergyPrimaryNTuple creates a ntuple where the voxel indexs and the kinetic
|
||||
// energies of ONLY primary particles interacting with the phantom, are stored
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// FillKineticEnergyPrimaryNTuple creates a ntuple where the voxel indexs and the kinetic
|
||||
// energies of ONLY primary particles interacting with the phantom, are stored
|
||||
void IORTAnalysisManager::FillKineticEnergyPrimaryNTuple(G4int i, G4int j, G4int k, G4double kinEnergy)
|
||||
{
|
||||
kineticEnergyPrimaryNtuple -> Fill(i, j, k, kinEnergy);
|
||||
G4AnalysisManager* man = G4AnalysisManager::Instance();
|
||||
man->FillNtupleIColumn(2,0,i);
|
||||
man->FillNtupleIColumn(2,1,j);
|
||||
man->FillNtupleIColumn(2,2,k);
|
||||
man->FillNtupleDColumn(2,3,kinEnergy);
|
||||
man->AddNtupleRow(2);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// This function is called only if ROOT is activated.
|
||||
// It is called by the IORTMatric.cc class file and it is used to create two ntuples containing
|
||||
// the total energy deposited and the fluence values, in each voxel and per any particle (primary
|
||||
// and secondary particles beam)
|
||||
void IORTAnalysisManager::FillVoxelFragmentTuple(G4int i, G4int j, G4int k, G4int A, G4double Z, G4double energy, G4double fluence)
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// This function is called only if ROOT is activated.
|
||||
// It is called by the IORTMatric.cc class file and it is used to create two ntuples containing
|
||||
// the total energy deposited and the fluence values, in each voxel and per any particle (primary
|
||||
// and secondary particles beam)
|
||||
void IORTAnalysisManager::FillVoxelFragmentTuple(G4int i, G4int j, G4int k, G4int A, G4double Z,
|
||||
G4double energy, G4double fluence)
|
||||
{
|
||||
// Fill the ntuple containing the voxel, mass and atomic number and the energy deposited
|
||||
doseFragNtuple -> Fill( i, j, k, A, Z, energy );
|
||||
|
||||
// Fill the ntuple containing the voxel, mass and atomic number and the fluence
|
||||
if (i==1 && Z==1) {
|
||||
fluenceFragNtuple -> Fill( i, j, k, A, Z, fluence );
|
||||
|
||||
}
|
||||
G4AnalysisManager* man = G4AnalysisManager::Instance();
|
||||
man->FillNtupleIColumn(3,0,i);
|
||||
man->FillNtupleIColumn(3,1,j);
|
||||
man->FillNtupleIColumn(3,2,k);
|
||||
man->FillNtupleIColumn(3,3,A);
|
||||
man->FillNtupleDColumn(3,4,Z);
|
||||
man->FillNtupleDColumn(3,5,energy);
|
||||
man->AddNtupleRow(3);
|
||||
|
||||
|
||||
// Fill the ntuple containing the voxel, mass and atomic number and the fluence
|
||||
if (i==1 && Z==1) {
|
||||
man->FillNtupleIColumn(4,0,i);
|
||||
man->FillNtupleIColumn(4,1,j);
|
||||
man->FillNtupleIColumn(4,2,k);
|
||||
man->FillNtupleIColumn(4,3,A);
|
||||
man->FillNtupleDColumn(4,4,Z);
|
||||
man->FillNtupleDColumn(4,5,fluence);
|
||||
man->AddNtupleRow(4);
|
||||
}
|
||||
}
|
||||
|
||||
void IORTAnalysisManager::FillLetFragmentTuple(G4int i, G4int j, G4int k, G4int A, G4double Z, G4double letT, G4double letD)
|
||||
void IORTAnalysisManager::FillLetFragmentTuple(G4int i, G4int j, G4int k, G4int A, G4double Z,
|
||||
G4double letT, G4double letD)
|
||||
{
|
||||
letFragNtuple -> Fill( i, j, k, A, Z, letT, letD);
|
||||
|
||||
G4AnalysisManager* man = G4AnalysisManager::Instance();
|
||||
man->FillNtupleIColumn(5,0,i);
|
||||
man->FillNtupleIColumn(5,1,j);
|
||||
man->FillNtupleIColumn(5,2,k);
|
||||
man->FillNtupleIColumn(5,3,A);
|
||||
man->FillNtupleDColumn(5,4,Z);
|
||||
man->FillNtupleDColumn(5,5,letT);
|
||||
man->FillNtupleDColumn(5,6,letD);
|
||||
man->AddNtupleRow(5);
|
||||
}
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
void IORTAnalysisManager::FillFragmentTuple(G4int A, G4double Z, G4double energy, G4double posX, G4double posY, G4double posZ)
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
void IORTAnalysisManager::FillFragmentTuple(G4int A, G4double Z, G4double energy,
|
||||
G4double posX, G4double posY, G4double posZ)
|
||||
{
|
||||
fragmentNtuple->Fill(A, Z, energy, posX, posY, posZ);
|
||||
G4AnalysisManager* man = G4AnalysisManager::Instance();
|
||||
man->FillNtupleIColumn(8,0,A);
|
||||
man->FillNtupleDColumn(8,1,Z);
|
||||
man->FillNtupleDColumn(8,2,energy);
|
||||
man->FillNtupleDColumn(8,3,posX);
|
||||
man->FillNtupleDColumn(8,4,posY);
|
||||
man->FillNtupleDColumn(8,5,posZ);
|
||||
man->AddNtupleRow(8);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
void IORTAnalysisManager::genericIonInformation(G4int a,
|
||||
G4double z,
|
||||
G4int electronOccupancy,
|
||||
G4double energy)
|
||||
G4double z,
|
||||
G4int electronOccupancy,
|
||||
G4double energy)
|
||||
{
|
||||
if (theROOTIonTuple) {
|
||||
theROOTIonTuple->Fill(a, z, electronOccupancy, energy);
|
||||
}
|
||||
G4AnalysisManager* man = G4AnalysisManager::Instance();
|
||||
man->FillNtupleIColumn(7,0,a);
|
||||
man->FillNtupleDColumn(7,1,z);
|
||||
man->FillNtupleIColumn(7,2,electronOccupancy);
|
||||
man->FillNtupleDColumn(7,3,energy);
|
||||
man->AddNtupleRow(7);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
void IORTAnalysisManager::startNewEvent()
|
||||
{
|
||||
eventCounter++;
|
||||
eventCounter++;
|
||||
}
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
void IORTAnalysisManager::setGeometryMetaData(G4double endDetectorPosition, G4double waterThickness, G4double phantomCenter)
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
void IORTAnalysisManager::setGeometryMetaData(G4double endDetectorPosition, G4double waterThickness,
|
||||
G4double phantomCenter)
|
||||
{
|
||||
this->detectorDistance = endDetectorPosition;
|
||||
this->phantomDepth = waterThickness;
|
||||
this->phantomCenterDistance = phantomCenter;
|
||||
detectorDistance = endDetectorPosition;
|
||||
phantomDepth = waterThickness;
|
||||
phantomCenterDistance = phantomCenter;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
void IORTAnalysisManager::setBeamMetaData(G4double meanKineticEnergy,G4double sigmaEnergy)
|
||||
{
|
||||
this->beamEnergy = meanKineticEnergy;
|
||||
this->energyError = sigmaEnergy;
|
||||
beamEnergy = meanKineticEnergy;
|
||||
energyError = sigmaEnergy;
|
||||
}
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Flush data & close the file
|
||||
void IORTAnalysisManager::flush()
|
||||
{
|
||||
if (theTFile)
|
||||
{
|
||||
theTFile -> Write();
|
||||
theTFile -> Close();
|
||||
}
|
||||
theTFile = 0;
|
||||
eventCounter = 0;
|
||||
// Save histograms
|
||||
G4AnalysisManager* man = G4AnalysisManager::Instance();
|
||||
man->Write();
|
||||
man->CloseFile();
|
||||
eventCounter = 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -687,14 +687,6 @@ void IORTDetectorConstruction::UpdateGeometry()
|
||||
numberOfVoxelsAlongZ,
|
||||
massOfVoxel);
|
||||
|
||||
// Initialize analysis
|
||||
/*
|
||||
IORTAnalysisManager* analysis = IORTAnalysisManager::GetInstance();
|
||||
#ifdef G4ANALYSIS_USE_ROOT
|
||||
analysis -> flush(); // Finalize the root file
|
||||
analysis -> book();
|
||||
#endif
|
||||
*/
|
||||
// Inform the kernel about the new geometry
|
||||
G4RunManager::GetRunManager() -> GeometryHasBeenModified();
|
||||
G4RunManager::GetRunManager() -> PhysicsHasBeenModified();
|
||||
|
||||
@@ -101,9 +101,7 @@ G4bool IORTDetectorSD::ProcessHits(G4Step* aStep, G4TouchableHistory* ROhist)
|
||||
G4int i = ROhist -> GetReplicaNumber(2);
|
||||
G4int j = ROhist -> GetReplicaNumber(1);
|
||||
|
||||
#ifdef G4ANALYSIS_USE_ROOT
|
||||
IORTAnalysisManager* analysis = IORTAnalysisManager::GetInstance();
|
||||
#endif
|
||||
|
||||
IORTMatrix* matrix = IORTMatrix::GetInstance();
|
||||
|
||||
@@ -122,23 +120,21 @@ G4bool IORTDetectorSD::ProcessHits(G4Step* aStep, G4TouchableHistory* ROhist)
|
||||
*/
|
||||
if ( Z >= 1)
|
||||
matrix -> Fill(trackID, particleDef, i, j, k, 0, true);
|
||||
#ifdef G4ANALYSIS_USE_ROOT
|
||||
/*
|
||||
// Fragments kinetic energy (ntuple)
|
||||
if (trackID !=1 && Z>=1)
|
||||
{
|
||||
/*
|
||||
// Fragments kinetic energy (ntuple)
|
||||
if (trackID !=1 && Z>=1)
|
||||
{
|
||||
// First step kinetic energy for every fragment
|
||||
analysis -> FillKineticFragmentTuple(i, j, k, A, Z, kineticEnergy/MeV);
|
||||
}
|
||||
// Kinetic energy spectra for primary particles
|
||||
|
||||
if ( trackID == 1 && i == 0)
|
||||
{
|
||||
analysis -> FillKineticFragmentTuple(i, j, k, A, Z, kineticEnergy/MeV);
|
||||
}
|
||||
// Kinetic energy spectra for primary particles
|
||||
|
||||
if ( trackID == 1 && i == 0)
|
||||
{
|
||||
// First step kinetic energy for primaries only
|
||||
analysis -> FillKineticEnergyPrimaryNTuple(i, j, k, kineticEnergy/MeV);
|
||||
}
|
||||
*/
|
||||
#endif
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
if(energyDeposit != 0)
|
||||
@@ -161,11 +157,10 @@ G4bool IORTDetectorSD::ProcessHits(G4Step* aStep, G4TouchableHistory* ROhist)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef G4ANALYSIS_USE_ROOT
|
||||
if(energyDeposit != 0)
|
||||
{
|
||||
{
|
||||
if(trackID != 1)
|
||||
{
|
||||
{
|
||||
if (particleName == "proton")
|
||||
analysis -> SecondaryProtonEnergyDeposit(i, energyDeposit/MeV);
|
||||
|
||||
@@ -187,11 +182,11 @@ G4bool IORTDetectorSD::ProcessHits(G4Step* aStep, G4TouchableHistory* ROhist)
|
||||
else if (particleName == "deuteron")
|
||||
analysis -> SecondaryDeuteronEnergyDeposit(i, energyDeposit/MeV);
|
||||
|
||||
else if (particleName == "pi+" || particleName == "pi-" || particleName == "pi0")
|
||||
else if (particleName == "pi+" || particleName == "pi-" ||
|
||||
particleName == "pi0")
|
||||
analysis -> SecondaryPionEnergyDeposit(i, energyDeposit/MeV);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -199,12 +194,12 @@ G4bool IORTDetectorSD::ProcessHits(G4Step* aStep, G4TouchableHistory* ROhist)
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
void IORTDetectorSD::EndOfEvent(G4HCofThisEvent* HCE)
|
||||
{
|
||||
static G4int HCID = -1;
|
||||
if(HCID < 0)
|
||||
static G4int HCID = -1;
|
||||
if(HCID < 0)
|
||||
{
|
||||
HCID = GetCollectionID(0);
|
||||
HCID = GetCollectionID(0);
|
||||
}
|
||||
|
||||
HCE -> AddHitsCollection(HCID,HitsCollection);
|
||||
HCE -> AddHitsCollection(HCID,HitsCollection);
|
||||
}
|
||||
|
||||
|
||||
@@ -84,110 +84,110 @@ IORTInteractionParameters::~IORTInteractionParameters()
|
||||
}
|
||||
|
||||
G4double IORTInteractionParameters::GetStopping (G4double ene,
|
||||
const G4ParticleDefinition* pDef,
|
||||
const G4Material* pMat,
|
||||
G4double dens)
|
||||
const G4ParticleDefinition* pDef,
|
||||
const G4Material* pMat,
|
||||
G4double dens)
|
||||
{
|
||||
if (dens) return ComputeTotalDEDX(ene, pDef, pMat)/dens;
|
||||
return ComputeTotalDEDX(ene, pDef, pMat);
|
||||
}
|
||||
bool IORTInteractionParameters::GetStoppingTable(const G4String& vararg)
|
||||
{
|
||||
// Check arguments
|
||||
if ( !ParseArg(vararg)) return false;
|
||||
// Clear previous energy & mass sp vectors
|
||||
energy.clear();
|
||||
massDedx.clear();
|
||||
// log scale
|
||||
if (kinEmin != kinEmax && npoints >1)
|
||||
// Check arguments
|
||||
if ( !ParseArg(vararg)) return false;
|
||||
// Clear previous energy & mass sp vectors
|
||||
energy.clear();
|
||||
massDedx.clear();
|
||||
// log scale
|
||||
if (kinEmin != kinEmax && npoints >1)
|
||||
{
|
||||
G4double logmin = std::log10(kinEmin);
|
||||
G4double logmax = std::log10(kinEmax);
|
||||
G4double en;
|
||||
// uniform log space
|
||||
for (G4double c = 0.; c < npoints; c++)
|
||||
{
|
||||
G4double logmin = std::log10(kinEmin);
|
||||
G4double logmax = std::log10(kinEmax);
|
||||
G4double en;
|
||||
// uniform log space
|
||||
for (G4double c = 0.; c < npoints; c++)
|
||||
{
|
||||
en = std::pow(10., logmin + ( c*(logmax-logmin) / (npoints - 1.)) );
|
||||
energy.push_back(en/MeV);
|
||||
dedxtot = ComputeTotalDEDX (en, particle, material);
|
||||
massDedx.push_back ( (dedxtot / density)/(MeV*cm2/g) );
|
||||
}
|
||||
en = std::pow(10., logmin + ( c*(logmax-logmin) / (npoints - 1.)) );
|
||||
energy.push_back(en/MeV);
|
||||
dedxtot = ComputeTotalDEDX (en, particle, material);
|
||||
massDedx.push_back ( (dedxtot / density)/(MeV*cm2/g) );
|
||||
}
|
||||
else // one point only
|
||||
{
|
||||
energy.push_back(kinEmin/MeV);
|
||||
dedxtot = ComputeTotalDEDX (kinEmin, particle, material);
|
||||
massDedx.push_back ( (dedxtot / density)/(MeV*cm2/g) );
|
||||
}
|
||||
|
||||
G4cout.precision(6);
|
||||
data << "MeV " << "MeV*cm2/g " << particle << " (into " <<
|
||||
material << ", density = " << G4BestUnit(density,"Volumic Mass") << ")" << G4endl;
|
||||
data << G4endl;
|
||||
data << std::left << std::setfill(' ');
|
||||
for (size_t i=0; i<energy.size(); i++){
|
||||
data << std::setw(16) << energy[i] << massDedx[i] << G4endl;
|
||||
}
|
||||
outfile.close();
|
||||
// This will plot
|
||||
}
|
||||
else // one point only
|
||||
{
|
||||
energy.push_back(kinEmin/MeV);
|
||||
dedxtot = ComputeTotalDEDX (kinEmin, particle, material);
|
||||
massDedx.push_back ( (dedxtot / density)/(MeV*cm2/g) );
|
||||
}
|
||||
|
||||
G4cout.precision(6);
|
||||
data << "MeV " << "MeV*cm2/g " << particle << " (into " <<
|
||||
material << ", density = " << G4BestUnit(density,"Volumic Mass") << ")" << G4endl;
|
||||
data << G4endl;
|
||||
data << std::left << std::setfill(' ');
|
||||
for (size_t i=0; i<energy.size(); i++){
|
||||
data << std::setw(16) << energy[i] << massDedx[i] << G4endl;
|
||||
}
|
||||
outfile.close();
|
||||
// This will plot
|
||||
#ifdef G4ANALYSIS_USE_ROOT
|
||||
PlotStopping("pdf");
|
||||
PlotStopping("pdf");
|
||||
#endif
|
||||
|
||||
// Info to user
|
||||
G4String ofName = (filename == "") ? "User terminal": filename;
|
||||
G4cout << "User choice:\n";
|
||||
G4cout << "Kinetic energy lower limit= "<< G4BestUnit(kinEmin,"Energy") <<
|
||||
", Kinetic energy upper limit= " << G4BestUnit(kinEmax,"Energy") <<
|
||||
", npoints= "<< npoints << ", particle= \"" << particle <<
|
||||
"\", material= \"" << material << "\", filename= \""<<
|
||||
ofName << "\"" << G4endl;
|
||||
return true;
|
||||
// Info to user
|
||||
G4String ofName = (filename == "") ? "User terminal": filename;
|
||||
G4cout << "User choice:\n";
|
||||
G4cout << "Kinetic energy lower limit= "<< G4BestUnit(kinEmin,"Energy") <<
|
||||
", Kinetic energy upper limit= " << G4BestUnit(kinEmax,"Energy") <<
|
||||
", npoints= "<< npoints << ", particle= \"" << particle <<
|
||||
"\", material= \"" << material << "\", filename= \""<<
|
||||
ofName << "\"" << G4endl;
|
||||
return true;
|
||||
}
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Save Plot
|
||||
#ifdef G4ANALYSIS_USE_ROOT
|
||||
void IORTInteractionParameters::PlotStopping(const G4String& filetype)
|
||||
{
|
||||
if (!theRootCanvas)
|
||||
if (!theRootCanvas)
|
||||
{
|
||||
gROOT->Reset();
|
||||
gROOT->SetStyle("Plain");
|
||||
theRootCanvas = new TCanvas("theRootCanvas","Interaction Parameters",200, 10, 600,400);
|
||||
theRootCanvas -> SetFillColor(20);
|
||||
theRootCanvas -> SetBorderMode(1);
|
||||
theRootCanvas -> SetBorderSize(1);
|
||||
theRootCanvas -> SetFrameBorderMode(0);
|
||||
theRootCanvas -> SetGrid();
|
||||
// Use global pad: root manual pgg 109,...
|
||||
gROOT->Reset();
|
||||
gROOT->SetStyle("Plain");
|
||||
theRootCanvas = new TCanvas("theRootCanvas","Interaction Parameters",200, 10, 600,400);
|
||||
theRootCanvas -> SetFillColor(20);
|
||||
theRootCanvas -> SetBorderMode(1);
|
||||
theRootCanvas -> SetBorderSize(1);
|
||||
theRootCanvas -> SetFrameBorderMode(0);
|
||||
theRootCanvas -> SetGrid();
|
||||
// Use global pad: root manual pgg 109,...
|
||||
}
|
||||
|
||||
if (theRootGraph) delete theRootGraph;
|
||||
theRootGraph = new TGraph(energy.size(), &energy[0], &massDedx[0]);
|
||||
//theRootGraph = new TGraph();
|
||||
axisX = theRootGraph -> GetXaxis(),
|
||||
|
||||
if (theRootGraph) delete theRootGraph;
|
||||
theRootGraph = new TGraph(energy.size(), &energy[0], &massDedx[0]);
|
||||
//theRootGraph = new TGraph();
|
||||
axisX = theRootGraph -> GetXaxis(),
|
||||
axisY = theRootGraph -> GetYaxis();
|
||||
axisX -> SetTitle("MeV");
|
||||
axisY -> SetTitle("Stopping Power (MeV cm2/g)");
|
||||
//axisX -> SetNdivisions(500,kTRUE);
|
||||
//axisX -> SetTickLength(0.03);
|
||||
//axisX -> SetLabelOffset(2.005);
|
||||
axisX -> SetAxisColor(2);
|
||||
axisY -> SetAxisColor(2);
|
||||
gPad -> SetLogx(1);
|
||||
gPad -> SetLogy(1);
|
||||
theRootGraph -> SetMarkerColor(4);
|
||||
theRootGraph -> SetMarkerStyle(20);// circle
|
||||
theRootGraph -> SetMarkerSize(.5);
|
||||
|
||||
G4String gName = particle.substr(0, particle.find("[") ); // cut excitation energy
|
||||
gName = gName + "_" + material;
|
||||
G4String fName = "./referenceData/interaction/" + gName + "." + filetype;
|
||||
theRootGraph -> SetTitle(gName);
|
||||
theRootGraph -> Draw("AP");
|
||||
//theRootCanvas -> Update();
|
||||
//theRootCanvas -> Draw();
|
||||
theRootCanvas -> SaveAs(fName);
|
||||
axisX -> SetTitle("MeV");
|
||||
axisY -> SetTitle("Stopping Power (MeV cm2/g)");
|
||||
//axisX -> SetNdivisions(500,kTRUE);
|
||||
//axisX -> SetTickLength(0.03);
|
||||
//axisX -> SetLabelOffset(2.005);
|
||||
axisX -> SetAxisColor(2);
|
||||
axisY -> SetAxisColor(2);
|
||||
gPad -> SetLogx(1);
|
||||
gPad -> SetLogy(1);
|
||||
theRootGraph -> SetMarkerColor(4);
|
||||
theRootGraph -> SetMarkerStyle(20);// circle
|
||||
theRootGraph -> SetMarkerSize(.5);
|
||||
|
||||
G4String gName = particle.substr(0, particle.find("[") ); // cut excitation energy
|
||||
gName = gName + "_" + material;
|
||||
G4String fName = "./referenceData/interaction/" + gName + "." + filetype;
|
||||
theRootGraph -> SetTitle(gName);
|
||||
theRootGraph -> Draw("AP");
|
||||
//theRootCanvas -> Update();
|
||||
//theRootCanvas -> Draw();
|
||||
theRootCanvas -> SaveAs(fName);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -275,20 +275,21 @@ void IORTInteractionParameters::ListOfNistMaterials(const G4String& vararg)
|
||||
You can also construct a new material by the ConstructNewMaterial method:
|
||||
see $G4INSTALL/source/materials/src/G4NistMaterialBuilder.cc
|
||||
*/
|
||||
// Get simplest full list
|
||||
if (vararg =="list")
|
||||
{
|
||||
const std::vector<G4String>& vec = nistMat -> GetMaterialNames();
|
||||
for (size_t i=0; i<vec.size(); i++)
|
||||
{
|
||||
G4cout << std::setw(12) << std::left << i+1 << vec[i] << G4endl;
|
||||
}
|
||||
G4cout << G4endl;
|
||||
}
|
||||
else if (vararg =="all" || vararg =="simple" || vararg =="compound" || vararg =="hep" )
|
||||
// Get simplest full list
|
||||
if (vararg =="list")
|
||||
{
|
||||
const std::vector<G4String>& vec = nistMat -> GetMaterialNames();
|
||||
for (size_t i=0; i<vec.size(); i++)
|
||||
{
|
||||
nistMat -> ListMaterials(vararg);
|
||||
G4cout << std::setw(12) << std::left << i+1 << vec[i] << G4endl;
|
||||
}
|
||||
G4cout << G4endl;
|
||||
}
|
||||
else if (vararg =="all" || vararg =="simple" ||
|
||||
vararg =="compound" || vararg =="hep" )
|
||||
{
|
||||
nistMat -> ListMaterials(vararg);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -359,33 +359,29 @@ void IORTMatrix::StoreDoseFluenceAscii(G4String file)
|
||||
}
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef G4ANALYSIS_USE_ROOT
|
||||
void IORTMatrix::StoreDoseFluenceRoot()
|
||||
{
|
||||
IORTAnalysisManager* analysis = IORTAnalysisManager::GetInstance();
|
||||
if (analysis -> IsTheTFile())
|
||||
{
|
||||
for(G4int i = 0; i < numberOfVoxelAlongX; i++)
|
||||
for(G4int j = 0; j < numberOfVoxelAlongY; j++)
|
||||
for(G4int k = 0; k < numberOfVoxelAlongZ; k++)
|
||||
{
|
||||
G4int n = Index(i, j, k);
|
||||
for (size_t l=0; l < ionStore.size(); l++)
|
||||
|
||||
{
|
||||
// Do the same work for .root file: fill dose/fluence ntuple
|
||||
analysis -> FillVoxelFragmentTuple( i, j, k,
|
||||
ionStore[l].A,
|
||||
ionStore[l].Z,
|
||||
ionStore[l].dose[n]/massOfVoxel/doseUnit,
|
||||
ionStore[l].fluence[n] );
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
for(G4int i = 0; i < numberOfVoxelAlongX; i++)
|
||||
for(G4int j = 0; j < numberOfVoxelAlongY; j++)
|
||||
for(G4int k = 0; k < numberOfVoxelAlongZ; k++)
|
||||
{
|
||||
G4int n = Index(i, j, k);
|
||||
for (size_t l=0; l < ionStore.size(); l++)
|
||||
|
||||
{
|
||||
// Do the same work for .root file: fill dose/fluence ntuple
|
||||
analysis -> FillVoxelFragmentTuple( i, j, k,
|
||||
ionStore[l].A,
|
||||
ionStore[l].Z,
|
||||
ionStore[l].dose[n]/massOfVoxel/doseUnit,
|
||||
ionStore[l].fluence[n] );
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void IORTMatrix::Fill(G4int i, G4int j, G4int k,
|
||||
G4double energyDeposit)
|
||||
@@ -400,69 +396,6 @@ void IORTMatrix::TotalEnergyDeposit()
|
||||
{
|
||||
// Store the information of the matrix in a ntuple and in
|
||||
// a 1D Histogram
|
||||
|
||||
/*
|
||||
/////////////////////////////////// imported from eliot_geant4.9.3p01_version /////////////////////////////
|
||||
G4int k;
|
||||
G4int j;
|
||||
G4int i;
|
||||
|
||||
if (matrix)
|
||||
{ // AGGIUNTO
|
||||
std::ofstream ofs; // AGGIUNTO
|
||||
|
||||
ofs.open("PDD9.9Mev_coll60_0gradi_s500_Sp1_6gradi_step0.01_setcuts0.01.out"); // AGGIUNTO
|
||||
|
||||
for(G4int l = 0; l < numberOfVoxelAlongZ; l++) // was "numberVoxelZ" and so in the other directions
|
||||
{
|
||||
k = l;
|
||||
|
||||
for(G4int m = 0; m < numberOfVoxelAlongY; m++)
|
||||
{
|
||||
j = m * numberOfVoxelAlongZ + k;
|
||||
|
||||
for(G4int n = 0; n < numberOfVoxelAlongX; n++)
|
||||
{
|
||||
i = n* numberOfVoxelAlongZ * numberOfVoxelAlongY + j;
|
||||
if(matrix[i] != 0)
|
||||
{
|
||||
ofs<< n <<'\t'<< m <<'\t'<< // AGGIUNTO
|
||||
k<<'\t'<<matrix[i]<<G4endl; // AGGIUNTO
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
ofs.close(); // AGGIUNTO
|
||||
}
|
||||
/////////////////////////////////// imported from eliot_geant4.9.3p01_version /////////////////////////////
|
||||
*/
|
||||
|
||||
// Convert energy deposited to dose.
|
||||
// Store the information of the matrix in a ntuple and in
|
||||
// a 1D Histogram
|
||||
/*
|
||||
IORTAnalysisManager* analysis = IORTAnalysisManager::GetInstance();
|
||||
if (matrix)
|
||||
{
|
||||
for(G4int i = 0; i < numberOfVoxelAlongX; i++)
|
||||
for(G4int j = 0; j < numberOfVoxelAlongY; j++)
|
||||
for(G4int k = 0; k < numberOfVoxelAlongZ; k++)
|
||||
{
|
||||
G4int n = Index(i,j,k);
|
||||
|
||||
#ifdef G4ANALYSIS_USE_ROOT
|
||||
if (analysis -> IsTheTFile() )
|
||||
{
|
||||
analysis -> FillEnergyDeposit(i, j, k, matrix[n]/massOfVoxel/doseUnit);
|
||||
analysis -> BraggPeak(i, matrix[n]/massOfVoxel/doseUnit);
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -89,10 +89,10 @@ void IORTPrimaryGeneratorAction::SetDefaultPrimaryParticle()
|
||||
G4double defaultsigmaEnergy = 100.0 *CLHEP::keV;
|
||||
sigmaEnergy = defaultsigmaEnergy;
|
||||
|
||||
#ifdef G4ANALYSIS_USE_ROOT
|
||||
// Write these values into the analysis if needed. Have to be written separately on change.
|
||||
IORTAnalysisManager::GetInstance()->setBeamMetaData(meanKineticEnergy, sigmaEnergy);
|
||||
#endif
|
||||
IORTAnalysisManager::GetInstance()->
|
||||
setBeamMetaData(meanKineticEnergy, sigmaEnergy);
|
||||
|
||||
|
||||
// Define the parameters of the initial position:
|
||||
// the y, z coordinates have a gaussian distribution
|
||||
@@ -131,10 +131,8 @@ void IORTPrimaryGeneratorAction::SetDefaultPrimaryParticle()
|
||||
|
||||
void IORTPrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
|
||||
{
|
||||
#ifdef G4ANALYSIS_USE_ROOT
|
||||
// Increment the event counter
|
||||
IORTAnalysisManager::GetInstance()->startNewEvent();
|
||||
#endif
|
||||
|
||||
// ****************************************
|
||||
// Set the beam angular apread
|
||||
@@ -229,20 +227,20 @@ while (true) {
|
||||
void IORTPrimaryGeneratorAction::SetmeanKineticEnergy (G4double val )
|
||||
{
|
||||
meanKineticEnergy = val;
|
||||
#ifdef G4ANALYSIS_USE_ROOT
|
||||
|
||||
// Update the beam-data in the analysis manager
|
||||
IORTAnalysisManager::GetInstance()->setBeamMetaData(meanKineticEnergy, sigmaEnergy);
|
||||
#endif
|
||||
IORTAnalysisManager::GetInstance()->
|
||||
setBeamMetaData(meanKineticEnergy, sigmaEnergy);
|
||||
|
||||
|
||||
}
|
||||
|
||||
void IORTPrimaryGeneratorAction::SetsigmaEnergy (G4double val )
|
||||
{
|
||||
sigmaEnergy = val;
|
||||
#ifdef G4ANALYSIS_USE_ROOT
|
||||
sigmaEnergy = val;
|
||||
// Update the sigmaenergy in the metadata.
|
||||
IORTAnalysisManager::GetInstance()->setBeamMetaData(meanKineticEnergy, sigmaEnergy);
|
||||
#endif
|
||||
IORTAnalysisManager::GetInstance()->
|
||||
setBeamMetaData(meanKineticEnergy, sigmaEnergy);
|
||||
}
|
||||
|
||||
void IORTPrimaryGeneratorAction::SetXposition (G4double val )
|
||||
|
||||
@@ -57,6 +57,7 @@
|
||||
#include "IORTAnalysisManager.hh"
|
||||
|
||||
#include "IORTRunAction.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
IORTSteppingAction::IORTSteppingAction( IORTRunAction *run)
|
||||
@@ -88,26 +89,26 @@ void IORTSteppingAction::UserSteppingAction(const G4Step* aStep)
|
||||
*/
|
||||
|
||||
if( aStep->GetTrack()->GetVolume()->GetName() == "NewDetectorPhys"){
|
||||
#ifdef G4ANALYSIS_USE_ROOT
|
||||
G4ParticleDefinition *def = aStep->GetTrack()->GetDefinition();
|
||||
G4double secondaryParticleKineticEnergy = aStep->GetTrack()->GetKineticEnergy();
|
||||
G4double secondaryParticleKineticEnergy = aStep->GetTrack()->
|
||||
GetKineticEnergy();
|
||||
G4String particleType = def->GetParticleType(); // particle type = nucleus for d, t, He3, alpha, and heavier nuclei
|
||||
G4String particleName = def->GetParticleName(); // e.g. for alpha: the name = "alpha" and type = "nucleus"
|
||||
if(particleType == "nucleus") {
|
||||
G4int A = def->GetBaryonNumber();
|
||||
G4double Z = def->GetPDGCharge();
|
||||
G4double posX = aStep->GetTrack()->GetPosition().x() / CLHEP::cm;
|
||||
G4double posY = aStep->GetTrack()->GetPosition().y() / CLHEP::cm;
|
||||
G4double posZ = aStep->GetTrack()->GetPosition().z() / CLHEP::cm;
|
||||
G4double energy = secondaryParticleKineticEnergy / A / CLHEP::MeV;
|
||||
G4double posX = aStep->GetTrack()->GetPosition().x() /cm;
|
||||
G4double posY = aStep->GetTrack()->GetPosition().y() /cm;
|
||||
G4double posZ = aStep->GetTrack()->GetPosition().z() /cm;
|
||||
G4double energy = secondaryParticleKineticEnergy / A /MeV;
|
||||
|
||||
IORTAnalysisManager* analysisMgr = IORTAnalysisManager::GetInstance();
|
||||
analysisMgr->FillFragmentTuple(A, Z, energy, posX, posY, posZ);
|
||||
} else if(particleName == "proton") { // proton (hydrogen-1) is a special case
|
||||
G4double posX = aStep->GetTrack()->GetPosition().x() / CLHEP::cm ;
|
||||
G4double posY = aStep->GetTrack()->GetPosition().y() / CLHEP::cm ;
|
||||
G4double posZ = aStep->GetTrack()->GetPosition().z() / CLHEP::cm ;
|
||||
G4double energy = secondaryParticleKineticEnergy * CLHEP::MeV; // Hydrogen-1: A = 1, Z = 1
|
||||
G4double posX = aStep->GetTrack()->GetPosition().x() /cm ;
|
||||
G4double posY = aStep->GetTrack()->GetPosition().y() /cm ;
|
||||
G4double posZ = aStep->GetTrack()->GetPosition().z() / cm ;
|
||||
G4double energy = secondaryParticleKineticEnergy / MeV; // Hydrogen-1: A = 1, Z = 1
|
||||
IORTAnalysisManager::GetInstance()->FillFragmentTuple(1, 1.0, energy, posX, posY, posZ);
|
||||
}
|
||||
|
||||
@@ -117,21 +118,20 @@ void IORTSteppingAction::UserSteppingAction(const G4Step* aStep)
|
||||
IORTAnalysisManager* analysis = IORTAnalysisManager::GetInstance();
|
||||
//There is a bunch of stuff recorded with the energy 0, something should perhaps be done about this.
|
||||
if(secondaryParticleName == "proton") {
|
||||
analysis->hydrogenEnergy(secondaryParticleKineticEnergy / CLHEP::MeV);
|
||||
analysis->hydrogenEnergy(secondaryParticleKineticEnergy /MeV);
|
||||
}
|
||||
if(secondaryParticleName == "deuteron") {
|
||||
analysis->hydrogenEnergy((secondaryParticleKineticEnergy/2) / CLHEP::MeV);
|
||||
analysis->hydrogenEnergy((secondaryParticleKineticEnergy/2) / MeV);
|
||||
}
|
||||
if(secondaryParticleName == "triton") {
|
||||
analysis->hydrogenEnergy((secondaryParticleKineticEnergy/3) / CLHEP::MeV);
|
||||
analysis->hydrogenEnergy((secondaryParticleKineticEnergy/3) / MeV);
|
||||
}
|
||||
if(secondaryParticleName == "alpha") {
|
||||
analysis->heliumEnergy((secondaryParticleKineticEnergy/4) / CLHEP::MeV);
|
||||
analysis->heliumEnergy((secondaryParticleKineticEnergy/4) / MeV);
|
||||
}
|
||||
if(secondaryParticleName == "He3"){
|
||||
analysis->heliumEnergy((secondaryParticleKineticEnergy/3) / CLHEP::MeV);
|
||||
analysis->heliumEnergy((secondaryParticleKineticEnergy/3) / MeV);
|
||||
}
|
||||
#endif
|
||||
|
||||
aStep->GetTrack()->SetTrackStatus(fKillTrackAndSecondaries);
|
||||
}
|
||||
@@ -178,26 +178,25 @@ void IORTSteppingAction::UserSteppingAction(const G4Step* aStep)
|
||||
|
||||
if (volumeName == "phantomPhys")
|
||||
{
|
||||
#ifdef G4ANALYSIS_USE_ROOT
|
||||
G4String secondaryParticleName = (*fSecondary)[lp1]->GetDefinition() -> GetParticleName();
|
||||
G4String secondaryParticleName = (*fSecondary)[lp1]->GetDefinition() -> GetParticleName();
|
||||
G4double secondaryParticleKineticEnergy = (*fSecondary)[lp1] -> GetKineticEnergy();
|
||||
|
||||
IORTAnalysisManager* analysis = IORTAnalysisManager::GetInstance();
|
||||
|
||||
if (secondaryParticleName == "e-")
|
||||
analysis -> electronEnergyDistribution(secondaryParticleKineticEnergy/CLHEP::MeV);
|
||||
analysis -> electronEnergyDistribution(secondaryParticleKineticEnergy/MeV);
|
||||
|
||||
if (secondaryParticleName == "gamma")
|
||||
analysis -> gammaEnergyDistribution(secondaryParticleKineticEnergy/CLHEP::MeV);
|
||||
analysis -> gammaEnergyDistribution(secondaryParticleKineticEnergy/MeV);
|
||||
|
||||
if (secondaryParticleName == "deuteron")
|
||||
analysis -> deuteronEnergyDistribution(secondaryParticleKineticEnergy/CLHEP::MeV);
|
||||
analysis -> deuteronEnergyDistribution(secondaryParticleKineticEnergy/MeV);
|
||||
|
||||
if (secondaryParticleName == "triton")
|
||||
analysis -> tritonEnergyDistribution(secondaryParticleKineticEnergy/CLHEP::MeV);
|
||||
analysis -> tritonEnergyDistribution(secondaryParticleKineticEnergy/MeV);
|
||||
|
||||
if (secondaryParticleName == "alpha")
|
||||
analysis -> alphaEnergyDistribution(secondaryParticleKineticEnergy/CLHEP::MeV);
|
||||
analysis -> alphaEnergyDistribution(secondaryParticleKineticEnergy/MeV);
|
||||
|
||||
G4double z = (*fSecondary)[lp1]-> GetDynamicParticle() -> GetDefinition() -> GetPDGCharge();
|
||||
if (z > 0.)
|
||||
@@ -207,9 +206,8 @@ void IORTSteppingAction::UserSteppingAction(const G4Step* aStep)
|
||||
|
||||
// If a generic ion is originated in the detector, its baryonic number, PDG charge,
|
||||
// total number of electrons in the orbitals are stored in a ntuple
|
||||
analysis -> genericIonInformation(a, z, electronOccupancy, secondaryParticleKineticEnergy/CLHEP::MeV);
|
||||
analysis -> genericIonInformation(a, z, electronOccupancy, secondaryParticleKineticEnergy/MeV);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user