Geant4 10.7.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4Track.hh
Go to the documentation of this file.
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26// G4Track
27//
28// Class description:
29//
30// This class describes the particle under tracking.
31// It includes information related to tracking, i.e.:
32// 1) current position/time of the particle,
33// 2) static particle information,
34// 3) the pointer to the physical volume where currently
35// the particle exists
36
37// Author: Katsuya Amako, KEK - 1995
38// Revisions: Hisaya Kurashige, 1998-2011
39// --------------------------------------------------------------------
40#ifndef G4Track_hh
41#define G4Track_hh 1
42
43#include <cmath> // Include from 'system'
44#include <map>
46
47#include "globals.hh" // Include from 'global'
48#include "trkdefs.hh" // Include DLL defs...
49#include "G4ThreeVector.hh" // Include from 'geometry'
50#include "G4LogicalVolume.hh" // Include from 'geometry'
51#include "G4VPhysicalVolume.hh" // Include from 'geometry'
52#include "G4Allocator.hh" // Include from 'particle+matter'
53#include "G4DynamicParticle.hh" // Include from 'particle+matter'
54#include "G4TrackStatus.hh" // Include from 'tracking'
55#include "G4TouchableHandle.hh" // Include from 'geometry'
58#include "G4Material.hh"
59#include "G4Profiler.hh"
60
61class G4Step; // Forward declaration
64class G4VProcess;
65
67{
68 public:
69 // the profiler aliases are only used when compiled with GEANT4_USE_TIMEMORY
71
72 G4Track();
73 // Default constructor
74 G4Track(G4DynamicParticle* apValueDynamicParticle,
75 G4double aValueTime,
76 const G4ThreeVector& aValuePosition);
77 // Constructor - aValueTime is a global time
78
79 G4Track(const G4Track&);
80 // Copy Constructor - copies members other than tracking information
81
82 ~G4Track();
83 // Destructor
84
85 inline void* operator new(std::size_t);
86 // Override "new" for "G4Allocator".
87 inline void operator delete(void* aTrack);
88 // Override "delete" for "G4Allocator".
89
90 G4Track& operator=(const G4Track&);
91 // Assignment operator
92
93 inline G4bool operator==(const G4Track&);
94 inline G4bool operator!=(const G4Track&);
95 // Equality operators
96
97 void CopyTrackInfo(const G4Track&);
98 // Copy information of the track (w/o tracking information)
99
101 void SetTrackID(const G4int aValue);
102 // Get/Set functions track ID
103
105 void SetParentID(const G4int aValue);
106
108 // Dynamic particle
109
111 // Particle definition
113 // Obsolete, for backwards compatibility...
114
116 void SetPosition(const G4ThreeVector& aValue);
117 // Position, time
118
120 void SetGlobalTime(const G4double aValue);
121 // Time since the event in which the track belongs is created
122
124 void SetLocalTime(const G4double aValue);
125 // Time since the current track is created
126
128 void SetProperTime(const G4double aValue);
129 // Proper time of the current track
130
133 // Volume, material, touchable
134
137
140
144
148
152
154 void SetKineticEnergy(const G4double aValue);
155 // Energy
156
158
161 // Momentum
162
164
167 // Velocity
168
171
174
176 void SetPolarization(const G4ThreeVector& aValue);
177 // Polarization
178
180 void SetTrackStatus(const G4TrackStatus aTrackStatus);
181 // Track status, flags for tracking
182
184 void SetBelowThresholdFlag(G4bool value = true);
185 // The flag of "BelowThreshold" is set to true
186 // If this track energy is below threshold energy
187 // in this material is determined by the range cut value
188
190 void SetGoodForTrackingFlag(G4bool value = true);
191 // The flag of "GoodForTracking" is set by processes
192 // if this track should be tracked
193 // even if the energy is below threshold
194
196 void AddTrackLength(const G4double aValue);
197 // Accumulated track length
198
199 const G4Step* GetStep() const;
200 void SetStep(const G4Step* aValue);
201 // Step information
202
205
208 // Before the end of the AlongStepDoIt() loop, StepLength keeps
209 // the initial value which is determined by the shortest geometrical Step
210 // proposed by a physics process. After finishing the AlongStepDoIt(),
211 // it will be set equal to 'StepLength' in G4Step
212
214 void SetVertexPosition(const G4ThreeVector& aValue);
215 // Vertex (where this track was created) information
216
219
222
225
227 void SetCreatorProcess(const G4VProcess* aValue);
228
229 inline void SetCreatorModelIndex(G4int idx);
230
231 inline const G4String& GetCreatorModelName() const;
232
233 inline G4int GetCreatorModelID() const;
234
236 void SetWeight(G4double aValue);
237 // Track weight; methods for manipulating a weight for this track
238
241 // User information
242
244 G4VAuxiliaryTrackInformation* info) const;
246 inline std::map<G4int, G4VAuxiliaryTrackInformation*>*
248
251 // Note: G4VAuxiliaryTrackInformation object itself is *NOT* deleted
252
253 private:
254
255 void ClearAuxiliaryTrackInformation();
256
257 // Member data
258
259 G4ThreeVector fPosition;
260 // Current positon
261 G4double fGlobalTime = 0.0;
262 // Time since the event is created
263 G4double fLocalTime = 0.0;
264 // Time since the track is created
265 G4double fTrackLength = 0.0;
266 // Accumulated track length
267
268 G4double fVelocity = 0.0;
269
270 G4TouchableHandle fpTouchable;
271 G4TouchableHandle fpNextTouchable;
272 G4TouchableHandle fpOriginTouchable;
273 // Touchable Handle
274
275 G4DynamicParticle* fpDynamicParticle = nullptr;
276 G4TrackStatus fTrackStatus = fAlive;
277
278 G4double fStepLength = 0.0;
279 // Before the end of the AlongStepDoIt loop, this keeps the initial
280 // Step length which is determined by the shortest geometrical Step
281 // proposed by a physics process. After finishing the AlongStepDoIt,
282 // this will be set equal to 'StepLength' in G4Step.
283
284 G4double fWeight = 1.0;
285 // This is a weight for this track
286
287 const G4Step* fpStep = nullptr;
288
289 G4ThreeVector fVtxPosition;
290 // (x,y,z) of the vertex
291 G4ThreeVector fVtxMomentumDirection;
292 // Momentum direction at the vertex
293 G4double fVtxKineticEnergy = 0.0;
294 // Kinetic energy at the vertex
295 const G4LogicalVolume* fpLVAtVertex = nullptr;
296 // Logical Volume at the vertex
297 const G4VProcess* fpCreatorProcess = nullptr;
298 // Process which created the track
299
300 mutable G4VUserTrackInformation* fpUserInformation = nullptr;
301
302 mutable G4Material* prev_mat = nullptr;
303 mutable G4MaterialPropertyVector* groupvel = nullptr;
304 mutable G4double prev_velocity = 0.0;
305 mutable G4double prev_momentum = 0.0;
306 // cached values for CalculateVelocity
307
308 mutable std::map<G4int, G4VAuxiliaryTrackInformation*>*
309 fpAuxiliaryTrackInformationMap = nullptr;
310
311 G4int fCurrentStepNumber = 0;
312 // Total steps number up to now
313
314 G4int fCreatorModelIndex = -1;
315 // Index of the physics model which created the track
316
317 G4int fParentID = 0;
318 G4int fTrackID = 0;
319
320 G4bool fBelowThreshold = false;
321 // This flag is set to true if this track energy is below
322 // threshold energy in this material determined by the range cut value
323 G4bool fGoodForTracking = false;
324 // This flag is set by processes if this track should be tracked
325 // even if the energy is below threshold
326
327 G4bool is_OpticalPhoton = false;
328
329 G4bool useGivenVelocity = false;
330 // do not calculate velocity and just use current fVelocity
331 // if this flag is set
332};
333
334#include "G4Track.icc"
335
336#endif
G4TrackStatus
@ fAlive
double G4double
Definition: G4Types.hh:83
bool G4bool
Definition: G4Types.hh:86
int G4int
Definition: G4Types.hh:85
Definition: G4Step.hh:62
void SetVelocity(G4double val)
G4Material * GetNextMaterial() const
G4TrackStatus GetTrackStatus() const
std::map< G4int, G4VAuxiliaryTrackInformation * > * GetAuxiliaryTrackInformationMap() const
void SetTrackStatus(const G4TrackStatus aTrackStatus)
void SetStepLength(G4double value)
const G4String & GetCreatorModelName() const
void SetAuxiliaryTrackInformation(G4int idx, G4VAuxiliaryTrackInformation *info) const
Definition: G4Track.cc:198
void SetPosition(const G4ThreeVector &aValue)
G4double GetVelocity() const
void SetPolarization(const G4ThreeVector &aValue)
G4double CalculateVelocityForOpticalPhoton() const
Definition: G4Track.cc:149
const G4MaterialCutsCouple * GetNextMaterialCutsCouple() const
G4double GetVertexKineticEnergy() const
G4int GetTrackID() const
void SetStep(const G4Step *aValue)
const G4ParticleDefinition * GetParticleDefinition() const
G4VPhysicalVolume * GetVolume() const
void SetVertexPosition(const G4ThreeVector &aValue)
const G4TouchableHandle & GetNextTouchableHandle() const
const G4VProcess * GetCreatorProcess() const
void SetVertexMomentumDirection(const G4ThreeVector &aValue)
const G4LogicalVolume * GetLogicalVolumeAtVertex() const
G4VPhysicalVolume * GetNextVolume() const
void SetNextTouchableHandle(const G4TouchableHandle &apValue)
G4bool UseGivenVelocity() const
void CopyTrackInfo(const G4Track &)
Definition: G4Track.cc:143
G4double GetWeight() const
G4int GetCreatorModelID() const
void SetWeight(G4double aValue)
const G4ThreeVector & GetPosition() const
G4double GetTrackLength() const
void SetTouchableHandle(const G4TouchableHandle &apValue)
const G4ThreeVector & GetVertexMomentumDirection() const
G4double GetGlobalTime() const
G4double GetProperTime() const
G4int GetCurrentStepNumber() const
G4ThreeVector GetMomentum() const
const G4ThreeVector & GetVertexPosition() const
const G4VTouchable * GetOriginTouchable() const
G4double GetLocalTime() const
void SetOriginTouchableHandle(const G4TouchableHandle &apValue)
G4Material * GetMaterial() const
G4ParticleDefinition * GetDefinition() const
void SetLocalTime(const G4double aValue)
void AddTrackLength(const G4double aValue)
const G4DynamicParticle * GetDynamicParticle() const
G4bool operator!=(const G4Track &)
const G4TouchableHandle & GetTouchableHandle() const
const G4ThreeVector & GetMomentumDirection() const
G4VUserTrackInformation * GetUserInformation() const
G4double GetKineticEnergy() const
G4double CalculateVelocity() const
const G4ThreeVector & GetPolarization() const
G4Track()
Definition: G4Track.cc:63
void RemoveAuxiliaryTrackInformation(G4int idx)
Definition: G4Track.cc:230
void SetUserInformation(G4VUserTrackInformation *aValue) const
void SetBelowThresholdFlag(G4bool value=true)
G4double GetStepLength() const
void UseGivenVelocity(G4bool val)
void SetVertexKineticEnergy(const G4double aValue)
G4VAuxiliaryTrackInformation * GetAuxiliaryTrackInformation(G4int idx) const
Definition: G4Track.cc:218
void SetTrackID(const G4int aValue)
G4int GetParentID() const
void IncrementCurrentStepNumber()
void SetKineticEnergy(const G4double aValue)
G4bool IsBelowThreshold() const
void SetMomentumDirection(const G4ThreeVector &aValue)
const G4TouchableHandle & GetOriginTouchableHandle() const
void SetLogicalVolumeAtVertex(const G4LogicalVolume *)
const G4MaterialCutsCouple * GetMaterialCutsCouple() const
const G4VTouchable * GetNextTouchable() const
G4bool operator==(const G4Track &)
const G4VTouchable * GetTouchable() const
G4double GetTotalEnergy() const
const G4Step * GetStep() const
G4bool IsGoodForTracking() const
G4Track & operator=(const G4Track &)
Definition: G4Track.cc:84
void SetProperTime(const G4double aValue)
void SetGlobalTime(const G4double aValue)
~G4Track()
Definition: G4Track.cc:76
void SetParentID(const G4int aValue)
void SetCreatorModelIndex(G4int idx)
void SetGoodForTrackingFlag(G4bool value=true)
void SetCreatorProcess(const G4VProcess *aValue)