File indexing completed on 2026-04-18 07:42:19
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029 #ifndef TrackerHit_h
0030 #define TrackerHit_h 1
0031
0032 #include "G4ParticleDefinition.hh"
0033 #include "G4THitsCollection.hh"
0034 #include "G4ThreeVector.hh"
0035 #include "G4VHit.hh"
0036
0037
0038
0039 class TrackerHit : public G4VHit
0040 {
0041 public:
0042 TrackerHit();
0043 TrackerHit(const TrackerHit&);
0044 ~TrackerHit() override;
0045
0046
0047 const TrackerHit& operator=(const TrackerHit& right);
0048 G4bool operator==(const TrackerHit& right) const;
0049
0050 inline void* operator new(size_t);
0051 inline void operator delete(void*);
0052
0053
0054 void Draw() override;
0055 void Print() override;
0056
0057
0058 inline void SetTrackID(const G4int& track) { fTrackID = track; }
0059 inline void SetPosition(const G4ThreeVector& pos) { fPos = pos; }
0060 inline void SetEdep(const G4double& edep) { fEdep = edep; }
0061 inline void SetPartDef(const G4ParticleDefinition* partDef)
0062 {
0063 fPartDef = partDef;
0064 }
0065
0066
0067 inline G4int GetTrackID() const { return fTrackID; }
0068 inline G4ThreeVector GetPosition() const { return fPos; }
0069 inline G4double GetEdep() const { return fEdep; }
0070 inline const G4ParticleDefinition* GetPartDef() const { return fPartDef; }
0071
0072 private:
0073 G4int fTrackID = 0;
0074 G4ThreeVector fPos = G4ThreeVector();
0075 G4double fEdep = 0.;
0076 const G4ParticleDefinition* fPartDef = nullptr;
0077 };
0078
0079
0080
0081 typedef G4THitsCollection<TrackerHit> TrackerHitColl;
0082
0083 extern G4ThreadLocal G4Allocator<TrackerHit>* TrackerHitAllocator;
0084
0085
0086
0087 inline void* TrackerHit::operator new(size_t)
0088 {
0089 if (!TrackerHitAllocator) TrackerHitAllocator = new G4Allocator<TrackerHit>;
0090 return (void*)TrackerHitAllocator->MallocSingle();
0091 }
0092
0093
0094
0095 inline void TrackerHit::operator delete(void* hit)
0096 {
0097 TrackerHitAllocator->FreeSingle((TrackerHit*)hit);
0098 }
0099
0100
0101
0102 #endif