Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
IORTAnalysisManager.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 IORT, a Geant4-based application
27 //
28 // Main Authors: G.Russo(a,b), C.Casarino*(c), G.C. Candiano(c), G.A.P. Cirrone(d), F.Romano(d)
29 // Contributor Authors: S.Guatelli(e)
30 // Past Authors: G.Arnetta(c), S.E.Mazzaglia(d)
31 //
32 // (a) Fondazione Istituto San Raffaele G.Giglio, Cefalù, Italy
33 // (b) IBFM-CNR , Segrate (Milano), Italy
34 // (c) LATO (Laboratorio di Tecnologie Oncologiche), Cefalù, Italy
35 // (d) Laboratori Nazionali del Sud of the INFN, Catania, Italy
36 // (e) University of Wallongong, Australia
37 //
38 // *Corresponding author, email to carlo.casarino@polooncologicocefalu.it
39 //////////////////////////////////////////////////////////////////////////////////////////////
40 
41 #ifndef HADRONTHERAPYANALYSISMANAGER_HH
42 #define HADRONTHERAPYANALYSISMANAGER_HH 1
43 
44 #include "globals.hh"
45 
46 
47 #ifdef G4ANALYSIS_USE_ROOT ///< If analysis is done directly with ROOT
48 #include "TROOT.h"
49 #include "TFile.h"
50 #include "TNtuple.h"
51 #include "TH1F.h"
52 #endif
53 /**
54  * Messenger class for analysis-settings for HadronTherapyAnalysisManager
55  */
57 
58 /**
59  * A class for connecting the simulation to an analysis package.
60  */
62 {
63 private:
64  /**
65  * Analysis manager is a singleton object (there is only one instance).
66  * The pointer to this object is available through the use of the method GetInstance();
67  *
68  * @see GetInstance
69  */
71 
72 public:
74 
75  /**
76  * Get the pointer to the analysis manager.
77  */
79 
80 #ifdef G4ANALYSIS_USE_ROOT
81  /**
82  * Clear analysis manager heap.
83  */
84  void Clear();
85  /**
86  * Check if TFile is there!
87  */
88  G4bool IsTheTFile();
89  /**
90  * Book the histograms and ntuples in an AIDA or ROOT file.
91  */
92  void book();
93  /**
94  * Set name for the analysis file .root (used by macro)
95  */
96  void SetAnalysisFileName(G4String);
97 
98  /**
99  * Fill the ntuple with the energy deposit in the phantom
100  */
101  void FillEnergyDeposit(G4int voxelXId, G4int voxelYId, G4int voxelZId,
102  G4double energyDeposit);
103 
104  void BraggPeak(G4int, G4double); ///< Fill 1D histogram with the Bragg peak in the phantom
105 
106  void SecondaryProtonEnergyDeposit(G4int slice, G4double energy);
107  ///< Fill 1D histogram with the energy deposit of secondary protons
108 
109  void SecondaryNeutronEnergyDeposit(G4int slice, G4double energy);
110  ///< Fill 1D histogram with the energy deposit of secondary neutrons
111 
112  void SecondaryAlphaEnergyDeposit(G4int slice, G4double energy);
113  ///< Fill 1D histogram with the energy deposit of secondary alpha particles
114 
115  void SecondaryGammaEnergyDeposit(G4int slice, G4double energy);
116  ///< Fill 1D histogram with the energy deposit of secondary gamma
117 
118  void SecondaryElectronEnergyDeposit(G4int slice, G4double energy);
119  ///< Fill 1D histogram with the energy deposit of secondary electrons
120 
121  void SecondaryTritonEnergyDeposit(G4int slice, G4double energy);
122  ///< Fill 1D histogram with the energy deposit of secondary tritons
123 
124  void SecondaryDeuteronEnergyDeposit(G4int slice, G4double energy);
125  ///< Fill 1D histogram with the energy deposit of secondary deuterons
126 
127  void SecondaryPionEnergyDeposit(G4int slice, G4double energy);
128  ///< Fill 1D histogram with the energy deposit of secondary pions
129 
130  void electronEnergyDistribution(G4double secondaryParticleKineticEnergy);
131  ///< Energy distribution of secondary electrons originated in the phantom
132 
133  void gammaEnergyDistribution(G4double secondaryParticleKineticEnergy);
134  ///< Energy distribution of secondary gamma originated in the phantom
135 
136  void deuteronEnergyDistribution(G4double secondaryParticleKineticEnergy);
137  ///< Energy distribution of secondary deuterons originated in the phantom
138 
139  void tritonEnergyDistribution(G4double secondaryParticleKineticEnergy);
140  ///< Energy distribution of secondary tritons originated in the phantom
141 
142  void alphaEnergyDistribution(G4double secondaryParticleKineticEnergy);
143  ///< Energy distribution of secondary alpha originated in the phantom
144 
145  void heliumEnergy(G4double secondaryParticleKineticEnergy);
146  ///< Energy distribution of the helium (He3 and alpha) particles after the phantom
147 
148  void hydrogenEnergy(G4double secondaryParticleKineticEnergy);
149  ///< Energy distribution of the hydrogen (proton, d, t) particles after the phantom
150 
151  //Kinetic energy by voxel, mass number A and atomic number Z.
152  void FillKineticFragmentTuple(G4int i, G4int j, G4int k, G4int A, G4double Z, G4double kinEnergy);
153 
154  //Kinetic energy by voxel, mass number A and atomic number Z of only primary particles
155  void FillKineticEnergyPrimaryNTuple(G4int i, G4int j, G4int k, G4double kinEnergy);
156 
157  ///< Energy by voxel, mass number A and atomic number Z.
158  void FillVoxelFragmentTuple(G4int i, G4int j, G4int k, G4int A, G4double Z, G4double energy, G4double fluence);
159 
160  void FillFragmentTuple(G4int A, G4double Z, G4double energy, G4double posX, G4double posY, G4double posZ);
161  ///< Energy ntuple
162 
163  void FillLetFragmentTuple(G4int i, G4int j, G4int k, G4int A, G4double Z, G4double letT, G4double letD);
164  ///< let ntuple
165 
166  void genericIonInformation(G4int, G4double, G4int, G4double);
167 
168  void ThintargetBeamDisp(G4double,G4double);
169 
170  void startNewEvent();
171  ///< Tell the analysis manager that a new event is starting
172 
173  void setGeometryMetaData(G4double, G4double, G4double);
174  ///< from the detector construction information about the geometry can be written as metadata
175 
176  void setBeamMetaData(G4double, G4double);
177  ///< metadata about the beam can be written this way
178 
179  void flush();
180  ///< Close the .hbk file with the histograms and the ntuples
181 private:
182  TH1F *createHistogram1D(const TString name, const TString title, int bins, double xmin, double xmax) {
183  TH1F *histo = new TH1F(name, title, bins, xmin, xmax);
184  histo->SetLineWidth(2);
185  return histo;
186  }
187 
188 private:
189 #endif
192 #ifdef G4ANALYSIS_USE_ROOT
193  G4String analysisFileName;
194  TFile *theTFile;
195  TH1F *histo1;
196  TH1F *histo2;
197  TH1F *histo3;
198  TH1F *histo4;
199  TH1F *histo5;
200  TH1F *histo6;
201  TH1F *histo7;
202  TH1F *histo8;
203  TH1F *histo9;
204  TH1F *histo10;
205  TH1F *histo11;
206  TH1F *histo12;
207  TH1F *histo13;
208  TH1F *histo14;
209  TH1F *histo15;
210  TH1F *histo16;
211 
212  TNtuple *kinFragNtuple;
213  TNtuple *kineticEnergyPrimaryNtuple;
214 
215  // ntuple containing the fluence of all the particle in any voxel
216  TNtuple *doseFragNtuple;
217 
218  // ntuple containing the fluence of all the particle in any voxel
219  TNtuple *fluenceFragNtuple;
220 
221  // ntuple containing the fluence of all the particle in any voxel
222  TNtuple *letFragNtuple;
223 
224  TNtuple *theROOTNtuple;
225  TNtuple *theROOTIonTuple;
226  TNtuple *fragmentNtuple; // fragments
227  TNtuple *metaData;
228  G4long eventCounter; // Simulation metadata
229  G4double detectorDistance;
230  G4double phantomDepth;
231  G4double beamEnergy;
232  G4double energyError;
233  G4double phantomCenterDistance;
234 #endif
235 };
236 #endif
237 
238 
239 
void Clear(Node *)
long G4long
Definition: G4Types.hh:80
const XML_Char * name
int G4int
Definition: G4Types.hh:78
double precision function energy(A, Z)
Definition: dpm25nuc6.f:4106
bool G4bool
Definition: G4Types.hh:79
static IORTAnalysisManager * GetInstance()
subroutine title(NA, NB, NCA, NCB)
Definition: dpm25nuc7.f:1744
double G4double
Definition: G4Types.hh:76
IORTAnalysisFileMessenger * fMess
static IORTAnalysisManager * instance