Geant4  10.01.p03
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 // This is the *BASIC* version of Hadrontherapy, a Geant4-based application
27 // See more at: http://g4advancedexamples.lngs.infn.it/Examples/hadrontherapy
28 //
29 // Visit the Hadrontherapy web site (http://www.lns.infn.it/link/Hadrontherapy) to request
30 // the *COMPLETE* version of this program, together with its documentation;
31 // Hadrontherapy (both basic and full version) are supported by the Italian INFN
32 // Institute in the framework of the MC-INFN Group
33 //
34 
35 #ifndef HADRONTHERAPYANALYSISMANAGER_HH
36 #define HADRONTHERAPYANALYSISMANAGER_HH 1
37 
38 #include "globals.hh"
39 
40 
41 #ifdef G4ANALYSIS_USE_ROOT
42 #include "TROOT.h"
43 #include "TFile.h"
44 #include "TNtuple.h"
45 #include "TH1F.h"
46 #endif
47 
51 
56 {
57 private:
65 
66 public:
68 
73 
74 #ifdef G4ANALYSIS_USE_ROOT
75 
78  void Clear();
82  G4bool IsTheTFile();
86  void book();
90  void SetAnalysisFileName(G4String);
91 
95  void FillEnergyDeposit(G4int voxelXId, G4int voxelYId, G4int voxelZId,
96  G4double energyDeposit);
97 
98  void BraggPeak(G4int, G4double);
99 
100  void SecondaryProtonEnergyDeposit(G4int slice, G4double energy);
102 
103  void SecondaryNeutronEnergyDeposit(G4int slice, G4double energy);
105 
106  void SecondaryAlphaEnergyDeposit(G4int slice, G4double energy);
108 
109  void SecondaryGammaEnergyDeposit(G4int slice, G4double energy);
111 
112  void SecondaryElectronEnergyDeposit(G4int slice, G4double energy);
114 
115  void SecondaryTritonEnergyDeposit(G4int slice, G4double energy);
117 
118  void SecondaryDeuteronEnergyDeposit(G4int slice, G4double energy);
120 
121  void SecondaryPionEnergyDeposit(G4int slice, G4double energy);
123 
124  void electronEnergyDistribution(G4double secondaryParticleKineticEnergy);
126 
127  void gammaEnergyDistribution(G4double secondaryParticleKineticEnergy);
129 
130  void deuteronEnergyDistribution(G4double secondaryParticleKineticEnergy);
132 
133  void tritonEnergyDistribution(G4double secondaryParticleKineticEnergy);
135 
136  void alphaEnergyDistribution(G4double secondaryParticleKineticEnergy);
138 
139  void heliumEnergy(G4double secondaryParticleKineticEnergy);
141 
142  void hydrogenEnergy(G4double secondaryParticleKineticEnergy);
144 
145  //Kinetic energy by voxel, mass number A and atomic number Z.
146  void FillKineticFragmentTuple(G4int i, G4int j, G4int k, G4int A, G4double Z, G4double kinEnergy);
147 
148  //Kinetic energy by voxel, mass number A and atomic number Z of only primary particles
149  void FillKineticEnergyPrimaryNTuple(G4int i, G4int j, G4int k, G4double kinEnergy);
150 
152  void FillVoxelFragmentTuple(G4int i, G4int j, G4int k, G4int A, G4double Z, G4double energy, G4double fluence);
153 
154  void FillFragmentTuple(G4int A, G4double Z, G4double energy, G4double posX, G4double posY, G4double posZ);
156 
157  // void FillLetFragmentTuple(G4int i, G4int j, G4int k, G4int A, G4double Z, G4double letT, G4double letD);
159  void FillLetFragmentTuple(G4int i, G4int j, G4int k, G4int A, G4double Z, G4double letD);
160  void genericIonInformation(G4int, G4double, G4int, G4double);
161 
162  void ThintargetBeamDisp(G4double,G4double);
163 
164  void startNewEvent();
166 
167  void setGeometryMetaData(G4double, G4double, G4double);
169 
170  void setBeamMetaData(G4double, G4double);
172 
173  void flush();
175 private:
176  TH1F *createHistogram1D(const TString name, const TString title, int bins, double xmin, double xmax) {
177  TH1F *histo = new TH1F(name, title, bins, xmin, xmax);
178  histo->SetLineWidth(2);
179  return histo;
180  }
181 
182 private:
183 #endif
186 #ifdef G4ANALYSIS_USE_ROOT
187  G4String analysisFileName;
188  TFile *theTFile;
189  TH1F *histo1;
190  TH1F *histo2;
191  TH1F *histo3;
192  TH1F *histo4;
193  TH1F *histo5;
194  TH1F *histo6;
195  TH1F *histo7;
196  TH1F *histo8;
197  TH1F *histo9;
198  TH1F *histo10;
199  TH1F *histo11;
200  TH1F *histo12;
201  TH1F *histo13;
202  TH1F *histo14;
203  TH1F *histo15;
204  TH1F *histo16;
205 
206  TNtuple *kinFragNtuple;
207  TNtuple *kineticEnergyPrimaryNtuple;
208 
209  // ntuple containing the fluence of all the particle in any voxel
210  TNtuple *doseFragNtuple;
211 
212  // ntuple containing the fluence of all the particle in any voxel
213  TNtuple *fluenceFragNtuple;
214 
215  // ntuple containing the fluence of all the particle in any voxel
216  TNtuple *letFragNtuple;
217 
218  TNtuple *theROOTNtuple;
219  TNtuple *theROOTIonTuple;
220  TNtuple *fragmentNtuple; // fragments
221  TNtuple *metaData;
222  G4long eventCounter; // Simulation metadata
223  G4double detectorDistance;
224  G4double phantomDepth;
225  G4double beamEnergy;
226  G4double energyError;
227  G4double phantomCenterDistance;
228 #endif
229 };
230 #endif
231 
232 
233 
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
bool G4bool
Definition: G4Types.hh:79
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.
double G4double
Definition: G4Types.hh:76