File indexing completed on 2025-01-31 09:22:15
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 HadrontherapyDetectorHit_h
0030 #define HadrontherapyDetectorHit_h 1
0031
0032
0033 #include "G4VHit.hh"
0034 #include "G4THitsCollection.hh"
0035 #include "G4Allocator.hh"
0036
0037
0038 class HadrontherapyDetectorHit : public G4VHit
0039 {
0040 public:
0041 HadrontherapyDetectorHit();
0042 HadrontherapyDetectorHit(const HadrontherapyDetectorHit&);
0043 virtual ~HadrontherapyDetectorHit();
0044
0045
0046 const HadrontherapyDetectorHit& operator=(const HadrontherapyDetectorHit&);
0047
0048 G4bool operator==(const HadrontherapyDetectorHit&) const;
0049
0050
0051 inline void* operator new(size_t);
0052 inline void operator delete(void*);
0053
0054
0055 private:
0056 G4int xHitID;
0057 G4int zHitID;
0058 G4int yHitID;
0059 G4double energyDeposit;
0060
0061 public:
0062
0063
0064
0065 inline G4int GetXID()
0066 {return xHitID;}
0067
0068 inline G4int GetZID()
0069 {return zHitID;}
0070
0071 inline G4int GetYID()
0072 {return yHitID;}
0073
0074 inline G4double GetEdep()
0075 {return energyDeposit;}
0076
0077
0078
0079
0080 inline void SetEdepAndPosition(G4int xx, G4int yy, G4int zz, G4double eDep)
0081 {
0082 xHitID = xx;
0083 yHitID = yy;
0084 zHitID = zz;
0085 energyDeposit = eDep;
0086 }
0087 };
0088
0089 typedef G4THitsCollection<HadrontherapyDetectorHit> HadrontherapyDetectorHitsCollection;
0090
0091 extern G4ThreadLocal G4Allocator<HadrontherapyDetectorHit>* HadrontherapyDetectorHitAllocator;
0092
0093
0094 inline void* HadrontherapyDetectorHit::operator new(size_t)
0095 {
0096
0097
0098 if(!HadrontherapyDetectorHitAllocator)
0099 HadrontherapyDetectorHitAllocator= new G4Allocator<HadrontherapyDetectorHit>;
0100 void *aHit;
0101
0102 aHit = (void *) HadrontherapyDetectorHitAllocator->MallocSingle();
0103 return aHit;
0104
0105 }
0106
0107 inline void HadrontherapyDetectorHit::operator delete(void *aHit)
0108 {
0109 if(!HadrontherapyDetectorHitAllocator)
0110 HadrontherapyDetectorHitAllocator= new G4Allocator<HadrontherapyDetectorHit>;
0111
0112 HadrontherapyDetectorHitAllocator->FreeSingle((HadrontherapyDetectorHit*) aHit);
0113 }
0114
0115 #endif