37 HadrontherapyAnalysisManager::HadrontherapyAnalysisManager()
38 #ifdef G4ANALYSIS_USE_ROOT
40 analysisFileName(
"DoseDistribution.root"),theTFile(0), histo1(0), histo2(0), histo3(0),
41 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),
43 kineticEnergyPrimaryNtuple(0),
61 #ifdef G4ANALYSIS_USE_ROOT
71 #ifdef G4ANALYSIS_USE_ROOT
79 delete fragmentNtuple;
82 delete theROOTIonTuple;
140 void HadrontherapyAnalysisManager::SetAnalysisFileName(
G4String aFileName)
142 this->analysisFileName = aFileName;
146 G4bool HadrontherapyAnalysisManager::IsTheTFile()
148 return (theTFile) ?
true:
false;
150 void HadrontherapyAnalysisManager::book()
154 theTFile =
new TFile(analysisFileName,
"RECREATE");
157 histo1 = createHistogram1D(
"braggPeak",
"slice, energy", 400, 0., 80);
158 histo2 = createHistogram1D(
"h20",
"Secondary protons - slice, energy", 400, 0., 400.);
159 histo3 = createHistogram1D(
"h30",
"Secondary neutrons - slice, energy", 400, 0., 400.);
160 histo4 = createHistogram1D(
"h40",
"Secondary alpha - slice, energy", 400, 0., 400.);
161 histo5 = createHistogram1D(
"h50",
"Secondary gamma - slice, energy", 400, 0., 400.);
162 histo6 = createHistogram1D(
"h60",
"Secondary electron - slice, energy", 400, 0., 400.);
163 histo7 = createHistogram1D(
"h70",
"Secondary triton - slice, energy", 400, 0., 400.);
164 histo8 = createHistogram1D(
"h80",
"Secondary deuteron - slice, energy", 400, 0., 400.);
165 histo9 = createHistogram1D(
"h90",
"Secondary pion - slice, energy", 400, 0., 400.);
166 histo10 = createHistogram1D(
"h100",
"Energy distribution of secondary electrons", 70, 0., 70.);
167 histo11 = createHistogram1D(
"h110",
"Energy distribution of secondary photons", 70, 0., 70.);
168 histo12 = createHistogram1D(
"h120",
"Energy distribution of secondary deuterons", 70, 0., 70.);
169 histo13 = createHistogram1D(
"h130",
"Energy distribution of secondary tritons", 70, 0., 70.);
170 histo14 = createHistogram1D(
"h140",
"Energy distribution of secondary alpha particles", 70, 0., 70.);
171 histo15 = createHistogram1D(
"heliumEnergyAfterPhantom",
"Energy distribution of secondary helium fragments after the phantom",
173 histo16 = createHistogram1D(
"hydrogenEnergyAfterPhantom",
"Energy distribution of secondary helium fragments after the phantom",
176 kinFragNtuple =
new TNtuple(
"kinFragNtuple",
177 "Kinetic energy by voxel & fragment",
178 "i:j:k:A:Z:kineticEnergy");
179 kineticEnergyPrimaryNtuple=
new TNtuple(
"kineticEnergyPrimaryNtuple",
180 "Kinetic energy by voxel of primary",
181 "i:j:k:kineticEnergy");
182 doseFragNtuple =
new TNtuple(
"doseFragNtuple",
183 "Energy deposit by voxel & fragment",
186 fluenceFragNtuple =
new TNtuple(
"fluenceFragNtuple",
187 "Fluence by voxel & fragment",
188 "i:j:k:A:Z:fluence");
190 letFragNtuple =
new TNtuple(
"letFragNtuple",
191 "Let by voxel & fragment",
192 "i:j:k:A:Z:letT:letD");
194 theROOTNtuple =
new TNtuple(
"theROOTNtuple",
195 "Energy deposit by slice",
198 theROOTIonTuple =
new TNtuple(
"theROOTIonTuple",
199 "Generic ion information",
200 "a:z:occupancy:energy");
202 fragmentNtuple =
new TNtuple(
"fragmentNtuple",
204 "A:Z:energy:posX:posY:posZ");
206 metaData =
new TNtuple(
"metaData",
208 "events:detectorDistance:waterThickness:beamEnergy:energyError:phantomCenterDistance");
212 void HadrontherapyAnalysisManager::FillEnergyDeposit(
G4int i,
219 theROOTNtuple->Fill(i, j, k, energy);
224 void HadrontherapyAnalysisManager::BraggPeak(
G4int slice,
G4double energy)
226 histo1->SetBinContent(slice, energy);
230 void HadrontherapyAnalysisManager::SecondaryProtonEnergyDeposit(
G4int slice,
G4double energy)
232 histo2->Fill(slice, energy);
236 void HadrontherapyAnalysisManager::SecondaryNeutronEnergyDeposit(
G4int slice,
G4double energy)
238 histo3->Fill(slice, energy);
242 void HadrontherapyAnalysisManager::SecondaryAlphaEnergyDeposit(
G4int slice,
G4double energy)
244 histo4->Fill(slice, energy);
248 void HadrontherapyAnalysisManager::SecondaryGammaEnergyDeposit(
G4int slice,
G4double energy)
250 histo5->Fill(slice, energy);
254 void HadrontherapyAnalysisManager::SecondaryElectronEnergyDeposit(
G4int slice,
G4double energy)
256 histo6->Fill(slice, energy);
260 void HadrontherapyAnalysisManager::SecondaryTritonEnergyDeposit(
G4int slice,
G4double energy)
262 histo7->Fill(slice, energy);
266 void HadrontherapyAnalysisManager::SecondaryDeuteronEnergyDeposit(
G4int slice,
G4double energy)
268 histo8->Fill(slice, energy);
272 void HadrontherapyAnalysisManager::SecondaryPionEnergyDeposit(
G4int slice,
G4double energy)
274 histo9->Fill(slice, energy);
278 void HadrontherapyAnalysisManager::electronEnergyDistribution(
G4double energy)
280 histo10->Fill(energy);
284 void HadrontherapyAnalysisManager::gammaEnergyDistribution(
G4double energy)
286 histo11->Fill(energy);
290 void HadrontherapyAnalysisManager::deuteronEnergyDistribution(
G4double energy)
292 histo12->Fill(energy);
296 void HadrontherapyAnalysisManager::tritonEnergyDistribution(
G4double energy)
298 histo13->Fill(energy);
302 void HadrontherapyAnalysisManager::alphaEnergyDistribution(
G4double energy)
304 histo14->Fill(energy);
307 void HadrontherapyAnalysisManager::heliumEnergy(
G4double secondaryParticleKineticEnergy)
309 histo15->Fill(secondaryParticleKineticEnergy);
313 void HadrontherapyAnalysisManager::hydrogenEnergy(
G4double secondaryParticleKineticEnergy)
315 histo16->Fill(secondaryParticleKineticEnergy);
323 kinFragNtuple -> Fill(i, j, k, A, Z, kinEnergy);
329 void HadrontherapyAnalysisManager::FillKineticEnergyPrimaryNTuple(
G4int i,
G4int j,
G4int k,
G4double kinEnergy)
331 kineticEnergyPrimaryNtuple -> Fill(i, j, k, kinEnergy);
342 doseFragNtuple -> Fill( i, j, k, A, Z, energy );
346 fluenceFragNtuple -> Fill( i, j, k, A, Z, fluence );
353 letFragNtuple -> Fill( i, j, k, A, Z, letD/
MeV);
358 fragmentNtuple->Fill(A, Z, energy, posX, posY, posZ);
362 void HadrontherapyAnalysisManager::genericIonInformation(
G4int a,
364 G4int electronOccupancy,
367 if (theROOTIonTuple) {
368 theROOTIonTuple->Fill(a, z, electronOccupancy, energy);
373 void HadrontherapyAnalysisManager::startNewEvent()
378 void HadrontherapyAnalysisManager::setGeometryMetaData(
G4double endDetectorPosition,
G4double waterThickness,
G4double phantomCenter)
380 this->detectorDistance = endDetectorPosition;
381 this->phantomDepth = waterThickness;
382 this->phantomCenterDistance = phantomCenter;
384 void HadrontherapyAnalysisManager::setBeamMetaData(
G4double meanKineticEnergy,
G4double sigmaEnergy)
386 this->beamEnergy = meanKineticEnergy;
387 this->energyError = sigmaEnergy;
391 void HadrontherapyAnalysisManager::flush()
static HadrontherapyAnalysisManager * GetInstance()
std::vector< ExP01TrackerHit * > a
static HadrontherapyAnalysisManager * instance
double A(double temperature)
HadrontherapyAnalysisFileMessenger * fMess
G4double energy(const ThreeVector &p, const G4double m)
static constexpr double MeV
~HadrontherapyAnalysisManager()