File indexing completed on 2025-02-23 09:21:11
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 #ifndef SensitiveDetectorHit_h
0029 #define SensitiveDetectorHit_h 1
0030
0031 #include "G4Allocator.hh"
0032 #include "G4LogicalVolume.hh"
0033 #include "G4RotationMatrix.hh"
0034 #include "G4THitsCollection.hh"
0035 #include "G4ThreeVector.hh"
0036 #include "G4Transform3D.hh"
0037 #include "G4VHit.hh"
0038
0039 class G4AttDef;
0040 class G4AttValue;
0041
0042 class SensitiveDetectorHit : public G4VHit
0043 {
0044 public:
0045 SensitiveDetectorHit();
0046 SensitiveDetectorHit(G4int z);
0047 virtual ~SensitiveDetectorHit();
0048 SensitiveDetectorHit(const SensitiveDetectorHit& right);
0049 const SensitiveDetectorHit& operator=(const SensitiveDetectorHit& right);
0050 G4bool operator==(const SensitiveDetectorHit& right) const;
0051
0052 inline void* operator new(size_t);
0053 inline void operator delete(void* aHit);
0054
0055 virtual void Draw();
0056 virtual const std::map<G4String, G4AttDef>* GetAttDefs() const;
0057 virtual std::vector<G4AttValue>* CreateAttValues() const;
0058 virtual void Print();
0059
0060 private:
0061 G4int fLayerID;
0062 G4ThreeVector fWorldPos;
0063
0064 public:
0065 inline void SetLayerID(G4int z) { fLayerID = z; }
0066 inline G4int GetLayerID() const { return fLayerID; }
0067 inline void SetWorldPos(G4ThreeVector xyz) { fWorldPos = xyz; }
0068 inline G4ThreeVector GetWorldPos() const { return fWorldPos; }
0069 };
0070
0071 typedef G4THitsCollection<SensitiveDetectorHit> SensitiveDetectorHitsCollection;
0072
0073 #ifdef G4MULTITHREADED
0074 extern G4ThreadLocal G4Allocator<SensitiveDetectorHit>* SensitiveDetectorHitAllocator;
0075 #else
0076 extern G4Allocator<SensitiveDetectorHit> SensitiveDetectorHitAllocator;
0077 #endif
0078
0079 inline void* SensitiveDetectorHit::operator new(size_t)
0080 {
0081 #ifdef G4MULTITHREADED
0082 if (!SensitiveDetectorHitAllocator)
0083 SensitiveDetectorHitAllocator = new G4Allocator<SensitiveDetectorHit>;
0084 return (void*)SensitiveDetectorHitAllocator->MallocSingle();
0085 #else
0086 void* aHit;
0087 aHit = (void*)SensitiveDetectorHitAllocator.MallocSingle();
0088 return aHit;
0089 #endif
0090 }
0091
0092 inline void SensitiveDetectorHit::operator delete(void* aHit)
0093 {
0094 #ifdef G4MULTITHREADED
0095 SensitiveDetectorHitAllocator->FreeSingle((SensitiveDetectorHit*)aHit);
0096 #else
0097 SensitiveDetectorHitAllocator.FreeSingle((SensitiveDetectorHit*)aHit);
0098 #endif
0099 }
0100
0101 #endif