File indexing completed on 2025-02-23 09:22: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 RadiobiologyHit_h
0030 #define RadiobiologyHit_h 1
0031
0032 #include "G4Allocator.hh"
0033 #include "G4THitsCollection.hh"
0034 #include "G4ThreeVector.hh"
0035 #include "G4TouchableHandle.hh"
0036 #include "G4VHit.hh"
0037 #include "G4VPhysicalVolume.hh"
0038
0039 #include "tls.hh"
0040
0041 class G4ParticleDefinition;
0042
0043 namespace RadioBio
0044 {
0045
0046
0047
0048
0049
0050
0051
0052 class Hit : public G4VHit
0053 {
0054 public:
0055 Hit();
0056 Hit(const Hit&);
0057 ~Hit() override = default;
0058
0059
0060 const Hit& operator=(const Hit&);
0061 G4int operator==(const Hit&) const;
0062
0063 inline void* operator new(size_t);
0064 inline void operator delete(void*);
0065
0066
0067 void Draw() override;
0068 void Print() override;
0069
0070
0071 void SetTrackID(G4int track) { fTrackID = track; }
0072 void SetPartType(const G4ParticleDefinition* part) { fParticleType = part; }
0073 void SetEkinMean(double EkinMean) { fEkinMean = EkinMean; }
0074 void SetDeltaE(double DeltaE) { fDeltaE = DeltaE; }
0075 void SetEinit(G4double e) { fEinit = e; }
0076 void SetTrackLength(G4double x) { fTrackLength = x; }
0077 void SetElectronEnergy(G4double elEnergy) { fElectronEnergy = elEnergy; }
0078 void SetPhysicalVolume(G4VPhysicalVolume* PV) { fPhysicalVolume = PV; }
0079 void SetVoxelIndexes(const G4TouchableHandle& TH);
0080
0081
0082 G4int GetTrackID() const { return fTrackID; }
0083 const G4ParticleDefinition* GetPartType() const { return fParticleType; }
0084 G4double GetEkinMean() { return fEkinMean; }
0085 G4double GetDeltaE() { return fDeltaE; }
0086 G4double GetEinit() const { return fEinit; }
0087 G4double GetTrackLength() const { return fTrackLength; }
0088 G4double GetElectronEnergy() const { return fElectronEnergy; }
0089 G4VPhysicalVolume* GetPhysicalVolume() const { return fPhysicalVolume; }
0090 G4int GetXindex() { return fxIndex; }
0091 G4int GetYindex() { return fyIndex; }
0092 G4int GetZindex() { return fzIndex; }
0093
0094 private:
0095
0096 G4int fTrackID = -1;
0097 const G4ParticleDefinition* fParticleType = nullptr;
0098 G4double fEkinMean = 0.;
0099 G4double fDeltaE = 0.;
0100 G4double fEinit = 0.;
0101 G4double fTrackLength = 0.;
0102 G4double fElectronEnergy = 0.;
0103 G4VPhysicalVolume* fPhysicalVolume = nullptr;
0104 G4int fxIndex = -1;
0105 G4int fyIndex = -1;
0106 G4int fzIndex = -1;
0107 };
0108
0109
0110 typedef G4THitsCollection<Hit> RadioBioHitsCollection;
0111
0112
0113 extern G4ThreadLocal G4Allocator<Hit>* RadioBioHitAllocator;
0114
0115 inline void* Hit::operator new(size_t)
0116 {
0117 if (!RadioBioHitAllocator) RadioBioHitAllocator = new G4Allocator<Hit>;
0118 return (void*)RadioBioHitAllocator->MallocSingle();
0119 }
0120
0121 inline void Hit::operator delete(void* hit)
0122 {
0123 RadioBioHitAllocator->FreeSingle((Hit*)hit);
0124 }
0125
0126 }
0127
0128 #endif