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