Geant4 VMC Version 6.6
Loading...
Searching...
No Matches
TG4TrackInformation.icc
Go to the documentation of this file.
1//------------------------------------------------
2// The Geant4 Virtual Monte Carlo package
3// Copyright (C) 2007 - 2014 Ivana Hrivnacova
4// All rights reserved.
5//
6// For the licensing terms see geant4_vmc/LICENSE.
7// Contact: root-vmc@cern.ch
8//-------------------------------------------------
9
10/// \file TG4TrackInformation.icc
11/// \brief Implementation of the inline functions for the TG4TrackInformation
12/// class
13///
14/// \author I. Hrivnacova; IPN Orsay
15
16#include "TMCParticleStatus.h"
17
18/// Geant4 allocator for TG4TrackInformation objects
19extern G4ThreadLocal G4Allocator<TG4TrackInformation>* gTrackInfoAllocator;
20
21inline void* TG4TrackInformation::operator new(size_t)
22{
23 /// Override "new" for "G4Allocator".
24
25 if (!gTrackInfoAllocator) {
26 gTrackInfoAllocator = new G4Allocator<TG4TrackInformation>;
27 }
28
29 void* trackInfo;
30 trackInfo = (void*)(*gTrackInfoAllocator).MallocSingle();
31 return trackInfo;
32}
33
34inline void TG4TrackInformation::operator delete(void* trackInfo)
35{
36 /// Override "delete" for "G4Allocator".
37
38 (*gTrackInfoAllocator).FreeSingle((TG4TrackInformation*)trackInfo);
39}
40
41// inline methods
42
43inline void TG4TrackInformation::SetTrackParticleID(G4int trackParticleID)
44{
45 /// Set track particle ID.= the index of track particle in VMC stack
46 fTrackParticleID = trackParticleID;
47}
48
49inline void TG4TrackInformation::SetParentParticleID(G4int parentParticleID)
50{
51 /// Set parent particle ID = the index of parent particle in VMC stack
52 fParentParticleID = parentParticleID;
53}
54
55inline void TG4TrackInformation::SetPDGLifetime(G4double pdgLifeTime)
56{
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;
60}
61
62inline void TG4TrackInformation::SetPDGEncoding(G4int pdgEncoding)
63{
64 /// Set the PDG encoding.
65 fPDGEncoding = pdgEncoding;
66}
67
68inline void TG4TrackInformation::SetInitialTrackStatus(
69 TMCParticleStatus* status)
70{
71 /// set initial status of the particle on the VMC stack all at once
72 fInitialTrackStatus = status;
73}
74
75inline void TG4TrackInformation::SetIsUserTrack(G4bool isUserTrack)
76{
77 /// Set info that the track was poped from the VMC stack
78 fIsUserTrack = isUserTrack;
79}
80
81inline void TG4TrackInformation::SetStop(G4bool stop)
82{
83 /// Set info that the track should be stopped
84 fStop = stop;
85}
86
87inline void TG4TrackInformation::SetInterrupt(G4bool interrupt)
88{
89 /// Set info if the track should be interrupted so no hooks like
90 /// TVirtualMCApplication::PostTrack() are called.
91 fInterrupt = interrupt;
92}
93
94inline G4int TG4TrackInformation::GetTrackParticleID() const
95{
96 /// Return track particle ID.= the index of track particle in VMC stack
97 return fTrackParticleID;
98}
99
100inline G4int TG4TrackInformation::GetParentParticleID() const
101{
102 /// Return parent particle ID = the index of parent particle in VMC stack
103 return fParentParticleID;
104}
105
106inline G4double TG4TrackInformation::GetPDGLifetime() const
107{
108 /// Return the original PDG lifetime for this track
109 return fPDGLifetime;
110}
111
112inline G4int TG4TrackInformation::GetPDGEncoding() const
113{
114 /// Return the PDG encoding for this track
115 return fPDGEncoding;
116}
117
118inline const TMCParticleStatus*
119TG4TrackInformation::GetInitialTrackStatus() const
120{
121 return fInitialTrackStatus;
122}
123
124inline G4bool TG4TrackInformation::IsUserTrack() const
125{
126 /// Return the info if the track was poped from the VMC stack
127 return fIsUserTrack;
128}
129
130inline G4bool TG4TrackInformation::IsStop() const
131{
132 /// Return the info if the track should be stopped
133 return fStop;
134}
135
136inline G4bool TG4TrackInformation::IsInterrupt() const
137{
138 /// Return the info if the track should be interrupted so no hooks like
139 /// TVirtualMCApplication::PostTrack() are called.
140 return fInterrupt;
141}