GGS(GenericGEANT4Simulation)Software  2.6.0
 All Data Structures Namespaces Files Functions Variables Typedefs Macros
GGSPartHit.h
Go to the documentation of this file.
1 /*
2  * GGSPartHit.h
3  *
4  * Created on: 2010-10-17
5  * Authors: Franz Longo , Elena Vannuccini
6  */
7 
10 #ifndef GGSPARTHIT_H
11 #define GGSPARTHIT_H
12 
13 #include "G4VHit.hh"
14 #include "G4THitsCollection.hh"
15 #include "G4Step.hh"
16 #include "G4Allocator.hh"
17 #include "G4ThreeVector.hh"
18 #include "G4VPhysicalVolume.hh"
19 
21 
22 #include <vector>
23 
24 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
25 
35 class GGSPartHit: public G4VHit {
36 public:
37 
39  GGSPartHit();
40 
42  ~GGSPartHit();
43 
48  GGSPartHit(const GGSPartHit& right);
49 
55  const GGSPartHit& operator=(const GGSPartHit& right);
56 
62  bool operator==(const GGSPartHit& right) const;
63 
71  inline void* operator new(size_t size);
72 
80  inline void operator delete(void* aHit);
81 
104  virtual void AddStep(const G4Step &step);
105 
110  inline void SetTrackID(G4int id) {
111  _trackID = id;
112  }
113 
118  inline void SetParentID(G4int id) {
119  _parentID = id;
120  }
121 
126  inline void SetParticlePdg(G4int pdg) {
127  _particlePdg = pdg;
128  }
129 
138  void SetPosHitsStorage(bool flag);
139 
144  inline G4double GetEnergyDeposit() const {
145  return _eDep;
146  }
147 
152  inline G4double GetTime() const {
153  return _time;
154  }
155 
160  inline G4double GetPathLength() const {
161  return _pathLength;
162  }
163 
170  inline G4ThreeVector GetEntrancePoint() const {
171  return _entrancePoint;
172  }
173 
180  inline G4ThreeVector GetExitPoint() const {
181  return _exitPoint;
182  }
183 
190  inline G4ThreeVector GetEntranceMomentum() const {
191  return _entranceMomentum;
192  }
193 
200  inline G4double GetEntranceEnergy() const {
201 
202  return _entranceEnergy;
203  }
204 
209  inline G4int GetTrackID() const {
210  return _trackID;
211  }
212 
217  inline G4int GetParentID() const {
218  return _parentID;
219  }
220 
225  inline G4int GetParticlePdg() const {
226  return _particlePdg;
227  }
228 
236  return _posHits;
237  }
238 
239 protected:
240 
241  G4double _eDep; // Energy deposited
242  G4double _time; // Time of the hit
243  G4double _pathLength; // Path length of the Hit
244  G4ThreeVector _entrancePoint; // Entrance point.
245  G4ThreeVector _exitPoint; // Exit point.
246  G4ThreeVector _entranceMomentum; // Entrance momentum
247  G4double _entranceEnergy; // Entrance energy
248  G4int _trackID; // GEANT4 particle ID
249  G4int _parentID; // GEANT4 particle ID of the mother particle
250  G4int _particlePdg; // Particle PDG
251 
252  bool _isReset;
253  GGSPosHitsCollection *_posHits;
254 
255 };
256 
257 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
259 typedef G4THitsCollection<GGSPartHit> GGSPartHitsCollection;
260 
262 extern G4Allocator<GGSPartHit> GGSPartHitAllocator;
263 
264 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
265 
266 inline void* GGSPartHit::operator new(size_t) {
267  void* aHit;
268  aHit = (void*) GGSPartHitAllocator.MallocSingle();
269  return aHit;
270 }
271 
272 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
273 
274 inline void GGSPartHit::operator delete(void* aHit) {
275  GGSPartHitAllocator.FreeSingle((GGSPartHit*) aHit);
276 }
277 
278 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
279 
280 #include "utils/GGSFactory.h"
281 
284 
285 #define RegisterPartHit(className) \
286  GGSPartHit* className##Builder(){ \
287  return new className(); \
288  }\
289  class className##Proxy{ \
290  public: \
291  className##Proxy(){ \
292  GGSPartHitFactory::GetInstance().RegisterBuilder(#className, className##Builder); \
293  } \
294  };\
295  className##Proxy proxyFor##className
296 #endif /* GGSPARTHIT_H */
297 
G4THitsCollection< GGSPosHit > GGSPosHitsCollection
Alias for G4 template hits collection for GGSPosHit.
Definition: GGSPosHit.h:223
virtual void AddStep(const G4Step &step)
Adds a step to the particle hit.
Definition: GGSPartHit.cpp:110
GGSPartHit()
Constructor.
Definition: GGSPartHit.cpp:12
G4double GetEnergyDeposit() const
Energy deposit getter.
Definition: GGSPartHit.h:144
void SetTrackID(G4int id)
Track ID setter.
Definition: GGSPartHit.h:110
G4ThreeVector GetEntrancePoint() const
Entrance point getter.
Definition: GGSPartHit.h:170
G4double GetTime() const
Time getter.
Definition: GGSPartHit.h:152
bool operator==(const GGSPartHit &right) const
Comparison operator.
Definition: GGSPartHit.cpp:74
Definition of GGS Particle Hit.
Definition: GGSPartHit.h:35
~GGSPartHit()
Destructor.
Definition: GGSPartHit.cpp:19
Template factory class.
Definition: GGSFactory.h:30
G4int GetParentID() const
Parent&#39;s track ID getter.
Definition: GGSPartHit.h:217
void SetPosHitsStorage(bool flag)
Turn on or off the storage of position hits.
Definition: GGSPartHit.cpp:130
void SetParticlePdg(G4int pdg)
PDG code setter.
Definition: GGSPartHit.h:126
const GGSPartHit & operator=(const GGSPartHit &right)
Assignment operator.
Definition: GGSPartHit.cpp:49
void SetParentID(G4int id)
Parent&#39;s track ID setter.
Definition: GGSPartHit.h:118
G4int GetParticlePdg() const
PDG code getter.
Definition: GGSPartHit.h:225
G4ThreeVector GetExitPoint() const
Exit point getter.
Definition: GGSPartHit.h:180
G4ThreeVector GetEntranceMomentum() const
Entrance momentum getter.
Definition: GGSPartHit.h:190
G4Allocator< GGSPartHit > GGSPartHitAllocator
Alias for G4 template memory allocator for GGSPartHit.
Definition: GGSPartHit.cpp:7
G4double GetPathLength() const
Path length getter.
Definition: GGSPartHit.h:160
GGSPosHitsCollection * GetPosHits()
Getter of container of position hits.
Definition: GGSPartHit.h:235
G4THitsCollection< GGSPartHit > GGSPartHitsCollection
Alias for G4 template hits collection for GGSPartHit.
Definition: GGSPartHit.h:259
G4int GetTrackID() const
Track ID getter.
Definition: GGSPartHit.h:209
G4double GetEntranceEnergy() const
Entrance energy getter.
Definition: GGSPartHit.h:200