CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HFShowerG4Hit.h
Go to the documentation of this file.
1 #ifndef SimG4CMS_ShowerLibraryProducer_HFShowerG4Hit_h
2 #define SimG4CMS_ShowerLibraryProducer_HFShowerG4Hit_h
3 
6 
7 #include "G4VHit.hh"
8 #include "G4THitsCollection.hh"
9 #include "G4Allocator.hh"
10 #include "G4ThreeVector.hh"
11 #include "G4LogicalVolume.hh"
12 
13 #include <boost/cstdint.hpp>
14 #include <vector>
15 
16 class HFShowerG4Hit : public G4VHit {
17 
18 public:
19 
20  HFShowerG4Hit();
21  HFShowerG4Hit(G4int hitId, G4int tkID, double edep, double time);
22  virtual ~HFShowerG4Hit();
23  HFShowerG4Hit(const HFShowerG4Hit &right);
24  const HFShowerG4Hit& operator=(const HFShowerG4Hit &right);
25  G4int operator==(const HFShowerG4Hit &right) const;
26 
27  inline void *operator new(size_t);
28  inline void operator delete(void *aHit);
29 
30 private:
31 
32  G4int theHitId;
33  G4int theTrackId;
34  G4double theEdep;
35  G4double theTime;
36  G4ThreeVector localPos;
37  G4ThreeVector globalPos;
38  G4ThreeVector momDir;
39 
40 public:
41 
42  inline void setHitId(G4int hitId) {theHitId = hitId;}
43  inline void setTrackId(G4int trackId) {theTrackId = trackId;}
44  inline void setEnergy(G4double edep) {theEdep = edep;}
45  inline void updateEnergy(G4double edep) {theEdep += edep;}
46  inline void setTime(G4double t) {theTime = t;}
47  inline void setLocalPos(const G4ThreeVector& xyz) {localPos = xyz;}
48  inline void setGlobalPos(const G4ThreeVector& xyz) {globalPos = xyz;}
49  inline void setPrimMomDir(const G4ThreeVector& xyz) {momDir = xyz;}
50 
51  inline G4int hitId() const {return theHitId;}
52  inline G4int trackId() const {return theTrackId;}
53  inline G4double edep() const {return theEdep;};
54  inline G4double time() const {return theTime;}
55  inline G4ThreeVector localPosition() const {return localPos;}
56  inline G4ThreeVector globalPosition() const {return globalPos;}
57  inline G4ThreeVector primaryMomDir() const {return momDir;}
58 };
59 
60 typedef G4THitsCollection<HFShowerG4Hit> HFShowerG4HitsCollection;
61 
62 extern G4ThreadLocal G4Allocator<HFShowerG4Hit>* fHFShowerG4HitAllocator;
63 
64 inline void* HFShowerG4Hit::operator new(size_t) {
66  new G4Allocator<HFShowerG4Hit>;
67  return (void*)fHFShowerG4HitAllocator->MallocSingle();
68 }
69 
70 inline void HFShowerG4Hit::operator delete(void *aHit) {
71  fHFShowerG4HitAllocator->FreeSingle((HFShowerG4Hit*) aHit);
72 }
73 #endif
G4ThreeVector primaryMomDir() const
Definition: HFShowerG4Hit.h:57
const HFShowerG4Hit & operator=(const HFShowerG4Hit &right)
G4double theEdep
Definition: HFShowerG4Hit.h:34
G4int hitId() const
Definition: HFShowerG4Hit.h:51
G4ThreeVector localPos
Definition: HFShowerG4Hit.h:36
void setLocalPos(const G4ThreeVector &xyz)
Definition: HFShowerG4Hit.h:47
G4ThreadLocal G4Allocator< HFShowerG4Hit > * fHFShowerG4HitAllocator
Definition: HFShowerG4Hit.cc:6
G4int operator==(const HFShowerG4Hit &right) const
G4ThreeVector localPosition() const
Definition: HFShowerG4Hit.h:55
void setEnergy(G4double edep)
Definition: HFShowerG4Hit.h:44
void setTrackId(G4int trackId)
Definition: HFShowerG4Hit.h:43
G4int trackId() const
Definition: HFShowerG4Hit.h:52
void setHitId(G4int hitId)
Definition: HFShowerG4Hit.h:42
void setTime(G4double t)
Definition: HFShowerG4Hit.h:46
void setPrimMomDir(const G4ThreeVector &xyz)
Definition: HFShowerG4Hit.h:49
G4double edep() const
Definition: HFShowerG4Hit.h:53
virtual ~HFShowerG4Hit()
G4double theTime
Definition: HFShowerG4Hit.h:35
G4ThreeVector momDir
Definition: HFShowerG4Hit.h:38
void setGlobalPos(const G4ThreeVector &xyz)
Definition: HFShowerG4Hit.h:48
G4ThreeVector globalPos
Definition: HFShowerG4Hit.h:37
G4ThreeVector globalPosition() const
Definition: HFShowerG4Hit.h:56
void updateEnergy(G4double edep)
Definition: HFShowerG4Hit.h:45
G4double time() const
Definition: HFShowerG4Hit.h:54
G4THitsCollection< HFShowerG4Hit > HFShowerG4HitsCollection
Definition: HFShowerG4Hit.h:60