source: trunk/examples/extended/medical/GammaTherapy/include/Histo.hh

Last change on this file was 1342, checked in by garnier, 14 years ago

update ti head

File size: 6.8 KB
Line 
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#ifndef Histo_h
27#define Histo_h 1
28
29//---------------------------------------------------------------------------
30//
31// ClassName:   Histo
32//
33// Description: Singleton class to hold Emc geometry parameters.
34//              User cannot access to the constructor.
35//              The pointer of the only existing object can be got via
36//              Histo::GetPointer() static method.
37//              The first invokation of this static method makes
38//              the singleton object.
39//
40// Author:      V.Ivanchenko 27/09/00
41//
42//----------------------------------------------------------------------------
43//
44
45//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
46
47#include "globals.hh"
48#include "G4DynamicParticle.hh"
49#include "G4VPhysicalVolume.hh"
50#include "G4DataVector.hh"
51#include "G4Track.hh"
52
53//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
54
55namespace AIDA {
56  class ITree;
57  class ITuple;
58  class IHistogram1D;
59  class IAnalysisFactory;
60}
61
62class Histo
63{
64
65public:
66  // With description
67
68  static Histo* GetPointer();
69
70  Histo();
71
72  ~Histo();
73
74  void BeginOfHisto();
75  // In this method histogramms are booked
76
77  void EndOfHisto();
78  // In this method bookHisto method is called in which histogramms are filled
79
80public: // Without description
81 
82  void SetHistoName(const G4String& name) {histName = name;};
83  void SetHistoType(const G4String& type) {histType = type;};
84  void bookHisto();
85  void SaveToTuple(const G4String&, G4double);
86  void SaveToTuple(const G4String&, G4double, G4double);
87  void SaveEvent();
88
89  G4double GetTrackLength() const {return trackLength;};
90  void ResetTrackLength() {trackLength = 0.0, trackAbs = true;};
91  void SetTrackOutAbsorber() {trackAbs = false;};
92  G4bool GetTrackInAbsorber() const {return trackAbs;};
93  void AddTrackLength(G4double x)   {trackLength += x;};
94
95  void AddDeltaElectron(const G4DynamicParticle*);
96  void AddPhoton(const G4DynamicParticle*);
97  void AddPhantomPhoton(const G4DynamicParticle*);
98  void AddTargetPhoton(const G4DynamicParticle*);
99  void AddPhantomElectron(const G4DynamicParticle*);
100  void AddTargetElectron(const G4DynamicParticle*);
101  inline void AddPositron(const G4DynamicParticle*) { ++n_posit;};
102  inline void AddStepInTarget() { ++n_step_target;};
103
104  inline void SetVerbose(G4int val) {verbose = val;};
105  inline G4int GetVerbose() const {return verbose;};
106
107  inline void SetHistoNumber(G4int val) {nHisto = val;};
108  inline void SetNtuple(G4bool val) {nTuple = val;};
109
110  inline void SetNumberDivZ(G4int val) {nBinsZ = val; };
111  inline G4int GetNumberDivZ() const    {return nBinsZ;};
112  inline void SetNumberDivR(G4int val) {nBinsR = val; };
113  inline G4int GetNumberDivR() const    {return nBinsR;};
114  inline void SetNumberDivE(G4int val) {nBinsE = val; };
115
116  inline void SetFirstEventToDebug(G4int val) {nEvt1 = val;};
117  inline G4int FirstEventToDebug() const {return nEvt1;};
118  inline void SetLastEventToDebug(G4int val) {nEvt2 = val;};
119  inline G4int LastEventToDebug() const {return nEvt2;};
120
121  inline void SetAbsorberZ(G4double val) {absorberZ = val;};
122  inline void SetAbsorberR(G4double val) {absorberR = val;};
123  inline void SetScoreZ(G4double val)    {scoreZ = val;};
124
125  inline void SetMaxEnergy(G4double val) {maxEnergy = val;};
126  inline G4double  GetMaxEnergy() const {return maxEnergy;};
127
128  inline void AddEvent() { ++n_evt; };
129  inline void AddStep()  { ++n_step; };
130
131  inline void SetCheckVolume(G4VPhysicalVolume* v) {checkVolume = v;};
132  inline void SetGasVolume(G4VPhysicalVolume* v) {gasVolume = v;};
133  inline G4VPhysicalVolume* CheckVolume() const {return checkVolume;};
134  inline G4VPhysicalVolume* GasVolume() const {return gasVolume;};
135
136  inline void SetPhantom(G4VPhysicalVolume* v) {phantom = v;};
137  inline void SetTarget1(G4VPhysicalVolume* v) {target1 = v;};
138  inline void SetTarget2(G4VPhysicalVolume* v) {target2 = v;};
139 
140  void AddStep(G4double e, G4double r1, G4double z1, G4double r2, G4double z2,
141                             G4double r0, G4double z0);
142  void AddGamma(G4double e, G4double r);
143  void ScoreNewTrack(const G4Track* aTrack);
144
145private:
146
147  // MEMBERS
148  static Histo* fManager;
149
150  const G4ParticleDefinition* gamma;
151  const G4ParticleDefinition* electron;
152  const G4ParticleDefinition* positron;
153  const G4ParticleDefinition* neutron;
154
155  G4VPhysicalVolume* checkVolume;
156  G4VPhysicalVolume* gasVolume;
157  G4VPhysicalVolume* phantom;
158  G4VPhysicalVolume* target1;
159  G4VPhysicalVolume* target2;
160  G4String histName;
161  G4String histType;
162
163  std::vector<AIDA::IHistogram1D*> histo;
164  AIDA::IAnalysisFactory* af; 
165  AIDA::ITuple* ntup;
166  AIDA::ITree* tree;
167  G4int nHisto;
168  G4int nHisto1;
169  G4int verbose;
170  G4int nBinsZ;
171  G4int nBinsR;
172  G4int nBinsE;
173  G4int nScoreBin;
174  G4int nEvt1;
175  G4int nEvt2;
176
177  G4double absorberZ;
178  G4double stepZ;
179  G4double scoreZ;
180  G4double absorberR;
181  G4double stepR;
182  G4double maxEnergy;
183  G4double stepE;
184  G4double normZ;
185  G4double sumR;
186
187  G4double trackLength;
188  G4bool trackAbs;        // Track is in absorber
189  G4int n_evt;
190  G4int n_elec;
191  G4int n_posit;
192  G4int n_gam;
193  G4int n_step;
194  G4int n_gam_ph;
195  G4int n_gam_tar;
196  G4int n_e_tar;
197  G4int n_e_ph;
198  G4int n_step_target;
199  G4int n_neutron;
200  G4bool nTuple;
201  G4DataVector   volumeR;
202  G4DataVector   gammaE;
203
204};
205
206#endif
Note: See TracBrowser for help on using the repository browser.