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