43 HadrontherapyAnalysisManager::HadrontherapyAnalysisManager()
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;
145 void HadrontherapyAnalysisManager::SetAnalysisFileName(
G4String aFileName)
147 this->analysisFileName = aFileName;
151 G4bool HadrontherapyAnalysisManager::IsTheTFile()
153 return (theTFile) ?
true:
false;
155 void HadrontherapyAnalysisManager::book()
159 theTFile =
new TFile(analysisFileName,
"RECREATE");
162 histo1 = createHistogram1D(
"braggPeak",
"slice, energy", 400, 0., 80);
163 histo2 = createHistogram1D(
"h20",
"Secondary protons - slice, energy", 400, 0., 400.);
164 histo3 = createHistogram1D(
"h30",
"Secondary neutrons - slice, energy", 400, 0., 400.);
165 histo4 = createHistogram1D(
"h40",
"Secondary alpha - slice, energy", 400, 0., 400.);
166 histo5 = createHistogram1D(
"h50",
"Secondary gamma - slice, energy", 400, 0., 400.);
167 histo6 = createHistogram1D(
"h60",
"Secondary electron - slice, energy", 400, 0., 400.);
168 histo7 = createHistogram1D(
"h70",
"Secondary triton - slice, energy", 400, 0., 400.);
169 histo8 = createHistogram1D(
"h80",
"Secondary deuteron - slice, energy", 400, 0., 400.);
170 histo9 = createHistogram1D(
"h90",
"Secondary pion - slice, energy", 400, 0., 400.);
171 histo10 = createHistogram1D(
"h100",
"Energy distribution of secondary electrons", 70, 0., 70.);
172 histo11 = createHistogram1D(
"h110",
"Energy distribution of secondary photons", 70, 0., 70.);
173 histo12 = createHistogram1D(
"h120",
"Energy distribution of secondary deuterons", 70, 0., 70.);
174 histo13 = createHistogram1D(
"h130",
"Energy distribution of secondary tritons", 70, 0., 70.);
175 histo14 = createHistogram1D(
"h140",
"Energy distribution of secondary alpha particles", 70, 0., 70.);
176 histo15 = createHistogram1D(
"heliumEnergyAfterPhantom",
"Energy distribution of secondary helium fragments after the phantom",
178 histo16 = createHistogram1D(
"hydrogenEnergyAfterPhantom",
"Energy distribution of secondary helium fragments after the phantom",
181 kinFragNtuple =
new TNtuple(
"kinFragNtuple",
182 "Kinetic energy by voxel & fragment",
183 "i:j:k:A:Z:kineticEnergy");
184 kineticEnergyPrimaryNtuple=
new TNtuple(
"kineticEnergyPrimaryNtuple",
185 "Kinetic energy by voxel of primary",
186 "i:j:k:kineticEnergy");
187 doseFragNtuple =
new TNtuple(
"doseFragNtuple",
188 "Energy deposit by voxel & fragment",
191 fluenceFragNtuple =
new TNtuple(
"fluenceFragNtuple",
192 "Fluence by voxel & fragment",
193 "i:j:k:A:Z:fluence");
195 letFragNtuple =
new TNtuple(
"letFragNtuple",
196 "Let by voxel & fragment",
197 "i:j:k:A:Z:letT:letD");
199 theROOTNtuple =
new TNtuple(
"theROOTNtuple",
200 "Energy deposit by slice",
203 theROOTIonTuple =
new TNtuple(
"theROOTIonTuple",
204 "Generic ion information",
205 "a:z:occupancy:energy");
207 fragmentNtuple =
new TNtuple(
"fragmentNtuple",
209 "A:Z:energy:posX:posY:posZ");
211 metaData =
new TNtuple(
"metaData",
213 "events:detectorDistance:waterThickness:beamEnergy:energyError:phantomCenterDistance");
217 void HadrontherapyAnalysisManager::FillEnergyDeposit(
G4int i,
224 theROOTNtuple->Fill(i, j, k, energy);
229 void HadrontherapyAnalysisManager::BraggPeak(
G4int slice,
G4double energy)
231 histo1->SetBinContent(slice, energy);
235 void HadrontherapyAnalysisManager::SecondaryProtonEnergyDeposit(
G4int slice,
G4double energy)
237 histo2->Fill(slice, energy);
241 void HadrontherapyAnalysisManager::SecondaryNeutronEnergyDeposit(
G4int slice,
G4double energy)
243 histo3->Fill(slice, energy);
247 void HadrontherapyAnalysisManager::SecondaryAlphaEnergyDeposit(
G4int slice,
G4double energy)
249 histo4->Fill(slice, energy);
253 void HadrontherapyAnalysisManager::SecondaryGammaEnergyDeposit(
G4int slice,
G4double energy)
255 histo5->Fill(slice, energy);
259 void HadrontherapyAnalysisManager::SecondaryElectronEnergyDeposit(
G4int slice,
G4double energy)
261 histo6->Fill(slice, energy);
265 void HadrontherapyAnalysisManager::SecondaryTritonEnergyDeposit(
G4int slice,
G4double energy)
267 histo7->Fill(slice, energy);
271 void HadrontherapyAnalysisManager::SecondaryDeuteronEnergyDeposit(
G4int slice,
G4double energy)
273 histo8->Fill(slice, energy);
277 void HadrontherapyAnalysisManager::SecondaryPionEnergyDeposit(
G4int slice,
G4double energy)
279 histo9->Fill(slice, energy);
283 void HadrontherapyAnalysisManager::electronEnergyDistribution(
G4double energy)
285 histo10->Fill(energy);
289 void HadrontherapyAnalysisManager::gammaEnergyDistribution(
G4double energy)
291 histo11->Fill(energy);
295 void HadrontherapyAnalysisManager::deuteronEnergyDistribution(
G4double energy)
297 histo12->Fill(energy);
301 void HadrontherapyAnalysisManager::tritonEnergyDistribution(
G4double energy)
303 histo13->Fill(energy);
307 void HadrontherapyAnalysisManager::alphaEnergyDistribution(
G4double energy)
309 histo14->Fill(energy);
312 void HadrontherapyAnalysisManager::heliumEnergy(
G4double secondaryParticleKineticEnergy)
314 histo15->Fill(secondaryParticleKineticEnergy);
318 void HadrontherapyAnalysisManager::hydrogenEnergy(
G4double secondaryParticleKineticEnergy)
320 histo16->Fill(secondaryParticleKineticEnergy);
328 kinFragNtuple ->
Fill(i, j, k, A, Z, kinEnergy);
334 void HadrontherapyAnalysisManager::FillKineticEnergyPrimaryNTuple(
G4int i,
G4int j,
G4int k,
G4double kinEnergy)
336 kineticEnergyPrimaryNtuple ->
Fill(i, j, k, kinEnergy);
347 doseFragNtuple ->
Fill( i, j, k, A, Z, energy );
351 fluenceFragNtuple ->
Fill( i, j, k, A, Z, fluence );
358 letFragNtuple ->
Fill( i, j, k, A, Z, letT, letD);
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()