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