Geant4  10.02.p02
HadrontherapyAnalysisManager.hh
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 // Hadrontherapy advanced example for Geant4
27 // See more at: https://twiki.cern.ch/twiki/bin/view/Geant4/AdvancedExamplesHadrontherapy
28 
29 #ifndef HADRONTHERAPYANALYSISMANAGER_HH
30 #define HADRONTHERAPYANALYSISMANAGER_HH 1
31 
32 #include "globals.hh"
33 
34 
35 #ifdef G4ANALYSIS_USE_ROOT
36 #include "TROOT.h"
37 #include "TFile.h"
38 #include "TNtuple.h"
39 #include "TH1F.h"
40 #endif
41 
45 
50 {
51 private:
59 
60 public:
62 
67 
68 #ifdef G4ANALYSIS_USE_ROOT
69 
72  void Clear();
76  G4bool IsTheTFile();
80  void book();
84  void SetAnalysisFileName(G4String);
85 
89  void FillEnergyDeposit(G4int voxelXId, G4int voxelYId, G4int voxelZId,
90  G4double energyDeposit);
91 
92  void BraggPeak(G4int, G4double);
93 
94  void SecondaryProtonEnergyDeposit(G4int slice, G4double energy);
96 
97  void SecondaryNeutronEnergyDeposit(G4int slice, G4double energy);
99 
100  void SecondaryAlphaEnergyDeposit(G4int slice, G4double energy);
102 
103  void SecondaryGammaEnergyDeposit(G4int slice, G4double energy);
105 
106  void SecondaryElectronEnergyDeposit(G4int slice, G4double energy);
108 
109  void SecondaryTritonEnergyDeposit(G4int slice, G4double energy);
111 
112  void SecondaryDeuteronEnergyDeposit(G4int slice, G4double energy);
114 
115  void SecondaryPionEnergyDeposit(G4int slice, G4double energy);
117 
118  void electronEnergyDistribution(G4double secondaryParticleKineticEnergy);
120 
121  void gammaEnergyDistribution(G4double secondaryParticleKineticEnergy);
123 
124  void deuteronEnergyDistribution(G4double secondaryParticleKineticEnergy);
126 
127  void tritonEnergyDistribution(G4double secondaryParticleKineticEnergy);
129 
130  void alphaEnergyDistribution(G4double secondaryParticleKineticEnergy);
132 
133  void heliumEnergy(G4double secondaryParticleKineticEnergy);
135 
136  void hydrogenEnergy(G4double secondaryParticleKineticEnergy);
138 
139  //Kinetic energy by voxel, mass number A and atomic number Z.
140  void FillKineticFragmentTuple(G4int i, G4int j, G4int k, G4int A, G4double Z, G4double kinEnergy);
141 
142  //Kinetic energy by voxel, mass number A and atomic number Z of only primary particles
143  void FillKineticEnergyPrimaryNTuple(G4int i, G4int j, G4int k, G4double kinEnergy);
144 
146  void FillVoxelFragmentTuple(G4int i, G4int j, G4int k, G4int A, G4double Z, G4double energy, G4double fluence);
147 
148  void FillFragmentTuple(G4int A, G4double Z, G4double energy, G4double posX, G4double posY, G4double posZ);
150 
151  // void FillLetFragmentTuple(G4int i, G4int j, G4int k, G4int A, G4double Z, G4double letT, G4double letD);
153  void FillLetFragmentTuple(G4int i, G4int j, G4int k, G4int A, G4double Z, G4double letD);
154  void genericIonInformation(G4int, G4double, G4int, G4double);
155 
156  void ThintargetBeamDisp(G4double,G4double);
157 
158  void startNewEvent();
160 
161  void setGeometryMetaData(G4double, G4double, G4double);
163 
164  void setBeamMetaData(G4double, G4double);
166 
167  void flush();
169 private:
170  TH1F *createHistogram1D(const TString name, const TString title, int bins, double xmin, double xmax) {
171  TH1F *histo = new TH1F(name, title, bins, xmin, xmax);
172  histo->SetLineWidth(2);
173  return histo;
174  }
175 
176 private:
177 #endif
180 #ifdef G4ANALYSIS_USE_ROOT
181  G4String analysisFileName;
182  TFile *theTFile;
183  TH1F *histo1;
184  TH1F *histo2;
185  TH1F *histo3;
186  TH1F *histo4;
187  TH1F *histo5;
188  TH1F *histo6;
189  TH1F *histo7;
190  TH1F *histo8;
191  TH1F *histo9;
192  TH1F *histo10;
193  TH1F *histo11;
194  TH1F *histo12;
195  TH1F *histo13;
196  TH1F *histo14;
197  TH1F *histo15;
198  TH1F *histo16;
199 
200  TNtuple *kinFragNtuple;
201  TNtuple *kineticEnergyPrimaryNtuple;
202 
203  // ntuple containing the fluence of all the particle in any voxel
204  TNtuple *doseFragNtuple;
205 
206  // ntuple containing the fluence of all the particle in any voxel
207  TNtuple *fluenceFragNtuple;
208 
209  // ntuple containing the fluence of all the particle in any voxel
210  TNtuple *letFragNtuple;
211 
212  TNtuple *theROOTNtuple;
213  TNtuple *theROOTIonTuple;
214  TNtuple *fragmentNtuple; // fragments
215  TNtuple *metaData;
216  G4long eventCounter; // Simulation metadata
217  G4double detectorDistance;
218  G4double phantomDepth;
219  G4double beamEnergy;
220  G4double energyError;
221  G4double phantomCenterDistance;
222 #endif
223 };
224 #endif
225 
226 
227 
static HadrontherapyAnalysisManager * GetInstance()
Get the pointer to the analysis manager.
G4String name
Definition: TRTMaterials.hh:40
void Clear(Node *)
long G4long
Definition: G4Types.hh:80
static HadrontherapyAnalysisManager * instance
A messenger object of this class is created by the AnalysisManager.
int G4int
Definition: G4Types.hh:78
double A(double temperature)
bool G4bool
Definition: G4Types.hh:79
HadrontherapyAnalysisFileMessenger * fMess
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.
double G4double
Definition: G4Types.hh:76