GGS(GenericGEANT4Simulation)Software  2.7.0
 All Data Structures Namespaces Files Functions Variables Typedefs Macros
GGSTHits.h
Go to the documentation of this file.
1 /*
2  * GGSTHits.h
3  *
4  * Created on: 17 Aug 2011
5  * Author: Nicola Mori
6  */
7 
11 #ifndef GGSTHITS_H_
12 #define GGSTHITS_H_
13 
14 #include "TArrayF.h"
15 #include "TClonesArray.h"
16 #include "TString.h"
17 
18 class GGSTHitsReader;
19 class GGSHitsAction;
20 class GGSPosHit;
21 class GGSPartHit;
22 class GGSIntHit;
23 
24 // Utility for suppressing compiler warnings about unused variables.
25 template <class T> void IGNORE(const T &) {}
26 
27 /* ********************************* *
28  * Position hits classes declaration *
29  * ********************************* */
30 
38 class GGSTPosHitBase : public TObject {
39 
40 public:
41  Float_t eDep;
42 
45 
47  void Clear(Option_t *);
48 
49 #ifdef GGS_USE_G4
50 
58  virtual void UserConversion(const GGSPosHit &posHit) { IGNORE(posHit); }
59 #endif
60  ClassDef(GGSTPosHitBase, 1)
61 };
62 
70 class GGSTPosHit : public GGSTPosHitBase {
71 public:
72  Float_t time;
73  Float_t pathLength;
74  Float_t startPoint[3];
75  Float_t endPoint[3];
76  Float_t startMomentum[3];
77  Float_t startEnergy;
78 
80  GGSTPosHit();
81 
83  void Clear(Option_t * = nullptr);
84 
85 #ifdef GGS_USE_G4
86 
90  void UserConversion(const GGSPosHit &posHit);
91 #endif
92  ClassDef(GGSTPosHit, 3)
93 };
94 
95 /* ********************************* *
96  * Particle hits classes declaration *
97  * ********************************* */
98 
106 class GGSTPartHitBase : public TObject {
107 
108 public:
109  Float_t eDep;
110 
112  GGSTPartHitBase();
113 
116 
124  void Clear(Option_t *opt);
125 
126 #ifdef GGS_USE_G4
127 
135  virtual void UserConversion(const GGSPartHit &partHit) { IGNORE(partHit); }
136 #endif
137 
139  // void DumpHit();
140 
145  Int_t GetNPosHits();
146 
152  GGSTPosHitBase *GetPosHit(unsigned int iHit);
153 
158  std::string GetPosHitsClassName();
159 
160 private:
161  friend class GGSHitsAction; // Friend class to fill private properties during MC simulation
162  friend class GGSTHitsReader; // Friend class to fill transient private properties while reading the hit
163  TClonesArray *_posHits;
164  UInt_t _posHitIndex;
165 
166  ClassDef(GGSTPartHitBase, 1)
167 };
168 
176 class GGSTPartHit : public GGSTPartHitBase {
177 public:
178  Float_t time;
179  Float_t pathLength;
180  Float_t entrancePoint[3];
181  Float_t exitPoint[3];
182  Float_t entranceMomentum[3];
183  Float_t entranceEnergy;
184  Int_t trackID;
185  Int_t parentID;
186  Int_t particlePdg;
187 
189  GGSTPartHit();
190 
192  void Clear(Option_t *opt);
193 
194 #ifdef GGS_USE_G4
195 
199  void UserConversion(const GGSPartHit &partHit);
200 #endif
201  ClassDef(GGSTPartHit, 4)
202 };
203 
204 /* *********************************** *
205  * Integrated hits classes declaration *
206  * *********************************** */
207 
209 #include "montecarlo/dataobjs/GGSTHitVolInfo.h"
210 
218 class GGSTIntHitBase : public TObject {
219 
220 public:
222  Float_t eDep;
223  TArrayF eDepTimeBin;
224 
226  GGSTIntHitBase();
227 
229  ~GGSTIntHitBase();
230 
239  void Clear(Option_t *);
240 
241 #ifdef GGS_USE_G4
242 
250  virtual void UserConversion(const GGSIntHit &intHit) { IGNORE(intHit); }
251 #endif
252 
257  const TString &GetDetectorName() {
258  static const TString nullString("");
259  if (_hitDetInfo)
260  return _hitDetInfo->detectorName;
261  else
262  return nullString;
263  }
264 
271  const TArrayF &GetTimeBins() { return *_timeBins; }
272 
277  const TString &GetVolumeName() {
278  static const TString nullString("");
279  if (_hitVolInfo)
280  return _hitVolInfo->volumeName;
281  else
282  return nullString;
283  }
284 
289  const Float_t *GetVolumePosition() {
290  if (_hitVolInfo)
291  return _hitVolInfo->volumePos;
292  else
293  return NULL;
294  }
295 
300  Int_t GetVolumeID() {
301  if (_hitVolInfo)
302  return _hitVolInfo->id;
303  else
304  return -1;
305  }
306 
311  Int_t GetNPartHits();
312 
318  GGSTPartHitBase *GetPartHit(unsigned int iHit);
319 
324  std::string GetPartHitsClassName();
325 
326 private:
327  friend class GGSHitsAction; // Friend class to fill private properties during MC simulation
328  friend class GGSTHitsReader; // Friend class to fill transient private properties while reading the hit
329  UInt_t _volumeIndex;
330  TClonesArray *_partHits;
331  GGSTHitDetInfo *_hitDetInfo;
332  GGSTHitVolInfo *_hitVolInfo;
333  TArrayF *_timeBins;
334 
335  ClassDef(GGSTIntHitBase, 1)
336 };
337 
345 class GGSTIntHit : public GGSTIntHitBase {
346 public:
347  Float_t time;
348 
350  GGSTIntHit();
351 
353  void Clear(Option_t *opt);
354 
355 #ifdef GGS_USE_G4
356 
360  void UserConversion(const GGSIntHit &intHit);
361 #endif
362 
363  ClassDef(GGSTIntHit, 3)
364 };
365 #endif /* GGSTHITS_H_ */
Float_t volumePos[3]
Position of the touchable in world volume coordinates [cm].
GGSTPartHit()
Constructor.
Definition: GGSTHits.cpp:111
Float_t startMomentum[3]
Start momentum.
Definition: GGSTHits.h:76
GGSTPosHitBase()
Constructor.
Definition: GGSTHits.cpp:21
Int_t id
ID of the volume.
Class for reading output of GGSHitsAction.
Float_t time
Time of the hit.
Definition: GGSTHits.h:72
GGSTPosHitBase * GetPosHit(unsigned int iHit)
Get the specified position hit.
Definition: GGSTHits.cpp:93
Class to store detector informations.
GGSTIntHit()
Constructor.
Definition: GGSTHits.cpp:200
Float_t eDep
Deposited energy.
Definition: GGSTHits.h:109
const Float_t * GetVolumePosition()
Retrieves the position of the volume associated to the hit.
Definition: GGSTHits.h:289
Float_t pathLength
Path length of the hit.
Definition: GGSTHits.h:73
~GGSTPartHitBase()
Destructor.
Definition: GGSTHits.cpp:72
const TArrayF & GetTimeBins()
Retrieves the time bins for the hit.
Definition: GGSTHits.h:271
GGSTPartHitBase * GetPartHit(unsigned int iHit)
Get the specified particle hit.
Definition: GGSTHits.cpp:182
Float_t startEnergy
Start kinetic energy.
Definition: GGSTHits.h:77
Float_t entranceEnergy
Entrance kinetic energy.
Definition: GGSTHits.h:183
GGSTPartHitBase()
Constructor.
Definition: GGSTHits.cpp:69
void Clear(Option_t *opt)
Resets the particle hit.
Definition: GGSTHits.cpp:203
Float_t entrancePoint[3]
Entrance point.
Definition: GGSTHits.h:180
Float_t time
Time of the hit.
Definition: GGSTHits.h:178
void Clear(Option_t *=nullptr)
Resets the data members.
Definition: GGSTHits.cpp:36
Float_t pathLength
Path length of the hit.
Definition: GGSTHits.h:179
void Clear(Option_t *opt)
Resets the particle hit.
Definition: GGSTHits.cpp:119
Class to store G4 particle hits.
Definition: GGSTHits.h:176
Int_t trackID
GEANT4 track ID.
Definition: GGSTHits.h:184
Definition of GGS Particle Hit.
Definition: GGSPartHit.h:36
Float_t eDep
Total deposited energy.
Definition: GGSTHits.h:41
Definition of GGS Position Hit.
Definition: GGSPosHit.h:33
Base class for storing G4 particle hits.
Definition: GGSTHits.h:106
Int_t GetVolumeID()
Retrieves the ID of the volume associated to the hit.
Definition: GGSTHits.h:300
void Clear(Option_t *)
Resets the data members.
Definition: GGSTHits.cpp:24
Float_t time
Time of the hit (in ns).
Definition: GGSTHits.h:347
const TString & GetVolumeName()
Retrieves the name of the volume associated to the hit.
Definition: GGSTHits.h:277
GGSTIntHitBase()
Constructor.
Definition: GGSTHits.cpp:157
Float_t eDep
Deposited energy (transient).
Definition: GGSTHits.h:222
~GGSTIntHitBase()
Destructor.
Definition: GGSTHits.cpp:161
Class to store G4 position hits.
Definition: GGSTHits.h:70
Class to store G4 integrated hits.
Definition: GGSTHits.h:345
An action which saves hits in sensitive volumes on ROOT file.
Definition: GGSHitsAction.h:64
void Clear(Option_t *opt)
Resets the data members.
Definition: GGSTHits.cpp:78
Int_t particlePdg
Particle PDG ID.
Definition: GGSTHits.h:186
TString volumeName
Name of the physical volume.
Definition of GGS Integrated Hit.
Definition: GGSIntHit.h:32
Int_t GetNPosHits()
Prints members values on standard output.
Definition: GGSTHits.cpp:86
Float_t startPoint[3]
Start point.
Definition: GGSTHits.h:74
std::string GetPartHitsClassName()
Gets the name of the class of the particle hits.
Definition: GGSTHits.cpp:190
GGSTPosHit()
Constructor.
Definition: GGSTHits.cpp:28
const TString & GetDetectorName()
Retrieves the name of the detector associated to the hit.
Definition: GGSTHits.h:257
void Clear(Option_t *)
Resets the data members.
Definition: GGSTHits.cpp:167
Float_t exitPoint[3]
Exit point.
Definition: GGSTHits.h:181
std::string GetPosHitsClassName()
Gets the name of the class of the position hits.
Definition: GGSTHits.cpp:101
Base class for storing G4 position hits.
Definition: GGSTHits.h:38
TArrayF eDepTimeBin
Energy deposit in each time bin.
Definition: GGSTHits.h:223
GGSTHitVolInfo.h GGSTHitVolInfo class declaration.
Int_t GetNPartHits()
Gets the number of particle hits.
Definition: GGSTHits.cpp:175
TString detectorName
Name of detector associated to integrated hits.
Base class for storing G4 integrated hits.
Definition: GGSTHits.h:218
Int_t parentID
GEANT4 parent ID.
Definition: GGSTHits.h:185
Float_t entranceMomentum[3]
Entrance momentum.
Definition: GGSTHits.h:182
Float_t endPoint[3]
End point.
Definition: GGSTHits.h:75