1//------------------------------------------------
2// The Geant4 Virtual Monte Carlo package
3// Copyright (C) 2007 - 2014 Ivana Hrivnacova
6// For the licensing terms see geant4_vmc/LICENSE.
7// Contact: root-vmc@cern.ch
8//-------------------------------------------------
10/// \file TG4TrackInformation.icc
11/// \brief Implementation of the inline functions for the TG4TrackInformation
14/// \author I. Hrivnacova; IPN Orsay
16#include "TMCParticleStatus.h"
18/// Geant4 allocator for TG4TrackInformation objects
19extern G4ThreadLocal G4Allocator<TG4TrackInformation>* gTrackInfoAllocator;
21inline void* TG4TrackInformation::operator new(size_t)
23 /// Override "new" for "G4Allocator".
25 if (!gTrackInfoAllocator) {
26 gTrackInfoAllocator = new G4Allocator<TG4TrackInformation>;
30 trackInfo = (void*)(*gTrackInfoAllocator).MallocSingle();
34inline void TG4TrackInformation::operator delete(void* trackInfo)
36 /// Override "delete" for "G4Allocator".
38 (*gTrackInfoAllocator).FreeSingle((TG4TrackInformation*)trackInfo);
43inline void TG4TrackInformation::SetTrackParticleID(G4int trackParticleID)
45 /// Set track particle ID.= the index of track particle in VMC stack
46 fTrackParticleID = trackParticleID;
49inline void TG4TrackInformation::SetParentParticleID(G4int parentParticleID)
51 /// Set parent particle ID = the index of parent particle in VMC stack
52 fParentParticleID = parentParticleID;
55inline void TG4TrackInformation::SetPDGLifetime(G4double pdgLifeTime)
57 /// Set the PDG lifetime, if not yet done for this track.
58 /// Do nothing if called for the second time.
59 if (fPDGLifetime < 0) fPDGLifetime = pdgLifeTime;
62inline void TG4TrackInformation::SetPDGEncoding(G4int pdgEncoding)
64 /// Set the PDG encoding.
65 fPDGEncoding = pdgEncoding;
68inline void TG4TrackInformation::SetInitialTrackStatus(
69 TMCParticleStatus* status)
71 /// set initial status of the particle on the VMC stack all at once
72 fInitialTrackStatus = status;
75inline void TG4TrackInformation::SetIsUserTrack(G4bool isUserTrack)
77 /// Set info that the track was poped from the VMC stack
78 fIsUserTrack = isUserTrack;
81inline void TG4TrackInformation::SetStop(G4bool stop)
83 /// Set info that the track should be stopped
87inline void TG4TrackInformation::SetInterrupt(G4bool interrupt)
89 /// Set info if the track should be interrupted so no hooks like
90 /// TVirtualMCApplication::PostTrack() are called.
91 fInterrupt = interrupt;
94inline G4int TG4TrackInformation::GetTrackParticleID() const
96 /// Return track particle ID.= the index of track particle in VMC stack
97 return fTrackParticleID;
100inline G4int TG4TrackInformation::GetParentParticleID() const
102 /// Return parent particle ID = the index of parent particle in VMC stack
103 return fParentParticleID;
106inline G4double TG4TrackInformation::GetPDGLifetime() const
108 /// Return the original PDG lifetime for this track
112inline G4int TG4TrackInformation::GetPDGEncoding() const
114 /// Return the PDG encoding for this track
118inline const TMCParticleStatus*
119TG4TrackInformation::GetInitialTrackStatus() const
121 return fInitialTrackStatus;
124inline G4bool TG4TrackInformation::IsUserTrack() const
126 /// Return the info if the track was poped from the VMC stack
130inline G4bool TG4TrackInformation::IsStop() const
132 /// Return the info if the track should be stopped
136inline G4bool TG4TrackInformation::IsInterrupt() const
138 /// Return the info if the track should be interrupted so no hooks like
139 /// TVirtualMCApplication::PostTrack() are called.