Geant4  10.00.p03
G4Track.icc
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: G4Track.icc 69005 2013-04-15 09:26:47Z gcosmo $
28 //
29 //-----------------------------------------------------------------
30 // Definitions of inline functions
31 //-----------------------------------------------------------------
32 // change GetMaterial 16 Feb. 2000 H.Kurashige
33 
34 extern G4TRACK_DLL G4ThreadLocal G4Allocator<G4Track> *aTrackAllocator;
35 
36 //-------------------------------------------------------------
37 // To implement bi-directional association between G4Step and
38 // and G4Track, a combined usage of 'forward declaration' and
39 // 'include' is necessary.
40 //-------------------------------------------------------------
41 #include "G4Step.hh"
42 
43 // Operators
44 
45  inline void* G4Track::operator new(size_t)
46  {
47  if (!aTrackAllocator) aTrackAllocator = new G4Allocator<G4Track>;
48  return (void *) aTrackAllocator->MallocSingle();
49  }
50  // Override "new" for "G4Allocator".
51 
52  inline void G4Track::operator delete(void *aTrack)
53  { aTrackAllocator->FreeSingle((G4Track *) aTrack); }
54  // Override "delete" for "G4Allocator".
55 
56  inline G4bool G4Track::operator==( const G4Track& trk)
57  { return (this==&trk); }
58  // Define "==" operator because "G4TrackVector" uses
59  // "RWPtrOrderdVector" which requires this.
60 
61 // Get/Set functions
62 // dynamic particle
63  inline const G4DynamicParticle* G4Track::GetDynamicParticle() const
64  { return fpDynamicParticle; }
65 
66 // particle definition
67  inline G4ParticleDefinition* G4Track::GetDefinition() const
68  { return fpDynamicParticle->GetDefinition(); }
69 
70 // particle definition
71  inline const G4ParticleDefinition* G4Track::GetParticleDefinition() const
72  { return fpDynamicParticle->GetParticleDefinition(); }
73 
74 // parent track ID
75  inline G4int G4Track::GetParentID() const
76  { return fParentID; }
77 
78  inline void G4Track::SetParentID(const G4int aValue)
79  { fParentID = aValue; }
80 
81 // current track ID
82  inline G4int G4Track::GetTrackID() const
83  { return fTrackID; }
84 
85  inline void G4Track::SetTrackID(const G4int aValue)
86  { fTrackID = aValue; }
87 
88 // position
89  inline const G4ThreeVector& G4Track::GetPosition() const
90  { return fPosition; }
91 
92  inline void G4Track::SetPosition(const G4ThreeVector& aValue)
93  { fPosition = aValue; }
94 
95 // global time
96  inline G4double G4Track::GetGlobalTime() const
97  { return fGlobalTime; }
98 
99  inline void G4Track::SetGlobalTime(const G4double aValue)
100  { fGlobalTime = aValue; }
101  // Time since the event in which the track belongs is created.
102 
103 // local time
104  inline G4double G4Track::GetLocalTime() const
105  { return fLocalTime; }
106 
107  inline void G4Track::SetLocalTime(const G4double aValue)
108  { fLocalTime = aValue; }
109  // Time since the current track is created.
110 
111 // proper time
112  inline G4double G4Track::GetProperTime() const
113  { return fpDynamicParticle->GetProperTime(); }
114 
115  inline void G4Track::SetProperTime(const G4double aValue)
116  { fpDynamicParticle->SetProperTime(aValue); }
117  // Proper time of the current track
118 
119 // velocity
120  inline G4double G4Track::GetVelocity() const
121  { return fVelocity; }
122 
123  inline void G4Track::SetVelocity(G4double val)
124  { fVelocity = val; }
125 
126  inline G4bool G4Track::UseGivenVelocity() const
127  { return useGivenVelocity;}
128 
129  inline void G4Track::UseGivenVelocity(G4bool val)
130  { useGivenVelocity = val;}
131 
132 
133 // volume
134  inline G4VPhysicalVolume* G4Track::GetVolume() const
135  { if ( fpTouchable ==0 ) return 0;
136  return fpTouchable->GetVolume(); }
137 
138  inline G4VPhysicalVolume* G4Track::GetNextVolume() const
139  { if ( fpNextTouchable ==0 ) return 0;
140  return fpNextTouchable->GetVolume(); }
141 
142 // material
143  inline
144  const G4MaterialCutsCouple* G4Track::GetMaterialCutsCouple() const
145  { return fpStep->GetPreStepPoint()->GetMaterialCutsCouple(); }
146 
147  inline
148  const G4MaterialCutsCouple* G4Track::GetNextMaterialCutsCouple() const
149  { return fpStep->GetPostStepPoint()->GetMaterialCutsCouple(); }
150 
151 // material
152  inline G4Material* G4Track::GetMaterial() const
153  { return fpStep->GetPreStepPoint()->GetMaterial(); }
154 
155  inline G4Material* G4Track::GetNextMaterial() const
156  { return fpStep->GetPostStepPoint()->GetMaterial(); }
157 
158 
159 // touchable
160  inline const G4VTouchable* G4Track::GetTouchable() const
161  { return fpTouchable(); }
162 
163  inline const G4TouchableHandle& G4Track::GetTouchableHandle() const
164  { return fpTouchable; }
165 
166  inline void G4Track::SetTouchableHandle( const G4TouchableHandle& apValue)
167  { fpTouchable = apValue; }
168 
169  inline const G4VTouchable* G4Track::GetNextTouchable() const
170  { return fpNextTouchable(); }
171 
172  inline const G4TouchableHandle& G4Track::GetNextTouchableHandle() const
173  { return fpNextTouchable; }
174 
175  inline void G4Track::SetNextTouchableHandle( const G4TouchableHandle& apValue)
176  { fpNextTouchable = apValue; }
177 
178  inline const G4VTouchable* G4Track::GetOriginTouchable() const
179  { return fpOriginTouchable(); }
180 
181  inline const G4TouchableHandle& G4Track::GetOriginTouchableHandle() const
182  { return fpOriginTouchable; }
183 
184  inline void G4Track::SetOriginTouchableHandle( const G4TouchableHandle& apValue)
185  { fpOriginTouchable = apValue; }
186 
187 // kinetic energy
188  inline G4double G4Track::GetKineticEnergy() const
189  { return fpDynamicParticle->GetKineticEnergy(); }
190 
191  inline void G4Track::SetKineticEnergy(const G4double aValue)
192  { fpDynamicParticle->SetKineticEnergy(aValue); }
193 
194 // total energy
195  inline G4double G4Track::GetTotalEnergy() const
196  { return fpDynamicParticle->GetTotalEnergy(); }
197 
198 // momentum
199  inline G4ThreeVector G4Track::GetMomentum() const
200  { return fpDynamicParticle->GetMomentum(); }
201 
202 // momentum (direction)
203  inline const G4ThreeVector& G4Track::GetMomentumDirection() const
204  { return fpDynamicParticle->GetMomentumDirection(); }
205 
206  inline void G4Track::SetMomentumDirection(const G4ThreeVector& aValue)
207  { fpDynamicParticle->SetMomentumDirection(aValue) ;}
208 
209 // polarization
210  inline const G4ThreeVector& G4Track::GetPolarization() const
211  { return fpDynamicParticle->GetPolarization(); }
212 
213  inline void G4Track::SetPolarization(const G4ThreeVector& aValue)
214  { fpDynamicParticle->SetPolarization(aValue.x(),
215  aValue.y(),
216  aValue.z()); }
217 
218 // track status
219  inline G4TrackStatus G4Track::GetTrackStatus() const
220  { return fTrackStatus; }
221 
222  inline void G4Track::SetTrackStatus(const G4TrackStatus aTrackStatus)
223  { fTrackStatus = aTrackStatus; }
224 
225 // track length
226  inline G4double G4Track::GetTrackLength() const
227  { return fTrackLength; }
228 
229  inline void G4Track::AddTrackLength(const G4double aValue)
230  { fTrackLength += aValue; }
231  // Accumulated track length
232 
233 // step number
234  inline G4int G4Track::GetCurrentStepNumber() const
235  { return fCurrentStepNumber; }
236 
237  inline void G4Track::IncrementCurrentStepNumber()
238  { fCurrentStepNumber++; }
239 
240 // step length
241  inline G4double G4Track::GetStepLength() const
242  { return fStepLength; }
243 
244  inline void G4Track::SetStepLength(G4double value)
245  { fStepLength = value; }
246 
247 // vertex (where this track was created) information
248  inline const G4ThreeVector& G4Track::GetVertexPosition() const
249  { return fVtxPosition; }
250 
251  inline void G4Track::SetVertexPosition(const G4ThreeVector& aValue)
252  { fVtxPosition = aValue; }
253 
254  inline const G4ThreeVector& G4Track::GetVertexMomentumDirection() const
255  { return fVtxMomentumDirection; }
256  inline void G4Track::SetVertexMomentumDirection(const G4ThreeVector& aValue)
257  { fVtxMomentumDirection = aValue ;}
258 
259  inline G4double G4Track::GetVertexKineticEnergy() const
260  { return fVtxKineticEnergy; }
261 
262  inline void G4Track::SetVertexKineticEnergy(const G4double aValue)
263  { fVtxKineticEnergy = aValue; }
264 
265  inline const G4LogicalVolume* G4Track::GetLogicalVolumeAtVertex() const
266  { return fpLVAtVertex; }
267 
268  inline void G4Track::SetLogicalVolumeAtVertex(const G4LogicalVolume* aValue)
269  { fpLVAtVertex = aValue; }
270 
271  inline const G4VProcess* G4Track::GetCreatorProcess() const
272  { return fpCreatorProcess; }
273  // If the pointer is 0, this means the track is created
274  // by the event generator, i.e. the primary track.If it is not
275  // 0, it points to the process which created this track.
276 
277  inline void G4Track::SetCreatorProcess(const G4VProcess* aValue)
278  { fpCreatorProcess = aValue; }
279 
280 // flag for "Below Threshold"
281  inline G4bool G4Track::IsBelowThreshold() const
282  { return fBelowThreshold; }
283 
284  inline void G4Track::SetBelowThresholdFlag(G4bool value)
285  { fBelowThreshold = value; }
286 
287 // flag for " Good for Tracking"
288  inline G4bool G4Track::IsGoodForTracking() const
289  { return fGoodForTracking; }
290 
291  inline void G4Track::SetGoodForTrackingFlag(G4bool value)
292  { fGoodForTracking = value; }
293 
294 // track weight
295  inline void G4Track::SetWeight(G4double aValue)
296  { fWeight = aValue; }
297 
298  inline G4double G4Track::GetWeight() const
299  { return fWeight; }
300 
301 // user information
302  inline G4VUserTrackInformation* G4Track::GetUserInformation() const
303  { return fpUserInformation; }
304  inline void G4Track::SetUserInformation(G4VUserTrackInformation* aValue)
305  { fpUserInformation = aValue; }
306 
307  inline const G4Step* G4Track::GetStep() const
308  { return fpStep; }
309 
310  inline void G4Track::SetStep(const G4Step* aValue)
311  { fpStep = aValue; }