GGS(GenericGEANT4Simulation)Software  2.7.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 "G4Allocator.hh"
14 #include "G4Step.hh"
15 #include "G4THitsCollection.hh"
16 #include "G4ThreeVector.hh"
17 #include "G4VHit.hh"
18 #include "G4VPhysicalVolume.hh"
19 
21 #include "utils/GGSMiscUtils.h"
22 
23 #include <vector>
24 
25 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
26 
36 class GGSPartHit : public G4VHit {
37 public:
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 
90  virtual void UserInit(G4Step *aStep) { GGS_IGNORE_VAR(aStep); }
91 
114  virtual void AddStep(const G4Step &step);
115 
120  inline void SetTrackID(G4int id) { _trackID = id; }
121 
126  inline void SetParentID(G4int id) { _parentID = id; }
127 
132  inline void SetParticlePdg(G4int pdg) { _particlePdg = pdg; }
133 
142  void SetPosHitsStorage(bool flag);
143 
148  inline G4double GetEnergyDeposit() const { return _eDep; }
149 
154  inline G4double GetTime() const { return _time; }
155 
160  inline G4double GetPathLength() const { return _pathLength; }
161 
168  inline G4ThreeVector GetEntrancePoint() const { return _entrancePoint; }
169 
176  inline G4ThreeVector GetExitPoint() const { return _exitPoint; }
177 
184  inline G4ThreeVector GetEntranceMomentum() const { return _entranceMomentum; }
185 
192  inline G4double GetEntranceEnergy() const { return _entranceEnergy; }
193 
198  inline G4int GetTrackID() const { return _trackID; }
199 
204  inline G4int GetParentID() const { return _parentID; }
205 
210  inline G4int GetParticlePdg() const { return _particlePdg; }
211 
218  inline GGSPosHitsCollection *GetPosHits() { return _posHits; }
219 
220 protected:
221  G4double _eDep; // Energy deposited
222  G4double _time; // Time of the hit
223  G4double _pathLength; // Path length of the Hit
224  G4ThreeVector _entrancePoint; // Entrance point.
225  G4ThreeVector _exitPoint; // Exit point.
226  G4ThreeVector _entranceMomentum; // Entrance momentum
227  G4double _entranceEnergy; // Entrance energy
228  G4int _trackID; // GEANT4 particle ID
229  G4int _parentID; // GEANT4 particle ID of the mother particle
230  G4int _particlePdg; // Particle PDG
231 
232  bool _isReset;
233  GGSPosHitsCollection *_posHits;
234 };
235 
236 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
238 typedef G4THitsCollection<GGSPartHit> GGSPartHitsCollection;
239 
241 extern G4Allocator<GGSPartHit> GGSPartHitAllocator;
242 
243 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
244 
245 inline void *GGSPartHit::operator new(size_t) {
246  void *aHit;
247  aHit = (void *)GGSPartHitAllocator.MallocSingle();
248  return aHit;
249 }
250 
251 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
252 
253 inline void GGSPartHit::operator delete(void *aHit) { GGSPartHitAllocator.FreeSingle((GGSPartHit *)aHit); }
254 
255 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
256 
257 #include "utils/GGSFactory.h"
258 
261 
262 #define RegisterPartHit(className) \
263  GGSPartHit *className##Builder() { return new className(); } \
264  class className##Proxy { \
265  public: \
266  className##Proxy() { GGSPartHitFactory::GetInstance().RegisterBuilder(#className, className##Builder); } \
267  }; \
268  className##Proxy proxyFor##className
269 #endif /* GGSPARTHIT_H */
G4THitsCollection< GGSPosHit > GGSPosHitsCollection
Alias for G4 template hits collection for GGSPosHit.
Definition: GGSPosHit.h:194
virtual void AddStep(const G4Step &step)
Adds a step to the particle hit.
Definition: GGSPartHit.cpp:101
GGSPartHit()
Constructor.
Definition: GGSPartHit.cpp:12
G4double GetEnergyDeposit() const
Energy deposit getter.
Definition: GGSPartHit.h:148
void SetTrackID(G4int id)
Track ID setter.
Definition: GGSPartHit.h:120
G4ThreeVector GetEntrancePoint() const
Entrance point getter.
Definition: GGSPartHit.h:168
G4double GetTime() const
Time getter.
Definition: GGSPartHit.h:154
void GGS_IGNORE_VAR(const T &)
Small utility to avoid compiler warnings for unused methods.
Definition: GGSMiscUtils.h:14
bool operator==(const GGSPartHit &right) const
Comparison operator.
Definition: GGSPartHit.cpp:68
Definition of GGS Particle Hit.
Definition: GGSPartHit.h:36
virtual void UserInit(G4Step *aStep)
User initialization of hit global properties.
Definition: GGSPartHit.h:90
~GGSPartHit()
Destructor.
Definition: GGSPartHit.cpp:19
Template factory class.
Definition: GGSFactory.h:29
G4int GetParentID() const
Parent&#39;s track ID getter.
Definition: GGSPartHit.h:204
void SetPosHitsStorage(bool flag)
Turn on or off the storage of position hits.
Definition: GGSPartHit.cpp:121
void SetParticlePdg(G4int pdg)
PDG code setter.
Definition: GGSPartHit.h:132
const GGSPartHit & operator=(const GGSPartHit &right)
Assignment operator.
Definition: GGSPartHit.cpp:44
void SetParentID(G4int id)
Parent&#39;s track ID setter.
Definition: GGSPartHit.h:126
G4int GetParticlePdg() const
PDG code getter.
Definition: GGSPartHit.h:210
G4ThreeVector GetExitPoint() const
Exit point getter.
Definition: GGSPartHit.h:176
G4ThreeVector GetEntranceMomentum() const
Entrance momentum getter.
Definition: GGSPartHit.h:184
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:218
G4THitsCollection< GGSPartHit > GGSPartHitsCollection
Alias for G4 template hits collection for GGSPartHit.
Definition: GGSPartHit.h:238
G4int GetTrackID() const
Track ID getter.
Definition: GGSPartHit.h:198
G4double GetEntranceEnergy() const
Entrance energy getter.
Definition: GGSPartHit.h:192