File indexing completed on 2026-03-28 07:49:52
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
0030
0031
0032
0033
0034
0035
0036 #ifndef GB03HodoHit_h
0037 #define GB03HodoHit_h 1
0038
0039 #include "G4Allocator.hh"
0040 #include "G4THitsCollection.hh"
0041 #include "G4ThreeVector.hh"
0042 #include "G4VHit.hh"
0043
0044 class GB03HodoHit : public G4VHit
0045 {
0046 public:
0047 GB03HodoHit() = default;
0048 GB03HodoHit(const GB03HodoHit&);
0049 ~GB03HodoHit() override = default;
0050
0051
0052 const GB03HodoHit& operator=(const GB03HodoHit&);
0053 G4bool operator==(const GB03HodoHit&) const;
0054
0055 inline void* operator new(size_t);
0056 inline void operator delete(void*);
0057
0058
0059 void Draw() override;
0060 void Print() override;
0061
0062
0063 void Set(G4int id, G4double ek, G4double pw, G4ThreeVector xyz)
0064 {
0065 fEkin = ek;
0066 fWeight = pw;
0067 fEncoding = id;
0068 fPos = xyz;
0069 }
0070 void SetEkin(G4double ek) { fEkin = ek; }
0071 void SetWeight(G4double pw) { fWeight = pw; }
0072 void SetId(G4int id) { fEncoding = id; }
0073 void SetPos(G4ThreeVector xyz) { fPos = xyz; }
0074
0075
0076 G4double GetEkin() const { return fEkin; }
0077 G4double GetWeight() const { return fWeight; }
0078 G4int GetId() const { return fEncoding; }
0079 G4ThreeVector GetPos() const { return fPos; }
0080
0081 private:
0082 G4double fEkin{0.0};
0083 G4double fWeight{0.0};
0084 G4int fEncoding{0};
0085 G4ThreeVector fPos;
0086 };
0087
0088
0089
0090 using GB03HodoHitsCollection = G4THitsCollection<GB03HodoHit>;
0091
0092 extern G4ThreadLocal G4Allocator<GB03HodoHit>* GB03HodoHitAllocator;
0093
0094
0095
0096 inline void* GB03HodoHit::operator new(size_t)
0097 {
0098 if (GB03HodoHitAllocator == nullptr) {
0099 GB03HodoHitAllocator = new G4Allocator<GB03HodoHit>;
0100 }
0101 void* hit;
0102 hit = (void*)GB03HodoHitAllocator->MallocSingle();
0103 return hit;
0104 }
0105
0106
0107
0108 inline void GB03HodoHit::operator delete(void* hit)
0109 {
0110 GB03HodoHitAllocator->FreeSingle((GB03HodoHit*)hit);
0111 }
0112
0113 #endif