Geant4 Cross Reference |
1 // 1 2 // ******************************************* 3 // * License and Disclaimer 4 // * 5 // * The Geant4 software is copyright of th 6 // * the Geant4 Collaboration. It is provided 7 // * conditions of the Geant4 Software License 8 // * LICENSE and available at http://cern.ch/ 9 // * include a list of copyright holders. 10 // * 11 // * Neither the authors of this software syst 12 // * institutes,nor the agencies providing fin 13 // * work make any representation or warran 14 // * regarding this software system or assum 15 // * use. Please see the license in the file 16 // * for the full disclaimer and the limitatio 17 // * 18 // * This code implementation is the result 19 // * technical work of the GEANT4 collaboratio 20 // * By using, copying, modifying or distri 21 // * any work based on the software) you ag 22 // * use in resulting scientific publicati 23 // * acceptance of all terms of the Geant4 Sof 24 // ******************************************* 25 // 26 #ifndef PAR04HIT_HH 27 #define PAR04HIT_HH 28 29 #include "G4Allocator.hh" // for G4Allocator 30 #include "G4RotationMatrix.hh" // for G4Rotat 31 #include "G4THitsCollection.hh" // for G4THit 32 #include "G4ThreeVector.hh" // for G4ThreeVec 33 #include "G4VHit.hh" // for G4VHit 34 35 #include <G4Types.hh> // for G4int, G4double 36 #include <map> // for map 37 #include <stddef.h> // for size_t 38 #include <tls.hh> // for G4ThreadLocal 39 #include <vector> // for vector 40 class G4AttDef; 41 class G4AttValue; 42 class G4LogicalVolume; 43 class G4String; 44 45 /** 46 * @brief Hit class to store energy deposited 47 * 48 * Hit class registers position and energy dep 49 * detector. Cell ID is stored using identifie 50 * phi, rho). Additionally, pointer to cell lo 51 * rotation are saved for visualisation purpos 52 * visualisation. Type of hit allows to distin 53 * from full simulation (type 0) and fast simu 54 * 55 */ 56 57 class Par04Hit : public G4VHit 58 { 59 public: 60 Par04Hit(); 61 Par04Hit(const Par04Hit& aRight); 62 virtual ~Par04Hit(); 63 64 const Par04Hit& operator=(const Par04Hit& 65 int operator==(const Par04Hit& aRight) con 66 67 inline void* operator new(size_t); 68 inline void operator delete(void* aHit); 69 /// Visualise hits. If pointer to the logi 70 /// drawn taking into account proper radia 71 virtual void Draw() final; 72 /// Retrieve atributes' names in order to 73 virtual const std::map<G4String, G4AttDef> 74 /// Create attributes for the visualisatio 75 virtual std::vector<G4AttValue>* CreateAtt 76 /// Print hit properties. 77 virtual void Print() final; 78 /// Set position 79 inline void SetPos(G4ThreeVector aXYZ) { f 80 /// Get position 81 inline G4ThreeVector GetPos() const { retu 82 /// Set rotation 83 inline void SetRot(G4RotationMatrix aXYZ) 84 /// Get rotation 85 inline G4RotationMatrix GetRot() const { r 86 /// Set energy 87 inline void SetEdep(G4double aEdep) { fEde 88 /// Add energy to previous value 89 inline void AddEdep(G4double aEdep) { fEde 90 /// Get energy 91 inline G4double GetEdep() const { return f 92 /// Set number of deposits per hit/cell 93 inline void SetNdep(G4int aNdep) { fNdep = 94 /// Add number of deposits to previous val 95 inline void AddNdep(G4int aNdep = 1) { fNd 96 /// Get number of deposits per hit/cell 97 inline G4int GetNdep() const { return fNde 98 /// Set Z id of the cell in the readout se 99 inline void SetZid(G4int aZ) { fZId = aZ; 100 /// Get Z id of the cell in the readout se 101 inline G4int GetZid() const { return fZId; 102 /// Set Rho id of the cell in the readout 103 inline void SetRhoId(G4int aRho) { fRhoId 104 /// Get rho id of the cell in the readout 105 inline G4int GetRhoId() const { return fRh 106 /// Set phi id of the cell in the readout 107 inline void SetPhiId(G4int aPhi) { fPhiId 108 /// Get phi id of the cell in the readout 109 inline G4int GetPhiId() const { return fPh 110 /// Set time 111 inline void SetTime(G4double aTime) { fTim 112 /// Get time 113 inline G4double GetTime() const { return f 114 /// Set type (0 = full sim, 1 = fast sim) 115 inline void SetType(G4int aType) { fType = 116 /// Get type (0 = full sim, 1 = fast sim) 117 inline G4int GetType() const { return fTyp 118 // Set pointer to cell logical volume 119 inline void SetLogV(G4LogicalVolume* aLogV 120 // Get pointer to cell logical volume 121 inline const G4LogicalVolume* GetLogVol() 122 123 public: 124 /// Energy deposit 125 G4double fEdep = 0; 126 /// Counter of deposits in a hit/cell 127 G4int fNdep = 0; 128 /// Z ID of readout cell 129 G4int fZId = -1; 130 /// Rho ID of readout cell 131 G4int fRhoId = -1; 132 /// Phi ID of readout cell 133 G4int fPhiId = -1; 134 /// Position 135 G4ThreeVector fPos = {-1, -1, -1}; 136 /// Rotation 137 G4RotationMatrix fRot; 138 /// Time 139 G4double fTime = -1; 140 /// Type: 0 = full sim, 1 = fast sim 141 G4int fType = -1; 142 /// Pointer to logical volume for visualis 143 G4LogicalVolume* fLogVol = nullptr; 144 }; 145 146 typedef G4THitsCollection<Par04Hit> Par04HitsC 147 148 extern G4ThreadLocal G4Allocator<Par04Hit>* Pa 149 150 inline void* Par04Hit::operator new(size_t) 151 { 152 if (!Par04HitAllocator) Par04HitAllocator = 153 return (void*)Par04HitAllocator->MallocSingl 154 } 155 156 inline void Par04Hit::operator delete(void* aH 157 { 158 Par04HitAllocator->FreeSingle((Par04Hit*)aHi 159 } 160 161 #endif /* PAR04HIT_HH */ 162