Geant4 Cross Reference |
>> 1 // This code implementation is the intellectual property of >> 2 // the GEANT4 collaboration. 1 // 3 // 2 // ******************************************* << 4 // By copying, distributing or modifying the Program (or any work 3 // * License and Disclaimer << 5 // based on the Program) you indicate your acceptance of this statement, 4 // * << 6 // and all its terms. 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 // 7 // 26 // G4Track << 8 // $Id: G4Track.hh,v 1.9 2000/10/18 15:00:09 kurasige Exp $ >> 9 // GEANT4 tag $Name: geant4-03-00 $ 27 // 10 // 28 // Class description: << 29 // 11 // 30 // This class describes the particle under tra << 12 //--------------------------------------------------------------- 31 // It includes information related to tracking << 13 // >> 14 // G4Track.hh >> 15 // >> 16 // Class Description: >> 17 // This class represents the partilce under tracking. >> 18 // It includes information related to tracking for examples: 32 // 1) current position/time of the particl 19 // 1) current position/time of the particle, 33 // 2) static particle information, 20 // 2) static particle information, 34 // 3) the pointer to the physical volume w 21 // 3) the pointer to the physical volume where currently 35 // the particle exists << 22 // the particle exists, >> 23 // >> 24 // Contact: >> 25 // Questions and comments to this code should be sent to >> 26 // Katsuya Amako (e-mail: Katsuya.Amako@kek.jp) >> 27 // Takashi Sasaki (e-mail: Takashi.Sasaki@kek.jp) >> 28 // >> 29 //--------------------------------------------------------------- >> 30 >> 31 #ifndef G4Track_h >> 32 #define G4Track_h 1 36 33 37 // Author: Katsuya Amako, KEK - 1995 << 34 #include "globals.hh" // Include from 'global' 38 // Revisions: Hisaya Kurashige, 1998-2011 << 35 #include "G4ThreeVector.hh" // Include from 'geometry' 39 // ------------------------------------------- << 36 #include "G4LogicalVolume.hh" // Include from 'geometry' 40 #ifndef G4Track_hh << 37 #include "G4VPhysicalVolume.hh" // Include from 'geometry' 41 #define G4Track_hh 1 << 38 #include "G4Allocator.hh" // Include from 'particle+matter' 42 << 39 #include "G4DynamicParticle.hh" // Include from 'particle+matter' 43 #include <cmath> // Include from 'system' << 40 #include "G4TrackStatus.hh" // Include from 'tracking' 44 #include <map> << 41 #include "G4VTouchable.hh" // Include from 'geometry' 45 #include <CLHEP/Units/PhysicalConstants.h> << 46 << 47 #include "globals.hh" // Include fr << 48 #include "trkdefs.hh" // Include DL << 49 #include "G4ThreeVector.hh" // Include fr << 50 #include "G4LogicalVolume.hh" // Include fr << 51 #include "G4VPhysicalVolume.hh" // Include fr << 52 #include "G4Allocator.hh" // Include fr << 53 #include "G4DynamicParticle.hh" // Include fr << 54 #include "G4TrackStatus.hh" // Include fr << 55 #include "G4TouchableHandle.hh" // Include fr << 56 #include "G4VUserTrackInformation.hh" 42 #include "G4VUserTrackInformation.hh" 57 #include "G4PhysicsModelCatalog.hh" << 43 58 #include "G4Material.hh" 44 #include "G4Material.hh" 59 45 60 class G4Step; // Forward declaration << 46 class G4Step; // Forward declaration 61 class G4MaterialCutsCouple; << 62 class G4VAuxiliaryTrackInformation; << 63 class G4VProcess; << 64 47 >> 48 ////////////// 65 class G4Track 49 class G4Track >> 50 ////////////// 66 { 51 { 67 public: << 68 G4Track(); << 69 // Default constructor << 70 G4Track(G4DynamicParticle* apValueDynamicP << 71 G4double aValueTime, << 72 const G4ThreeVector& aValuePositio << 73 // Constructor - aValueTime is a global << 74 52 75 G4Track(const G4Track&,G4bool copyTouchabl << 53 //-------- 76 // Copy Constructor - copies members oth << 54 public: // With description >> 55 >> 56 // Constructor >> 57 G4Track(); >> 58 G4Track(G4DynamicParticle* apValueDynamicParticle, >> 59 G4double aValueTime, >> 60 const G4ThreeVector& aValuePosition); >> 61 // aValueTime is a global time 77 62 78 ~G4Track(); << 63 //-------- 79 // Destructor << 64 public: 80 65 81 inline void* operator new(std::size_t); << 66 // Destrcutor >> 67 ~G4Track(); >> 68 >> 69 // Operators >> 70 inline void *operator new(size_t); 82 // Override "new" for "G4Allocator". 71 // Override "new" for "G4Allocator". 83 inline void operator delete(void* aTrack); << 72 inline void operator delete(void *aTrack); 84 // Override "delete" for "G4Allocator". 73 // Override "delete" for "G4Allocator". 85 74 86 G4Track& operator=(const G4Track&); << 75 int operator==( const G4Track& s); 87 // Assignment operator << 76 // Define "==" operator because "G4TrackVector" uses 88 << 77 //"RWPtrOrderdVector" which requires this. 89 inline G4bool operator==(const G4Track&); << 90 inline G4bool operator!=(const G4Track&); << 91 // Equality operators << 92 78 93 void CopyTrackInfo(const G4Track&, G4bool << 79 //-------- 94 // Copy information of the track (w/o tr << 80 public: // With description 95 81 96 inline G4int GetTrackID() const; << 82 // Get/Set functions 97 inline void SetTrackID(const G4int aValue) << 83 // track ID 98 // Get/Set functions track ID << 84 G4int GetTrackID() const; >> 85 void SetTrackID(const G4int aValue); 99 86 100 inline G4int GetParentID() const; << 87 G4int GetParentID() const; 101 inline void SetParentID(const G4int aValue << 88 void SetParentID(const G4int aValue); 102 89 103 inline const G4DynamicParticle* GetDynamic << 90 // dynamic particle 104 // Dynamic particle << 91 const G4DynamicParticle* GetDynamicParticle() const; 105 92 106 inline const G4ParticleDefinition* GetPart << 93 // particle definition 107 // Particle definition << 94 G4ParticleDefinition* GetDefinition() const; 108 inline G4ParticleDefinition* GetDefinition << 109 // Obsolete, for backwards compatibility << 110 95 111 inline const G4ThreeVector& GetPosition() << 96 // position, time 112 inline void SetPosition(const G4ThreeVecto << 97 const G4ThreeVector& GetPosition() const; 113 // Position, time << 98 void SetPosition(const G4ThreeVector& aValue); 114 99 115 inline G4double GetGlobalTime() const; << 100 G4double GetGlobalTime() const; 116 inline void SetGlobalTime(const G4double a << 101 void SetGlobalTime(const G4double aValue); 117 // Time since the event in which the tra << 102 // Time since the event in which the track belongs is created. 118 103 119 inline G4double GetLocalTime() const; << 104 G4double GetLocalTime() const; 120 inline void SetLocalTime(const G4double aV << 105 void SetLocalTime(const G4double aValue); 121 // Time since the current track is creat << 106 // Time since the current track is created. 122 107 123 inline G4double GetProperTime() const; << 108 G4double GetProperTime() const; 124 inline void SetProperTime(const G4double a << 109 void SetProperTime(const G4double aValue); 125 // Proper time of the current track 110 // Proper time of the current track 126 111 127 inline G4VPhysicalVolume* GetVolume() cons << 112 // volume, material, touchable 128 inline G4VPhysicalVolume* GetNextVolume() << 113 G4VPhysicalVolume* GetVolume() const; 129 // Volume, material, touchable << 114 G4VPhysicalVolume* GetNextVolume() const; 130 << 115 131 inline G4Material* GetMaterial() const; << 116 G4Material* GetMaterial() const; 132 inline G4Material* GetNextMaterial() const << 117 G4Material* GetNextMaterial() const; 133 << 118 134 inline const G4MaterialCutsCouple* GetMate << 119 const G4VTouchable* GetTouchable() const; 135 inline const G4MaterialCutsCouple* GetNext << 120 void SetTouchable(const G4VTouchable* apValue); 136 << 121 137 inline const G4VTouchable* GetTouchable() << 122 const G4VTouchable* GetNextTouchable() const; 138 inline const G4TouchableHandle& GetTouchab << 123 void SetNextTouchable(const G4VTouchable* apValue); 139 inline void SetTouchableHandle(const G4Tou << 124 140 << 125 // energy 141 inline const G4VTouchable* GetNextTouchabl << 126 G4double GetKineticEnergy() const; 142 inline const G4TouchableHandle& GetNextTou << 127 void SetKineticEnergy(const G4double aValue); 143 inline void SetNextTouchableHandle(const G << 128 144 << 129 G4double GetTotalEnergy() const; 145 inline const G4VTouchable* GetOriginToucha << 130 146 inline const G4TouchableHandle& GetOriginT << 147 inline void SetOriginTouchableHandle(const << 148 << 149 inline G4double GetKineticEnergy() const; << 150 inline G4double GetTotalEnergy() const; << 151 inline void SetKineticEnergy(const G4doubl << 152 // Energy << 153 << 154 inline G4ThreeVector GetMomentum() const; << 155 inline const G4ThreeVector& GetMomentumDir << 156 inline void SetMomentumDirection(const G4T << 157 // Momentum << 158 << 159 inline G4double GetVelocity() const; << 160 inline void SetVelocity(G4double val); << 161 // Velocity << 162 << 163 inline G4double CalculateVelocity() const; << 164 G4double CalculateVelocityForOpticalPhoton << 165 << 166 inline G4bool UseGivenVelocity() const; << 167 inline void UseGivenVelocity(G4bool val); << 168 << 169 inline const G4ThreeVector& GetPolarizatio << 170 inline void SetPolarization(const G4ThreeV << 171 // Polarization << 172 << 173 inline G4TrackStatus GetTrackStatus() cons << 174 inline void SetTrackStatus(const G4TrackSt << 175 // Track status, flags for tracking << 176 << 177 inline G4bool IsBelowThreshold() const; << 178 inline void SetBelowThresholdFlag(G4bool v << 179 // The flag of "BelowThreshold" is set t << 180 // If this track energy is below thresho << 181 // in this material is determined by the << 182 << 183 inline G4bool IsGoodForTracking() const; << 184 inline void SetGoodForTrackingFlag(G4bool << 185 // The flag of "GoodForTracking" is set << 186 // if this track should be tracked << 187 // even if the energy is below threshold << 188 << 189 inline G4double GetTrackLength() const; << 190 inline void AddTrackLength(const G4double << 191 // Accumulated track length << 192 << 193 inline const G4Step* GetStep() const; << 194 inline void SetStep(const G4Step* aValue); << 195 // Step information << 196 << 197 inline G4int GetCurrentStepNumber() const; << 198 inline void IncrementCurrentStepNumber(); << 199 << 200 inline G4double GetStepLength() const; << 201 inline void SetStepLength(G4double value); << 202 // Before the end of the AlongStepDoIt() << 203 // the initial value which is determined << 204 // proposed by a physics process. After << 205 // it will be set equal to 'StepLength' << 206 << 207 inline const G4ThreeVector& GetVertexPosit << 208 inline void SetVertexPosition(const G4Thre << 209 // Vertex (where this track was created) << 210 << 211 inline const G4ThreeVector& GetVertexMomen << 212 inline void SetVertexMomentumDirection(con << 213 << 214 inline G4double GetVertexKineticEnergy() c << 215 inline void SetVertexKineticEnergy(const G << 216 << 217 inline const G4LogicalVolume* GetLogicalVo << 218 inline void SetLogicalVolumeAtVertex(const << 219 << 220 inline const G4VProcess* GetCreatorProcess << 221 inline void SetCreatorProcess(const G4VPro << 222 << 223 inline void SetCreatorModelID(const G4int << 224 inline G4int GetCreatorModelID() const; << 225 inline G4int GetCreatorModelIndex() const; << 226 inline const G4String GetCreatorModelName( << 227 // Identification of the physics model t << 228 // each of the three information (ID, in << 229 // (the model ID and its name are suppos << 230 // code, whereas the index is meant for << 231 << 232 inline const G4ParticleDefinition* GetPare << 233 inline void SetParentResonanceDef(const G4 << 234 inline G4int GetParentResonanceID() const; << 235 inline void SetParentResonanceID(const G4i << 236 inline G4bool HasParentResonance() const; << 237 inline G4int GetParentResonancePDGEncoding << 238 inline G4String GetParentResonanceName() c << 239 inline G4double GetParentResonanceMass() c << 240 // Because short-lived resonances (e.g. << 241 // do not have corresponding track objec << 242 // by a resonance parent, these methods << 243 // regarding this short-lived parent. << 244 // The ID is a unique (integer) identifi << 245 // corresponds to the rounded integer of << 246 // in keV), which allows to know if two << 247 // from the same parent resonance: this << 248 // the parent-track-ID (fParentID) which << 249 // ancestor which is not a short-lived r << 250 // a corresponding track object). << 251 // In the case of a track non originatin << 252 // the above "Get" methods return, respe << 253 // 0, "", 0. << 254 << 255 inline G4double GetWeight() const; << 256 inline void SetWeight(G4double aValue); << 257 // Track weight; methods for manipulatin << 258 << 259 inline G4VUserTrackInformation* GetUserInf << 260 inline void SetUserInformation(G4VUserTrac << 261 // User information << 262 << 263 void SetAuxiliaryTrackInformation(G4int id << 264 G4VAuxil << 265 G4VAuxiliaryTrackInformation* GetAuxiliary << 266 inline std::map<G4int, G4VAuxiliaryTrackIn << 267 GetAuxiliaryTrackInformationMap() c << 268 << 269 void RemoveAuxiliaryTrackInformation(G4int << 270 void RemoveAuxiliaryTrackInformation(G4Str << 271 // Note: G4VAuxiliaryTrackInformation ob << 272 << 273 private: << 274 << 275 void ClearAuxiliaryTrackInformation(); << 276 << 277 // Member data << 278 << 279 G4ThreeVector fPosition; << 280 // Current positon << 281 G4double fGlobalTime = 0.0; << 282 // Time since the event is created << 283 G4double fLocalTime = 0.0; << 284 // Time since the track is created << 285 G4double fTrackLength = 0.0; << 286 // Accumulated track length << 287 131 288 G4double fVelocity = 0.0; << 132 // moemtnum >> 133 const G4ThreeVector& GetMomentumDirection() const; >> 134 void SetMomentumDirection(const G4ThreeVector& aValue); >> 135 >> 136 G4ThreeVector GetMomentum() const; >> 137 >> 138 G4double GetVelocity() const; >> 139 >> 140 >> 141 // polarization >> 142 const G4ThreeVector& GetPolarization() const; >> 143 void SetPolarization(const G4ThreeVector& aValue); >> 144 >> 145 // track status, flags for tracking >> 146 G4TrackStatus GetTrackStatus() const; >> 147 void SetTrackStatus(const G4TrackStatus aTrackStatus); >> 148 >> 149 G4bool IsBelowThreshold() const; >> 150 void SetBelowThresholdFlag(G4bool value = true); >> 151 // The flag of "BelowThreshold" is set to true >> 152 // if this track energy is below threshold energy >> 153 // in this material determined by the range cut value >> 154 >> 155 G4bool IsGoodForTracking() const; >> 156 void SetGoodForTrackingFlag(G4bool value = true); >> 157 // The flag of "GoodForTracking" is set by processes >> 158 // if this track should be tracked >> 159 // even if the energy is below threshold >> 160 >> 161 // track length >> 162 G4double GetTrackLength() const; >> 163 void AddTrackLength(const G4double aValue); >> 164 // Accumulated the track length >> 165 >> 166 // step information >> 167 const G4Step* GetStep() const; >> 168 void SetStep(const G4Step* aValue); >> 169 >> 170 G4int GetCurrentStepNumber() const; >> 171 void IncrementCurrentStepNumber(); >> 172 >> 173 G4double GetStepLength() const; >> 174 void SetStepLength(G4double value); >> 175 // Before the end of the AlongStepDoIt loop,StepLength keeps >> 176 // the initial value which is determined by the shortest geometrical Step >> 177 // proposed by a physics process. After finishing the AlongStepDoIt, >> 178 // it will be set equal to 'StepLength' in G4Step. 289 179 290 G4TouchableHandle fpTouchable; << 180 // vertex (,where this track was created) information 291 G4TouchableHandle fpNextTouchable; << 181 const G4ThreeVector& GetVertexPosition() const; 292 G4TouchableHandle fpOriginTouchable; << 182 void SetVertexPosition(const G4ThreeVector& aValue); 293 // Touchable Handle << 183 294 << 184 const G4ThreeVector& GetVertexMomentumDirection() const; 295 G4DynamicParticle* fpDynamicParticle = nul << 185 void SetVertexMomentumDirection(const G4ThreeVector& aValue); 296 mutable G4TrackStatus fTrackStatus = fAliv << 186 297 << 187 G4double GetVertexKineticEnergy() const; 298 G4double fStepLength = 0.0; << 188 void SetVertexKineticEnergy(const G4double aValue); 299 // Before the end of the AlongStepDoIt l << 189 300 // Step length which is determined by th << 190 G4LogicalVolume* GetLogicalVolumeAtVertex() const; >> 191 void SetLogicalVolumeAtVertex(G4LogicalVolume* ); >> 192 >> 193 const G4VProcess* GetCreatorProcess() const; >> 194 void SetCreatorProcess(G4VProcess* aValue); >> 195 >> 196 // track weight >> 197 // These are methods for manipulating a weight for this track. >> 198 // The track weight is used by G4VEvtBiasMechanism >> 199 // to execute inclusive simulation for hadronic/electomagnetic shower >> 200 // and neutron transportation etc. >> 201 G4double GetWeight() const; >> 202 void SetWeight(G4double aValue); >> 203 >> 204 // User information >> 205 G4VUserTrackInformation* GetUserInformation() const; >> 206 void SetUserInformation(G4VUserTrackInformation* aValue); >> 207 >> 208 //--------- >> 209 private: >> 210 //--------- >> 211 >> 212 // Member data >> 213 G4int fCurrentStepNumber; // Total steps number up to now >> 214 G4ThreeVector fPosition; // Current positon >> 215 G4double fGlobalTime; // Time since the event is created >> 216 G4double fLocalTime; // Time since the track is created >> 217 G4double fTrackLength; // Accumulated track length >> 218 G4int fParentID; >> 219 G4int fTrackID; >> 220 >> 221 const G4VTouchable* fpTouchable; >> 222 const G4VTouchable* fpNextTouchable; >> 223 >> 224 G4DynamicParticle* fpDynamicParticle; >> 225 G4TrackStatus fTrackStatus; >> 226 >> 227 G4bool fBelowThreshold; >> 228 // This flag is set to true if this track energy is below >> 229 // threshold energy in this material determined by the range cut value >> 230 G4bool fGoodForTracking; >> 231 // This flag is set by processes if this track should be tracked >> 232 // even if the energy is below threshold >> 233 >> 234 G4double fStepLength; >> 235 // Before the end of the AlongStepDoIt loop, this keeps the initial >> 236 // Step length which is determined by the shortest geometrical Step 301 // proposed by a physics process. After 237 // proposed by a physics process. After finishing the AlongStepDoIt, 302 // this will be set equal to 'StepLength 238 // this will be set equal to 'StepLength' in G4Step. 303 239 304 G4double fWeight = 1.0; << 240 G4double fWeight; 305 // This is a weight for this track << 241 // This is a weight for this track used by G4VEvtBiasMechanism >> 242 // to execute inclusive simulation for hadronic/electomagnetic shower >> 243 // and neutron transportation etc. >> 244 >> 245 const G4Step* fpStep; >> 246 >> 247 G4ThreeVector fVtxPosition; // (x,y,z) of the vertex >> 248 G4ThreeVector fVtxMomentumDirection; // Momentum direction at the vertex >> 249 G4double fVtxKineticEnergy; // Kinetic energy at the vertex >> 250 G4LogicalVolume* fpLVAtVertex; //Logical Volume at the vertex >> 251 G4VProcess* fpCreatorProcess; // Process which created the track >> 252 >> 253 G4VUserTrackInformation* fpUserInformation; >> 254 }; >> 255 #include "G4Step.hh" >> 256 #include "G4Track.icc" >> 257 >> 258 #endif >> 259 >> 260 >> 261 >> 262 >> 263 >> 264 >> 265 >> 266 >> 267 >> 268 306 269 307 const G4Step* fpStep = nullptr; << 308 270 309 G4ThreeVector fVtxPosition; << 310 // (x,y,z) of the vertex << 311 G4ThreeVector fVtxMomentumDirection; << 312 // Momentum direction at the vertex << 313 G4double fVtxKineticEnergy = 0.0; << 314 // Kinetic energy at the vertex << 315 const G4LogicalVolume* fpLVAtVertex = null << 316 // Logical Volume at the vertex << 317 const G4VProcess* fpCreatorProcess = nullp << 318 // Process which created the track << 319 << 320 mutable G4VUserTrackInformation* fpUserInf << 321 << 322 mutable G4Material* prev_mat = nullptr; << 323 mutable G4MaterialPropertyVector* groupvel << 324 mutable G4double prev_velocity = 0.0; << 325 mutable G4double prev_momentum = 0.0; << 326 // cached values for CalculateVelocity << 327 << 328 mutable std::map<G4int, G4VAuxiliaryTrackI << 329 fpAuxiliaryTrackInformationMap = n << 330 << 331 G4int fCurrentStepNumber = 0; << 332 // Total steps number up to now << 333 << 334 G4int fCreatorModelID = -1; << 335 // ID of the physics model which created << 336 << 337 const G4ParticleDefinition* fParentResonan << 338 // Pointer to the particle definition of << 339 // in the case that the track is produce << 340 // (which does not have a corresponding << 341 G4int fParentResonanceID = 0; << 342 // Unique ID for the parent resonance, i << 343 // is produced by a resonance parent, el << 344 << 345 G4int fParentID = 0; << 346 G4int fTrackID = 0; << 347 << 348 G4bool fBelowThreshold = false; << 349 // This flag is set to true if this trac << 350 // threshold energy in this material det << 351 G4bool fGoodForTracking = false; << 352 // This flag is set by processes if this << 353 // even if the energy is below threshold << 354 << 355 G4bool is_OpticalPhoton = false; << 356 << 357 G4bool useGivenVelocity = false; << 358 // do not calculate velocity and just us << 359 // if this flag is set << 360 271 361 G4bool fCopyTouchables = true; << 362 }; << 363 272 364 #include "G4Track.icc" << 365 273 366 #endif << 367 274