00001 // 00002 // ******************************************************************** 00003 // * License and Disclaimer * 00004 // * * 00005 // * The Geant4 software is copyright of the Copyright Holders of * 00006 // * the Geant4 Collaboration. It is provided under the terms and * 00007 // * conditions of the Geant4 Software License, included in the file * 00008 // * LICENSE and available at http://cern.ch/geant4/license . These * 00009 // * include a list of copyright holders. * 00010 // * * 00011 // * Neither the authors of this software system, nor their employing * 00012 // * institutes,nor the agencies providing financial support for this * 00013 // * work make any representation or warranty, express or implied, * 00014 // * regarding this software system or assume any liability for its * 00015 // * use. Please see the license in the file LICENSE and URL above * 00016 // * for the full disclaimer and the limitation of liability. * 00017 // * * 00018 // * This code implementation is the result of the scientific and * 00019 // * technical work of the GEANT4 collaboration. * 00020 // * By using, copying, modifying or distributing the software (or * 00021 // * any work based on the software) you agree to acknowledge its * 00022 // * use in resulting scientific publications, and indicate your * 00023 // * acceptance of all terms of the Geant4 Software license. * 00024 // ******************************************************************** 00025 // 00026 // 00027 // $Id$ 00028 // 00029 //----------------------------------------------------------------- 00030 // Definitions of inline functions 00031 //----------------------------------------------------------------- 00032 // change GetMaterial 16 Feb. 2000 H.Kurashige 00033 00034 #if defined G4TRACK_ALLOC_EXPORT 00035 extern G4DLLEXPORT G4Allocator<G4Track> aTrackAllocator; 00036 #else 00037 extern G4DLLIMPORT G4Allocator<G4Track> aTrackAllocator; 00038 #endif 00039 00040 //------------------------------------------------------------- 00041 // To implement bi-directional association between G4Step and 00042 // and G4Track, a combined usage of 'forward declaration' and 00043 // 'include' is necessary. 00044 //------------------------------------------------------------- 00045 #include "G4Step.hh" 00046 00047 // Operators 00048 00049 inline void* G4Track::operator new(size_t) 00050 { void *aTrack; 00051 aTrack = (void *) aTrackAllocator.MallocSingle(); 00052 return aTrack; 00053 } 00054 // Override "new" for "G4Allocator". 00055 00056 inline void G4Track::operator delete(void *aTrack) 00057 { aTrackAllocator.FreeSingle((G4Track *) aTrack);} 00058 // Override "delete" for "G4Allocator". 00059 00060 inline G4bool G4Track::operator==( const G4Track& trk) 00061 { return (this==&trk); } 00062 // Define "==" operator because "G4TrackVector" uses 00063 // "RWPtrOrderdVector" which requires this. 00064 00065 // Get/Set functions 00066 // dynamic particle 00067 inline const G4DynamicParticle* G4Track::GetDynamicParticle() const 00068 { return fpDynamicParticle; } 00069 00070 // particle definition 00071 inline G4ParticleDefinition* G4Track::GetDefinition() const 00072 { return fpDynamicParticle->GetDefinition(); } 00073 00074 // particle definition 00075 inline const G4ParticleDefinition* G4Track::GetParticleDefinition() const 00076 { return fpDynamicParticle->GetParticleDefinition(); } 00077 00078 // parent track ID 00079 inline G4int G4Track::GetParentID() const 00080 { return fParentID; } 00081 00082 inline void G4Track::SetParentID(const G4int aValue) 00083 { fParentID = aValue; } 00084 00085 // current track ID 00086 inline G4int G4Track::GetTrackID() const 00087 { return fTrackID; } 00088 00089 inline void G4Track::SetTrackID(const G4int aValue) 00090 { fTrackID = aValue; } 00091 00092 // position 00093 inline const G4ThreeVector& G4Track::GetPosition() const 00094 { return fPosition; } 00095 00096 inline void G4Track::SetPosition(const G4ThreeVector& aValue) 00097 { fPosition = aValue; } 00098 00099 // global time 00100 inline G4double G4Track::GetGlobalTime() const 00101 { return fGlobalTime; } 00102 00103 inline void G4Track::SetGlobalTime(const G4double aValue) 00104 { fGlobalTime = aValue; } 00105 // Time since the event in which the track belongs is created. 00106 00107 // local time 00108 inline G4double G4Track::GetLocalTime() const 00109 { return fLocalTime; } 00110 00111 inline void G4Track::SetLocalTime(const G4double aValue) 00112 { fLocalTime = aValue; } 00113 // Time since the current track is created. 00114 00115 // proper time 00116 inline G4double G4Track::GetProperTime() const 00117 { return fpDynamicParticle->GetProperTime(); } 00118 00119 inline void G4Track::SetProperTime(const G4double aValue) 00120 { fpDynamicParticle->SetProperTime(aValue); } 00121 // Proper time of the current track 00122 00123 // velocity 00124 inline G4double G4Track::GetVelocity() const 00125 { return fVelocity; } 00126 00127 inline void G4Track::SetVelocity(G4double val) 00128 { fVelocity = val; } 00129 00130 inline G4bool G4Track::UseGivenVelocity() const 00131 { return useGivenVelocity;} 00132 00133 inline void G4Track::UseGivenVelocity(G4bool val) 00134 { useGivenVelocity = val;} 00135 00136 00137 // volume 00138 inline G4VPhysicalVolume* G4Track::GetVolume() const 00139 { if ( fpTouchable ==0 ) return 0; 00140 return fpTouchable->GetVolume(); } 00141 00142 inline G4VPhysicalVolume* G4Track::GetNextVolume() const 00143 { if ( fpNextTouchable ==0 ) return 0; 00144 return fpNextTouchable->GetVolume(); } 00145 00146 // material 00147 inline 00148 const G4MaterialCutsCouple* G4Track::GetMaterialCutsCouple() const 00149 { return fpStep->GetPreStepPoint()->GetMaterialCutsCouple(); } 00150 00151 inline 00152 const G4MaterialCutsCouple* G4Track::GetNextMaterialCutsCouple() const 00153 { return fpStep->GetPostStepPoint()->GetMaterialCutsCouple(); } 00154 00155 // material 00156 inline G4Material* G4Track::GetMaterial() const 00157 { return fpStep->GetPreStepPoint()->GetMaterial(); } 00158 00159 inline G4Material* G4Track::GetNextMaterial() const 00160 { return fpStep->GetPostStepPoint()->GetMaterial(); } 00161 00162 00163 // touchable 00164 inline const G4VTouchable* G4Track::GetTouchable() const 00165 { 00166 return fpTouchable(); 00167 } 00168 00169 inline const G4TouchableHandle& G4Track::GetTouchableHandle() const 00170 { 00171 return fpTouchable; 00172 } 00173 00174 inline void G4Track::SetTouchableHandle( const G4TouchableHandle& apValue) 00175 { 00176 fpTouchable = apValue; 00177 } 00178 00179 inline const G4VTouchable* G4Track::GetNextTouchable() const 00180 { 00181 return fpNextTouchable(); 00182 } 00183 00184 inline const G4TouchableHandle& G4Track::GetNextTouchableHandle() const 00185 { 00186 return fpNextTouchable; 00187 } 00188 00189 inline void G4Track::SetNextTouchableHandle( const G4TouchableHandle& apValue) 00190 { 00191 fpNextTouchable = apValue; 00192 } 00193 00194 inline const G4VTouchable* G4Track::GetOriginTouchable() const 00195 { 00196 return fpOriginTouchable(); 00197 } 00198 00199 inline const G4TouchableHandle& G4Track::GetOriginTouchableHandle() const 00200 { 00201 return fpOriginTouchable; 00202 } 00203 00204 inline void G4Track::SetOriginTouchableHandle( const G4TouchableHandle& apValue) 00205 { 00206 fpOriginTouchable = apValue; 00207 } 00208 00209 // kinetic energy 00210 inline G4double G4Track::GetKineticEnergy() const 00211 { return fpDynamicParticle->GetKineticEnergy(); } 00212 00213 inline void G4Track::SetKineticEnergy(const G4double aValue) 00214 { fpDynamicParticle->SetKineticEnergy(aValue); } 00215 00216 // total energy 00217 inline G4double G4Track::GetTotalEnergy() const 00218 { return fpDynamicParticle->GetTotalEnergy(); } 00219 00220 // momentum 00221 inline G4ThreeVector G4Track::GetMomentum() const 00222 { return fpDynamicParticle->GetMomentum(); } 00223 00224 // momentum (direction) 00225 inline const G4ThreeVector& G4Track::GetMomentumDirection() const 00226 { return fpDynamicParticle->GetMomentumDirection(); } 00227 00228 inline void G4Track::SetMomentumDirection(const G4ThreeVector& aValue) 00229 { fpDynamicParticle->SetMomentumDirection(aValue) ;} 00230 00231 // polarization 00232 inline const G4ThreeVector& G4Track::GetPolarization() const 00233 { return fpDynamicParticle->GetPolarization(); } 00234 00235 inline void G4Track::SetPolarization(const G4ThreeVector& aValue) 00236 { fpDynamicParticle->SetPolarization(aValue.x(), 00237 aValue.y(), 00238 aValue.z()); } 00239 00240 // track status 00241 inline G4TrackStatus G4Track::GetTrackStatus() const 00242 { return fTrackStatus; } 00243 00244 inline void G4Track::SetTrackStatus(const G4TrackStatus aTrackStatus) 00245 { fTrackStatus = aTrackStatus; } 00246 00247 // track length 00248 inline G4double G4Track::GetTrackLength() const 00249 { return fTrackLength; } 00250 00251 inline void G4Track::AddTrackLength(const G4double aValue) 00252 { fTrackLength += aValue; } 00253 // Accumulated track length 00254 00255 // step number 00256 inline G4int G4Track::GetCurrentStepNumber() const 00257 { return fCurrentStepNumber; } 00258 00259 inline void G4Track::IncrementCurrentStepNumber() 00260 { fCurrentStepNumber++; } 00261 00262 // step length 00263 inline G4double G4Track::GetStepLength() const 00264 { return fStepLength; } 00265 00266 inline void G4Track::SetStepLength(G4double value) 00267 { fStepLength = value; } 00268 00269 // vertex (where this track was created) information 00270 inline const G4ThreeVector& G4Track::GetVertexPosition() const 00271 { return fVtxPosition; } 00272 00273 inline void G4Track::SetVertexPosition(const G4ThreeVector& aValue) 00274 { fVtxPosition = aValue; } 00275 00276 inline const G4ThreeVector& G4Track::GetVertexMomentumDirection() const 00277 { return fVtxMomentumDirection; } 00278 inline void G4Track::SetVertexMomentumDirection(const G4ThreeVector& aValue) 00279 { fVtxMomentumDirection = aValue ;} 00280 00281 inline G4double G4Track::GetVertexKineticEnergy() const 00282 { return fVtxKineticEnergy; } 00283 00284 inline void G4Track::SetVertexKineticEnergy(const G4double aValue) 00285 { fVtxKineticEnergy = aValue; } 00286 00287 inline const G4LogicalVolume* G4Track::GetLogicalVolumeAtVertex() const 00288 { return fpLVAtVertex; } 00289 00290 inline void G4Track::SetLogicalVolumeAtVertex(const G4LogicalVolume* aValue) 00291 { fpLVAtVertex = aValue; } 00292 00293 inline const G4VProcess* G4Track::GetCreatorProcess() const 00294 { return fpCreatorProcess; } 00295 // If the pointer is 0, this means the track is created 00296 // by the event generator, i.e. the primary track.If it is not 00297 // 0, it points to the process which created this track. 00298 00299 inline void G4Track::SetCreatorProcess(const G4VProcess* aValue) 00300 { fpCreatorProcess = aValue; } 00301 00302 // flag for "Below Threshold" 00303 inline G4bool G4Track::IsBelowThreshold() const 00304 { return fBelowThreshold; } 00305 00306 inline void G4Track::SetBelowThresholdFlag(G4bool value) 00307 { fBelowThreshold = value; } 00308 00309 // flag for " Good for Tracking" 00310 inline G4bool G4Track::IsGoodForTracking() const 00311 { return fGoodForTracking; } 00312 00313 inline void G4Track::SetGoodForTrackingFlag(G4bool value) 00314 { fGoodForTracking = value; } 00315 00316 // track weight 00317 inline void G4Track::SetWeight(G4double aValue) 00318 { fWeight = aValue; } 00319 00320 inline G4double G4Track::GetWeight() const 00321 { return fWeight; } 00322 00323 // user information 00324 inline G4VUserTrackInformation* G4Track::GetUserInformation() const 00325 { return fpUserInformation; } 00326 inline void G4Track::SetUserInformation(G4VUserTrackInformation* aValue) 00327 { fpUserInformation = aValue; } 00328 00329 inline const G4Step* G4Track::GetStep() const 00330 { return fpStep; } 00331 00332 inline void G4Track::SetStep(const G4Step* aValue) 00333 { fpStep = aValue; } 00334