File indexing completed on 2026-04-17 07:52:13
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 #ifndef SensitiveDetectorHit_h
0034 #define SensitiveDetectorHit_h 1
0035
0036 #include "G4VHit.hh"
0037 #include "G4THitsCollection.hh"
0038 #include "G4Allocator.hh"
0039 #include "G4ThreeVector.hh"
0040 #include "G4LogicalVolume.hh"
0041 #include "G4Transform3D.hh"
0042 #include "G4RotationMatrix.hh"
0043
0044
0045
0046
0047
0048 class G4AttDef;
0049 class G4AttValue;
0050
0051 class SensitiveDetectorHit : public G4VHit
0052 {
0053 public:
0054 SensitiveDetectorHit() = default;
0055 ~SensitiveDetectorHit() override = default;
0056
0057 SensitiveDetectorHit(const SensitiveDetectorHit &right) = default;
0058 SensitiveDetectorHit& operator=(const SensitiveDetectorHit &right) = default;
0059
0060 int operator==(const SensitiveDetectorHit &right) const;
0061
0062 inline void *operator new(size_t);
0063 inline void operator delete(void *aHit);
0064
0065 void Draw() override;
0066 const std::map<G4String,G4AttDef>* GetAttDefs() const override;
0067 std::vector<G4AttValue>* CreateAttValues() const override;
0068 void Print() override;
0069
0070 inline void SetTrackID(G4int z) {fTrackID = z;}
0071 inline G4int GetTrackID() const {return fTrackID;}
0072
0073 inline void SetTrackIDP(G4int z) {fTrackIDP = z;}
0074 inline G4int GetTrackIDP() const {return fTrackIDP;}
0075
0076 inline void SetTime(G4double t) {fTime = t;}
0077 inline G4double GetTime() const {return fTime;}
0078
0079 inline void SetPos(G4ThreeVector xyz) {fPos = xyz;}
0080 inline G4ThreeVector GetPos() const {return fPos;}
0081
0082 inline void SetMom(G4ThreeVector xyz) {fMom = xyz;}
0083 inline G4ThreeVector GetMom() const {return fMom;}
0084
0085 inline void SetEnergy(G4double energy) {fEnergy = energy;}
0086 inline G4double GetEnergy() const {return fEnergy;}
0087
0088 inline void SetType(G4int type) {fType = type;}
0089 inline G4int GetType() const {return fType;}
0090
0091 inline void SetParticle(G4String particle) {fParticle = particle;}
0092 inline G4String GetParticle() const {return fParticle;}
0093
0094 inline void SetWeight(G4double weight) {fWeight = weight;}
0095 inline G4double GetWeight() const {return fWeight;}
0096
0097 inline void SetDetID(G4int did) {fDetID = did;}
0098 inline G4int GetDetID() const {return fDetID;}
0099
0100 private:
0101 G4int fTrackID = -1;
0102 G4int fTrackIDP = -1;
0103 G4double fTime = 0;
0104 G4ThreeVector fPos = G4ThreeVector(0., 0., 0.);
0105 G4ThreeVector fMom = G4ThreeVector(0., 0., 0.);
0106 G4double fEnergy = 0.;
0107 G4int fType = -11;
0108 G4String fParticle = "";
0109 G4double fWeight = -1;
0110 G4int fDetID = -1;
0111 };
0112
0113 using SensitiveDetectorHitsCollection = G4THitsCollection<SensitiveDetectorHit>;
0114
0115 extern G4ThreadLocal G4Allocator<SensitiveDetectorHit>* SensitiveDetectorHitAllocator;
0116
0117 inline void* SensitiveDetectorHit::operator new(size_t)
0118 {
0119 if (!SensitiveDetectorHitAllocator) SensitiveDetectorHitAllocator =
0120 new G4Allocator<SensitiveDetectorHit>;
0121 return (void *) SensitiveDetectorHitAllocator->MallocSingle();
0122 }
0123
0124 inline void SensitiveDetectorHit::operator delete(void* aHit)
0125 {
0126 SensitiveDetectorHitAllocator->FreeSingle((SensitiveDetectorHit*) aHit);
0127 }
0128
0129
0130
0131
0132 #endif