CMS 3D CMS Logo

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 <vector>
14 
15 class HFShowerG4Hit : public G4VHit {
16 
17 public:
18 
19  HFShowerG4Hit();
20  HFShowerG4Hit(G4int hitId, G4int tkID, double edep, double time);
21  ~HFShowerG4Hit() override;
22  HFShowerG4Hit(const HFShowerG4Hit &right);
23  const HFShowerG4Hit& operator=(const HFShowerG4Hit &right);
24  G4int operator==(const HFShowerG4Hit &right) const;
25 
26  inline void *operator new(size_t);
27  inline void operator delete(void *aHit);
28 
29 private:
30 
31  G4int theHitId;
32  G4int theTrackId;
33  G4double theEdep;
34  G4double theTime;
35  G4ThreeVector localPos;
36  G4ThreeVector globalPos;
37  G4ThreeVector momDir;
38 
39 public:
40 
41  inline void setHitId(G4int hitId) {theHitId = hitId;}
42  inline void setTrackId(G4int trackId) {theTrackId = trackId;}
43  inline void setEnergy(G4double edep) {theEdep = edep;}
44  inline void updateEnergy(G4double edep) {theEdep += edep;}
45  inline void setTime(G4double t) {theTime = t;}
46  inline void setLocalPos(const G4ThreeVector& xyz) {localPos = xyz;}
47  inline void setGlobalPos(const G4ThreeVector& xyz) {globalPos = xyz;}
48  inline void setPrimMomDir(const G4ThreeVector& xyz) {momDir = xyz;}
49 
50  inline G4int hitId() const {return theHitId;}
51  inline G4int trackId() const {return theTrackId;}
52  inline G4double edep() const {return theEdep;};
53  inline G4double time() const {return theTime;}
54  inline G4ThreeVector localPosition() const {return localPos;}
55  inline G4ThreeVector globalPosition() const {return globalPos;}
56  inline G4ThreeVector primaryMomDir() const {return momDir;}
57 };
58 
59 typedef G4THitsCollection<HFShowerG4Hit> HFShowerG4HitsCollection;
60 
61 extern G4ThreadLocal G4Allocator<HFShowerG4Hit>* fHFShowerG4HitAllocator;
62 
63 inline void* HFShowerG4Hit::operator new(size_t) {
65  new G4Allocator<HFShowerG4Hit>;
66  return (void*)fHFShowerG4HitAllocator->MallocSingle();
67 }
68 
69 inline void HFShowerG4Hit::operator delete(void *aHit) {
70  fHFShowerG4HitAllocator->FreeSingle((HFShowerG4Hit*) aHit);
71 }
72 #endif
G4ThreeVector primaryMomDir() const
Definition: HFShowerG4Hit.h:56
const HFShowerG4Hit & operator=(const HFShowerG4Hit &right)
G4double theEdep
Definition: HFShowerG4Hit.h:33
G4int hitId() const
Definition: HFShowerG4Hit.h:50
G4ThreeVector localPos
Definition: HFShowerG4Hit.h:35
void setLocalPos(const G4ThreeVector &xyz)
Definition: HFShowerG4Hit.h:46
~HFShowerG4Hit() override
G4ThreadLocal G4Allocator< HFShowerG4Hit > * fHFShowerG4HitAllocator
Definition: HFShowerG4Hit.cc:6
G4int operator==(const HFShowerG4Hit &right) const
G4ThreeVector localPosition() const
Definition: HFShowerG4Hit.h:54
void setEnergy(G4double edep)
Definition: HFShowerG4Hit.h:43
void setTrackId(G4int trackId)
Definition: HFShowerG4Hit.h:42
G4int trackId() const
Definition: HFShowerG4Hit.h:51
void setHitId(G4int hitId)
Definition: HFShowerG4Hit.h:41
void setTime(G4double t)
Definition: HFShowerG4Hit.h:45
void setPrimMomDir(const G4ThreeVector &xyz)
Definition: HFShowerG4Hit.h:48
G4double edep() const
Definition: HFShowerG4Hit.h:52
G4double theTime
Definition: HFShowerG4Hit.h:34
G4ThreeVector momDir
Definition: HFShowerG4Hit.h:37
void setGlobalPos(const G4ThreeVector &xyz)
Definition: HFShowerG4Hit.h:47
G4ThreeVector globalPos
Definition: HFShowerG4Hit.h:36
G4ThreeVector globalPosition() const
Definition: HFShowerG4Hit.h:55
void updateEnergy(G4double edep)
Definition: HFShowerG4Hit.h:44
G4double time() const
Definition: HFShowerG4Hit.h:53
G4THitsCollection< HFShowerG4Hit > HFShowerG4HitsCollection
Definition: HFShowerG4Hit.h:59