44 #ifdef G4ANALYSIS_USE_ROOT
46 analysisFileName(
"DoseDistribution.root"),theTFile(0), histo1(0), histo2(0), histo3(0),
47 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),
49 kineticEnergyPrimaryNtuple(0),
67 #ifdef G4ANALYSIS_USE_ROOT
77 #ifdef G4ANALYSIS_USE_ROOT
85 delete fragmentNtuple;
88 delete theROOTIonTuple;
146 void HadrontherapyAnalysisManager::SetAnalysisFileName(
G4String aFileName)
148 this->analysisFileName = aFileName;
152 G4bool HadrontherapyAnalysisManager::IsTheTFile()
154 return (theTFile) ?
true:
false;
156 void HadrontherapyAnalysisManager::book()
160 theTFile =
new TFile(analysisFileName,
"RECREATE");
163 histo1 = createHistogram1D(
"braggPeak",
"slice, energy", 400, 0., 80);
164 histo2 = createHistogram1D(
"h20",
"Secondary protons - slice, energy", 400, 0., 400.);
165 histo3 = createHistogram1D(
"h30",
"Secondary neutrons - slice, energy", 400, 0., 400.);
166 histo4 = createHistogram1D(
"h40",
"Secondary alpha - slice, energy", 400, 0., 400.);
167 histo5 = createHistogram1D(
"h50",
"Secondary gamma - slice, energy", 400, 0., 400.);
168 histo6 = createHistogram1D(
"h60",
"Secondary electron - slice, energy", 400, 0., 400.);
169 histo7 = createHistogram1D(
"h70",
"Secondary triton - slice, energy", 400, 0., 400.);
170 histo8 = createHistogram1D(
"h80",
"Secondary deuteron - slice, energy", 400, 0., 400.);
171 histo9 = createHistogram1D(
"h90",
"Secondary pion - slice, energy", 400, 0., 400.);
172 histo10 = createHistogram1D(
"h100",
"Energy distribution of secondary electrons", 70, 0., 70.);
173 histo11 = createHistogram1D(
"h110",
"Energy distribution of secondary photons", 70, 0., 70.);
174 histo12 = createHistogram1D(
"h120",
"Energy distribution of secondary deuterons", 70, 0., 70.);
175 histo13 = createHistogram1D(
"h130",
"Energy distribution of secondary tritons", 70, 0., 70.);
176 histo14 = createHistogram1D(
"h140",
"Energy distribution of secondary alpha particles", 70, 0., 70.);
177 histo15 = createHistogram1D(
"heliumEnergyAfterPhantom",
"Energy distribution of secondary helium fragments after the phantom",
179 histo16 = createHistogram1D(
"hydrogenEnergyAfterPhantom",
"Energy distribution of secondary helium fragments after the phantom",
182 kinFragNtuple =
new TNtuple(
"kinFragNtuple",
183 "Kinetic energy by voxel & fragment",
184 "i:j:k:A:Z:kineticEnergy");
185 kineticEnergyPrimaryNtuple=
new TNtuple(
"kineticEnergyPrimaryNtuple",
186 "Kinetic energy by voxel of primary",
187 "i:j:k:kineticEnergy");
188 doseFragNtuple =
new TNtuple(
"doseFragNtuple",
189 "Energy deposit by voxel & fragment",
192 fluenceFragNtuple =
new TNtuple(
"fluenceFragNtuple",
193 "Fluence by voxel & fragment",
194 "i:j:k:A:Z:fluence");
196 letFragNtuple =
new TNtuple(
"letFragNtuple",
197 "Let by voxel & fragment",
198 "i:j:k:A:Z:letT:letD");
200 theROOTNtuple =
new TNtuple(
"theROOTNtuple",
201 "Energy deposit by slice",
204 theROOTIonTuple =
new TNtuple(
"theROOTIonTuple",
205 "Generic ion information",
206 "a:z:occupancy:energy");
208 fragmentNtuple =
new TNtuple(
"fragmentNtuple",
210 "A:Z:energy:posX:posY:posZ");
212 metaData =
new TNtuple(
"metaData",
214 "events:detectorDistance:waterThickness:beamEnergy:energyError:phantomCenterDistance");
218 void HadrontherapyAnalysisManager::FillEnergyDeposit(
G4int i,
225 theROOTNtuple->Fill(i, j, k, energy);
230 void HadrontherapyAnalysisManager::BraggPeak(
G4int slice,
G4double energy)
232 histo1->SetBinContent(slice, energy);
236 void HadrontherapyAnalysisManager::SecondaryProtonEnergyDeposit(
G4int slice,
G4double energy)
238 histo2->Fill(slice, energy);
242 void HadrontherapyAnalysisManager::SecondaryNeutronEnergyDeposit(
G4int slice,
G4double energy)
244 histo3->Fill(slice, energy);
248 void HadrontherapyAnalysisManager::SecondaryAlphaEnergyDeposit(
G4int slice,
G4double energy)
250 histo4->Fill(slice, energy);
254 void HadrontherapyAnalysisManager::SecondaryGammaEnergyDeposit(
G4int slice,
G4double energy)
256 histo5->Fill(slice, energy);
260 void HadrontherapyAnalysisManager::SecondaryElectronEnergyDeposit(
G4int slice,
G4double energy)
262 histo6->Fill(slice, energy);
266 void HadrontherapyAnalysisManager::SecondaryTritonEnergyDeposit(
G4int slice,
G4double energy)
268 histo7->Fill(slice, energy);
272 void HadrontherapyAnalysisManager::SecondaryDeuteronEnergyDeposit(
G4int slice,
G4double energy)
274 histo8->Fill(slice, energy);
278 void HadrontherapyAnalysisManager::SecondaryPionEnergyDeposit(
G4int slice,
G4double energy)
280 histo9->Fill(slice, energy);
284 void HadrontherapyAnalysisManager::electronEnergyDistribution(
G4double energy)
286 histo10->Fill(energy);
290 void HadrontherapyAnalysisManager::gammaEnergyDistribution(
G4double energy)
292 histo11->Fill(energy);
296 void HadrontherapyAnalysisManager::deuteronEnergyDistribution(
G4double energy)
298 histo12->Fill(energy);
302 void HadrontherapyAnalysisManager::tritonEnergyDistribution(
G4double energy)
304 histo13->Fill(energy);
308 void HadrontherapyAnalysisManager::alphaEnergyDistribution(
G4double energy)
310 histo14->Fill(energy);
313 void HadrontherapyAnalysisManager::heliumEnergy(
G4double secondaryParticleKineticEnergy)
315 histo15->Fill(secondaryParticleKineticEnergy);
319 void HadrontherapyAnalysisManager::hydrogenEnergy(
G4double secondaryParticleKineticEnergy)
321 histo16->Fill(secondaryParticleKineticEnergy);
329 kinFragNtuple -> Fill(i, j, k, A, Z, kinEnergy);
335 void HadrontherapyAnalysisManager::FillKineticEnergyPrimaryNTuple(
G4int i,
G4int j,
G4int k,
G4double kinEnergy)
337 kineticEnergyPrimaryNtuple -> Fill(i, j, k, kinEnergy);
348 doseFragNtuple -> Fill( i, j, k, A, Z, energy );
352 fluenceFragNtuple -> Fill( i, j, k, A, Z, fluence );
359 letFragNtuple -> Fill( i, j, k, A, Z, letD/
MeV);
364 fragmentNtuple->Fill(A, Z, energy, posX, posY, posZ);
368 void HadrontherapyAnalysisManager::genericIonInformation(
G4int a,
370 G4int electronOccupancy,
373 if (theROOTIonTuple) {
374 theROOTIonTuple->Fill(a, z, electronOccupancy, energy);
379 void HadrontherapyAnalysisManager::startNewEvent()
384 void HadrontherapyAnalysisManager::setGeometryMetaData(
G4double endDetectorPosition,
G4double waterThickness,
G4double phantomCenter)
386 this->detectorDistance = endDetectorPosition;
387 this->phantomDepth = waterThickness;
388 this->phantomCenterDistance = phantomCenter;
390 void HadrontherapyAnalysisManager::setBeamMetaData(
G4double meanKineticEnergy,
G4double sigmaEnergy)
392 this->beamEnergy = meanKineticEnergy;
393 this->energyError = sigmaEnergy;
397 void HadrontherapyAnalysisManager::flush()
static HadrontherapyAnalysisManager * GetInstance()
Get the pointer to the analysis manager.
static HadrontherapyAnalysisManager * instance
A messenger object of this class is created by the AnalysisManager.
HadrontherapyAnalysisFileMessenger * fMess
static const G4double A[nN]
G4double energy(const ThreeVector &p, const G4double m)
HadrontherapyAnalysisManager()
Analysis manager is a singleton object (there is only one instance).
A class for connecting the simulation to an analysis package.
~HadrontherapyAnalysisManager()