Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 //
27 // $Id$
28 //
29 //
30 //---------------------------------------------------------------
31 //
32 // G4Track.hh
33 //
34 // Class Description:
35 // This class represents the partilce under tracking.
36 // It includes information related to tracking for examples:
37 // 1) current position/time of the particle,
38 // 2) static particle information,
39 // 3) the pointer to the physical volume where currently
40 // the particle exists
41 //
42 //---------------------------------------------------------------
43 // Modification for G4TouchableHandle 22 Oct. 2001 R.Chytracek
44 // Add MaterialCutCouple 08 Oct. 2002 H.Kurashige
45 // Add SetVelocityTableProperties 02 Apr. 2011 H.Kurashige
46 // Add fVelocity and Set/GetVelocity 29 Apr. 2011 H.Kurashige
47 // Use G4VelocityTable 17 AUg. 2011 H.Kurashige
48 
49 #ifndef G4Track_h
50 #define G4Track_h 1
51 
52 #include "globals.hh" // Include from 'global'
53 #include <cmath> // Include from 'system'
54 #include "G4ThreeVector.hh" // Include from 'geometry'
55 #include "G4LogicalVolume.hh" // Include from 'geometry'
56 #include "G4VPhysicalVolume.hh" // Include from 'geometry'
57 #include "G4Allocator.hh" // Include from 'particle+matter'
58 #include "G4DynamicParticle.hh" // Include from 'particle+matter'
59 #include "G4TrackStatus.hh" // Include from 'tracking'
60 #include "G4TouchableHandle.hh" // Include from 'geometry'
62 
63 #include "G4Material.hh"
64 
65 class G4Step; // Forward declaration
67 class G4VelocityTable;
68 
70 class G4Track
72 {
73 
74 //--------
75 public: // With description
76 
77 // Constructor
78  G4Track();
79  G4Track(G4DynamicParticle* apValueDynamicParticle,
80  G4double aValueTime,
81  const G4ThreeVector& aValuePosition);
82  // aValueTime is a global time
83  G4Track(const G4Track&);
84  // Copy Constructor copys members other than tracking information
85 
86 private:
87  // Hide assignment operator as private
88  G4Track& operator=(const G4Track&);
89 
90 //--------
91 public: // With description
92 
93 // Destrcutor
94  ~G4Track();
95 
96 // Operators
97  inline void *operator new(size_t);
98  // Override "new" for "G4Allocator".
99  inline void operator delete(void *aTrack);
100  // Override "delete" for "G4Allocator".
101 
102  G4bool operator==( const G4Track& );
103 
104 //--------
105 public: // With description
106 // Copy information of the track (w/o tracking information)
107  void CopyTrackInfo(const G4Track&);
108 
109 // Get/Set functions
110  // track ID
111  G4int GetTrackID() const;
112  void SetTrackID(const G4int aValue);
113 
114  G4int GetParentID() const;
115  void SetParentID(const G4int aValue);
116 
117  // dynamic particle
118  const G4DynamicParticle* GetDynamicParticle() const;
119 
120  // particle definition
122  // following method of GetDefinition remains
123  // because of backward compatiblity. It will be removed in future
125 
126  // position, time
127  const G4ThreeVector& GetPosition() const;
128  void SetPosition(const G4ThreeVector& aValue);
129 
130  G4double GetGlobalTime() const;
131  void SetGlobalTime(const G4double aValue);
132  // Time since the event in which the track belongs is created.
133 
134  G4double GetLocalTime() const;
135  void SetLocalTime(const G4double aValue);
136  // Time since the current track is created.
137 
138  G4double GetProperTime() const;
139  void SetProperTime(const G4double aValue);
140  // Proper time of the current track
141 
142  // volume, material, touchable
143  G4VPhysicalVolume* GetVolume() const;
145 
146  G4Material* GetMaterial() const;
147  G4Material* GetNextMaterial() const;
148 
151 
152  const G4VTouchable* GetTouchable() const;
153  const G4TouchableHandle& GetTouchableHandle() const;
154  void SetTouchableHandle( const G4TouchableHandle& apValue);
155 
156  const G4VTouchable* GetNextTouchable() const;
158  void SetNextTouchableHandle( const G4TouchableHandle& apValue);
159 
160  const G4VTouchable* GetOriginTouchable() const;
162  void SetOriginTouchableHandle( const G4TouchableHandle& apValue);
163 
164  // energy
165  G4double GetKineticEnergy() const;
166  void SetKineticEnergy(const G4double aValue);
167 
168  G4double GetTotalEnergy() const;
169 
170 
171  // moemtnum
172  const G4ThreeVector& GetMomentumDirection() const;
173  void SetMomentumDirection(const G4ThreeVector& aValue);
174 
175  G4ThreeVector GetMomentum() const;
176 
177  // velocity
178  G4double GetVelocity() const;
179  void SetVelocity(G4double val);
180 
181  G4double CalculateVelocity() const;
183 
184  G4bool UseGivenVelocity() const;
185  void UseGivenVelocity(G4bool val);
186 
187  // polarization
188  const G4ThreeVector& GetPolarization() const;
189  void SetPolarization(const G4ThreeVector& aValue);
190 
191  // track status, flags for tracking
193  void SetTrackStatus(const G4TrackStatus aTrackStatus);
194 
195  G4bool IsBelowThreshold() const;
196  void SetBelowThresholdFlag(G4bool value = true);
197  // The flag of "BelowThreshold" is set to true
198  // if this track energy is below threshold energy
199  // in this material determined by the range cut value
200 
201  G4bool IsGoodForTracking() const;
202  void SetGoodForTrackingFlag(G4bool value = true);
203  // The flag of "GoodForTracking" is set by processes
204  // if this track should be tracked
205  // even if the energy is below threshold
206 
207  // track length
208  G4double GetTrackLength() const;
209  void AddTrackLength(const G4double aValue);
210  // Accumulated the track length
211 
212  // step information
213  const G4Step* GetStep() const;
214  void SetStep(const G4Step* aValue);
215 
216  G4int GetCurrentStepNumber() const;
218 
219  G4double GetStepLength() const;
221  // Before the end of the AlongStepDoIt loop,StepLength keeps
222  // the initial value which is determined by the shortest geometrical Step
223  // proposed by a physics process. After finishing the AlongStepDoIt,
224  // it will be set equal to 'StepLength' in G4Step.
225 
226  // vertex (,where this track was created) information
227  const G4ThreeVector& GetVertexPosition() const;
228  void SetVertexPosition(const G4ThreeVector& aValue);
229 
231  void SetVertexMomentumDirection(const G4ThreeVector& aValue);
232 
234  void SetVertexKineticEnergy(const G4double aValue);
235 
238 
239  const G4VProcess* GetCreatorProcess() const;
240  void SetCreatorProcess(const G4VProcess* aValue);
241 
242  // track weight
243  // These are methods for manipulating a weight for this track.
244  G4double GetWeight() const;
245  void SetWeight(G4double aValue);
246 
247  // User information
250 
251  // Velocity table
252  static void SetVelocityTableProperties(G4double t_max, G4double t_min, G4int nbin);
255  static G4int GetNbinOfVelocityTable();
256 
257 //---------
258  private:
259 //---------
260  // Member data
261  G4int fCurrentStepNumber; // Total steps number up to now
262  G4ThreeVector fPosition; // Current positon
263  G4double fGlobalTime; // Time since the event is created
264  G4double fLocalTime; // Time since the track is created
265  G4double fTrackLength; // Accumulated track length
266  G4int fParentID;
267  G4int fTrackID;
268  G4double fVelocity;
269 
270  G4TouchableHandle fpTouchable;
271  G4TouchableHandle fpNextTouchable;
272  G4TouchableHandle fpOriginTouchable;
273  // Touchable Handle
274 
275  G4DynamicParticle* fpDynamicParticle;
276  G4TrackStatus fTrackStatus;
277 
278  G4bool fBelowThreshold;
279  // This flag is set to true if this track energy is below
280  // threshold energy in this material determined by the range cut value
281  G4bool fGoodForTracking;
282  // This flag is set by processes if this track should be tracked
283  // even if the energy is below threshold
284 
285  G4double fStepLength;
286  // Before the end of the AlongStepDoIt loop, this keeps the initial
287  // Step length which is determined by the shortest geometrical Step
288  // proposed by a physics process. After finishing the AlongStepDoIt,
289  // this will be set equal to 'StepLength' in G4Step.
290 
291  G4double fWeight;
292  // This is a weight for this track
293 
294  const G4Step* fpStep;
295 
296  G4ThreeVector fVtxPosition; // (x,y,z) of the vertex
297  G4ThreeVector fVtxMomentumDirection; // Momentum direction at the vertex
298  G4double fVtxKineticEnergy; // Kinetic energy at the vertex
299  const G4LogicalVolume* fpLVAtVertex; //Logical Volume at the vertex
300  const G4VProcess* fpCreatorProcess; // Process which created the track
301 
302  G4VUserTrackInformation* fpUserInformation;
303 
304  // cached values for CalculateVelocity
305  mutable G4Material* prev_mat;
306  mutable G4MaterialPropertyVector* groupvel;
307  mutable G4double prev_velocity;
308  mutable G4double prev_momentum;
309 
310  G4bool is_OpticalPhoton;
311  static G4VelocityTable* velTable;
312 
313  G4bool useGivenVelocity;
314  // do not calclulate velocity and just use current fVelocity
315  // if this flag is set
316 
317 };
318 
319 #include "G4Track.icc"
320 
321 #endif
322 
323 
324 
325 
326 
327 
328 
329 
330 
331 
332 
333 
334 
335 
336