40 #ifdef G4ANALYSIS_USE_ROOT
42 analysisFileName(
"DoseDistribution.root"),theTFile(0), histo1(0), histo2(0), histo3(0),
43 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),
45 kineticEnergyPrimaryNtuple(0),
63 #ifdef G4ANALYSIS_USE_ROOT
73 #ifdef G4ANALYSIS_USE_ROOT
81 delete fragmentNtuple;
84 delete theROOTIonTuple;
142 void HadrontherapyAnalysisManager::SetAnalysisFileName(
G4String aFileName)
144 this->analysisFileName = aFileName;
148 G4bool HadrontherapyAnalysisManager::IsTheTFile()
150 return (theTFile) ?
true:
false;
152 void HadrontherapyAnalysisManager::book()
156 theTFile =
new TFile(analysisFileName,
"RECREATE");
159 histo1 = createHistogram1D(
"braggPeak",
"slice, energy", 400, 0., 80);
160 histo2 = createHistogram1D(
"h20",
"Secondary protons - slice, energy", 400, 0., 400.);
161 histo3 = createHistogram1D(
"h30",
"Secondary neutrons - slice, energy", 400, 0., 400.);
162 histo4 = createHistogram1D(
"h40",
"Secondary alpha - slice, energy", 400, 0., 400.);
163 histo5 = createHistogram1D(
"h50",
"Secondary gamma - slice, energy", 400, 0., 400.);
164 histo6 = createHistogram1D(
"h60",
"Secondary electron - slice, energy", 400, 0., 400.);
165 histo7 = createHistogram1D(
"h70",
"Secondary triton - slice, energy", 400, 0., 400.);
166 histo8 = createHistogram1D(
"h80",
"Secondary deuteron - slice, energy", 400, 0., 400.);
167 histo9 = createHistogram1D(
"h90",
"Secondary pion - slice, energy", 400, 0., 400.);
168 histo10 = createHistogram1D(
"h100",
"Energy distribution of secondary electrons", 70, 0., 70.);
169 histo11 = createHistogram1D(
"h110",
"Energy distribution of secondary photons", 70, 0., 70.);
170 histo12 = createHistogram1D(
"h120",
"Energy distribution of secondary deuterons", 70, 0., 70.);
171 histo13 = createHistogram1D(
"h130",
"Energy distribution of secondary tritons", 70, 0., 70.);
172 histo14 = createHistogram1D(
"h140",
"Energy distribution of secondary alpha particles", 70, 0., 70.);
173 histo15 = createHistogram1D(
"heliumEnergyAfterPhantom",
"Energy distribution of secondary helium fragments after the phantom",
175 histo16 = createHistogram1D(
"hydrogenEnergyAfterPhantom",
"Energy distribution of secondary helium fragments after the phantom",
178 kinFragNtuple =
new TNtuple(
"kinFragNtuple",
179 "Kinetic energy by voxel & fragment",
180 "i:j:k:A:Z:kineticEnergy");
181 kineticEnergyPrimaryNtuple=
new TNtuple(
"kineticEnergyPrimaryNtuple",
182 "Kinetic energy by voxel of primary",
183 "i:j:k:kineticEnergy");
184 doseFragNtuple =
new TNtuple(
"doseFragNtuple",
185 "Energy deposit by voxel & fragment",
188 fluenceFragNtuple =
new TNtuple(
"fluenceFragNtuple",
189 "Fluence by voxel & fragment",
190 "i:j:k:A:Z:fluence");
192 letFragNtuple =
new TNtuple(
"letFragNtuple",
193 "Let by voxel & fragment",
194 "i:j:k:A:Z:letT:letD");
196 theROOTNtuple =
new TNtuple(
"theROOTNtuple",
197 "Energy deposit by slice",
200 theROOTIonTuple =
new TNtuple(
"theROOTIonTuple",
201 "Generic ion information",
202 "a:z:occupancy:energy");
204 fragmentNtuple =
new TNtuple(
"fragmentNtuple",
206 "A:Z:energy:posX:posY:posZ");
208 metaData =
new TNtuple(
"metaData",
210 "events:detectorDistance:waterThickness:beamEnergy:energyError:phantomCenterDistance");
214 void HadrontherapyAnalysisManager::FillEnergyDeposit(
G4int i,
221 theROOTNtuple->Fill(i, j, k, energy);
226 void HadrontherapyAnalysisManager::BraggPeak(
G4int slice,
G4double energy)
228 histo1->SetBinContent(slice, energy);
232 void HadrontherapyAnalysisManager::SecondaryProtonEnergyDeposit(
G4int slice,
G4double energy)
234 histo2->Fill(slice, energy);
238 void HadrontherapyAnalysisManager::SecondaryNeutronEnergyDeposit(
G4int slice,
G4double energy)
240 histo3->Fill(slice, energy);
244 void HadrontherapyAnalysisManager::SecondaryAlphaEnergyDeposit(
G4int slice,
G4double energy)
246 histo4->Fill(slice, energy);
250 void HadrontherapyAnalysisManager::SecondaryGammaEnergyDeposit(
G4int slice,
G4double energy)
252 histo5->Fill(slice, energy);
256 void HadrontherapyAnalysisManager::SecondaryElectronEnergyDeposit(
G4int slice,
G4double energy)
258 histo6->Fill(slice, energy);
262 void HadrontherapyAnalysisManager::SecondaryTritonEnergyDeposit(
G4int slice,
G4double energy)
264 histo7->Fill(slice, energy);
268 void HadrontherapyAnalysisManager::SecondaryDeuteronEnergyDeposit(
G4int slice,
G4double energy)
270 histo8->Fill(slice, energy);
274 void HadrontherapyAnalysisManager::SecondaryPionEnergyDeposit(
G4int slice,
G4double energy)
276 histo9->Fill(slice, energy);
280 void HadrontherapyAnalysisManager::electronEnergyDistribution(
G4double energy)
282 histo10->Fill(energy);
286 void HadrontherapyAnalysisManager::gammaEnergyDistribution(
G4double energy)
288 histo11->Fill(energy);
292 void HadrontherapyAnalysisManager::deuteronEnergyDistribution(
G4double energy)
294 histo12->Fill(energy);
298 void HadrontherapyAnalysisManager::tritonEnergyDistribution(
G4double energy)
300 histo13->Fill(energy);
304 void HadrontherapyAnalysisManager::alphaEnergyDistribution(
G4double energy)
306 histo14->Fill(energy);
309 void HadrontherapyAnalysisManager::heliumEnergy(
G4double secondaryParticleKineticEnergy)
311 histo15->Fill(secondaryParticleKineticEnergy);
315 void HadrontherapyAnalysisManager::hydrogenEnergy(
G4double secondaryParticleKineticEnergy)
317 histo16->Fill(secondaryParticleKineticEnergy);
325 kinFragNtuple -> Fill(i, j, k, A, Z, kinEnergy);
331 void HadrontherapyAnalysisManager::FillKineticEnergyPrimaryNTuple(
G4int i,
G4int j,
G4int k,
G4double kinEnergy)
333 kineticEnergyPrimaryNtuple -> Fill(i, j, k, kinEnergy);
344 doseFragNtuple -> Fill( i, j, k, A, Z, energy );
348 fluenceFragNtuple -> Fill( i, j, k, A, Z, fluence );
355 letFragNtuple -> Fill( i, j, k, A, Z, letD/
MeV);
360 fragmentNtuple->Fill(A, Z, energy, posX, posY, posZ);
364 void HadrontherapyAnalysisManager::genericIonInformation(
G4int a,
366 G4int electronOccupancy,
369 if (theROOTIonTuple) {
370 theROOTIonTuple->Fill(a, z, electronOccupancy, energy);
375 void HadrontherapyAnalysisManager::startNewEvent()
380 void HadrontherapyAnalysisManager::setGeometryMetaData(
G4double endDetectorPosition,
G4double waterThickness,
G4double phantomCenter)
382 this->detectorDistance = endDetectorPosition;
383 this->phantomDepth = waterThickness;
384 this->phantomCenterDistance = phantomCenter;
386 void HadrontherapyAnalysisManager::setBeamMetaData(
G4double meanKineticEnergy,
G4double sigmaEnergy)
388 this->beamEnergy = meanKineticEnergy;
389 this->energyError = sigmaEnergy;
393 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()