Geant4 VMC Version 6.6
Loading...
Searching...
No Matches
TG4StepManager.h
Go to the documentation of this file.
1#ifndef TG4_STEP_MANAGER_H
2#define TG4_STEP_MANAGER_H
3
4//------------------------------------------------
5// The Geant4 Virtual Monte Carlo package
6// Copyright (C) 2007 - 2015 Ivana Hrivnacova
7// All rights reserved.
8//
9// For the licensing terms see geant4_vmc/LICENSE.
10// Contact: root-vmc@cern.ch
11//-------------------------------------------------
12
17
18#include <Rtypes.h>
19
20#include "TG4StepStatus.h"
21
22#include <G4GFlashSpot.hh>
23#include <G4Step.hh>
24#include <G4SteppingManager.hh>
25#include <G4ThreeVector.hh>
26#include <G4TransportationManager.hh>
27#include <G4VTouchable.hh>
28#include <globals.hh>
29
30#include <TArrayI.h>
31#include <TMCProcess.h>
32#include <TString.h>
33
34class TG4Limits;
35class TG4TrackManager;
37
38class G4Track;
39class G4SteppingManager;
40class G4VPhysicalVolume;
41
42class TLorentzVector;
43class TVector3;
44struct TMCParticleStatus;
45
54
56{
57 public:
58 TG4StepManager(const TString& userGeometry);
60
61 // static access method
62 static TG4StepManager* Instance();
63
64 // methods
65 void LateInitialize();
66 void StopTrack();
67 void InterruptTrack();
68 void StopEvent();
69 void StopRun();
70
71 // set methods
72 void SetStep(G4Step* step, TG4StepStatus status); // G4 specific
73 void SetStep(G4Track* track, TG4StepStatus status); // G4 specific
74 void SetStep(G4GFlashSpot* gflashSpot, TG4StepStatus status); // G4 specific
75 void SetSteppingManager(G4SteppingManager* manager); // G4 specific
76 void SetMaxStep(Double_t step);
77 void SetMaxStepBack(); // G4 specific
78 void SetMaxNStep(Int_t maxNofSteps);
79 void SetCollectTracks(Bool_t collectTracks);
80 void ForceDecayTime(Float_t pdg);
81 void SetInitialVMCTrackStatus(TMCParticleStatus* status);
82
83 // get methods
84 G4Track* GetTrack() const; // G4 specific
85 G4Step* GetStep() const; // G4 specific
86 TG4StepStatus GetStepStatus() const; // G4 specific
87 TG4Limits* GetLimitsModifiedOnFly() const; // G4 specific
88 Bool_t IsCollectTracks() const;
89
90 // tracking volume(s)
91 G4VPhysicalVolume* GetCurrentPhysicalVolume() const; // G4 specific
92 TG4Limits* GetCurrentLimits() const; // G4 specific
93 Int_t CurrentVolID(Int_t& copyNo) const;
94 Int_t CurrentVolOffID(Int_t off, Int_t& copyNo) const;
95 const char* CurrentVolName() const;
96 const char* CurrentVolOffName(Int_t off) const;
97 const char* CurrentVolPath();
98 Bool_t CurrentBoundaryNormal(Double_t& x, Double_t& y, Double_t& z) const;
99 Int_t CurrentMaterial(
100 Float_t& a, Float_t& z, Float_t& dens, Float_t& radl, Float_t& absl) const;
101 Int_t CurrentMedium() const;
102 void Gmtod(Double_t* xm, Double_t* xd, Int_t iflag);
103 void Gmtod(Float_t* xm, Float_t* xd, Int_t iflag);
104 void Gdtom(Double_t* xd, Double_t* xm, Int_t iflag);
105 void Gdtom(Float_t* xd, Float_t* xm, Int_t iflag);
106 Double_t MaxStep() const;
107 Int_t GetMaxNStep() const;
108
109 // tracking particle
110 // dynamic properties
111 void TrackPosition(TLorentzVector& position) const;
112 void TrackPosition(Double_t& x, Double_t& y, Double_t& z) const;
113 void TrackPosition(Float_t& x, Float_t& y, Float_t& z) const;
114 void TrackMomentum(TLorentzVector& momentum) const;
115 void TrackMomentum(
116 Double_t& px, Double_t& py, Double_t& pz, Double_t& etot) const;
117 void TrackMomentum(
118 Float_t& px, Float_t& py, Float_t& pz, Float_t& etot) const;
119 Double_t TrackStep() const;
120 Double_t TrackLength() const;
121 Double_t TrackTime() const;
122 Double_t Edep() const;
123 Double_t NIELEdep() const;
124 Int_t StepNumber() const;
125 Double_t TrackWeight() const;
126 void TrackPolarization(Double_t& polX, Double_t& polY, Double_t& polZ) const;
127 void TrackPolarization(TVector3& pol) const;
128 // static properties
129 Int_t TrackPid() const;
130 Double_t TrackCharge() const;
131 Double_t TrackMass() const;
132 Double_t Etot() const;
133
134 // track status
135 Bool_t IsTrackInside() const;
136 Bool_t IsTrackEntering() const;
137 Bool_t IsTrackExiting() const;
138 Bool_t IsTrackOut() const;
139 Bool_t IsTrackDisappeared() const;
140 Bool_t IsTrackStop() const;
141 Bool_t IsTrackAlive() const;
142 Bool_t IsNewTrack() const;
143
144 // secondaries
145 Int_t NSecondaries() const;
146 void GetSecondary(Int_t index, Int_t& particleId, TLorentzVector& position,
147 TLorentzVector& momentum);
148 TMCProcess ProdProcess(Int_t isec) const;
149 Int_t StepProcesses(TArrayI& proc) const;
150
151 private:
156
157 // methods
158 void CheckTrack() const;
159 void CheckStep(const G4String& method) const;
160 void CheckGflashSpot(const G4String& method) const;
161 void CheckSteppingManager() const;
163 G4ThreeVector xyz, G4double t, TLorentzVector& lv) const;
164 const G4VTouchable* GetCurrentTouchable() const;
165 G4VPhysicalVolume* GetCurrentOffPhysicalVolume(
166 G4int off, G4bool warn = false) const;
167
168 // static data members
169 static G4ThreadLocal TG4StepManager* fgInstance;
170
171 //
172 // data members
173
175 G4Track* fTrack;
176
178 G4Step* fStep;
179
181 G4GFlashSpot* fGflashSpot;
182
187
190
192 G4SteppingManager* fSteppingManager;
193
195 mutable G4String fNameBuffer;
196
199
202
205
207 TMCParticleStatus* fInitialVMCTrackStatus;
208};
209
210// inline methods
211
213{
215 return fgInstance;
216}
217
218inline void TG4StepManager::SetStep(G4Step* step, TG4StepStatus status)
219{
221 fTrack = step->GetTrack();
222 fStep = step;
223 fStepStatus = status;
224 fGflashSpot = 0;
225}
226
227inline void TG4StepManager::SetStep(G4Track* track, TG4StepStatus status)
228{
230 fTrack = track;
231 fStep = 0;
232 fStepStatus = status;
233 fGflashSpot = 0;
234}
235
237 G4GFlashSpot* gflashSpot, TG4StepStatus status)
238{
240 fTrack =
241 const_cast<G4Track*>(gflashSpot->GetOriginatorTrack()->GetPrimaryTrack());
242 fStep = 0;
243 fStepStatus = status;
244 fGflashSpot = gflashSpot;
245}
246
247inline void TG4StepManager::SetSteppingManager(G4SteppingManager* manager)
248{
250 fSteppingManager = manager;
251
253 // G4cout << "SetNavigator:"
254 // << G4TransportationManager::GetTransportationManager()
255 // ->GetNavigatorForTracking() << G4endl;
256 fSteppingManager->SetNavigator(
257 G4TransportationManager::GetTransportationManager()
258 ->GetNavigatorForTracking());
259}
260
261inline G4Track* TG4StepManager::GetTrack() const
262{
264 return fTrack;
265}
266
267inline G4Step* TG4StepManager::GetStep() const
268{
270 return fStep;
271}
272
274{
276 return fStepStatus;
277}
278
284
285#endif // TG4_STEP_MANAGER_H
Definition of the enumeration TG4StepStatus.
Extended G4UserLimits class.
Definition TG4Limits.h:38
Geant4 implementation of the TVirtualMC interface methods for access to Geant4 at step level.
const char * CurrentVolPath()
G4Track * fTrack
current track
Int_t CurrentMaterial(Float_t &a, Float_t &z, Float_t &dens, Float_t &radl, Float_t &absl) const
Double_t Edep() const
Int_t StepProcesses(TArrayI &proc) const
TMCProcess ProdProcess(Int_t isec) const
void CheckTrack() const
G4int fDivisionCopyNoOffset
division copy number offset
Int_t CurrentVolOffID(Int_t off, Int_t &copyNo) const
void TrackMomentum(TLorentzVector &momentum) const
const char * CurrentVolOffName(Int_t off) const
Bool_t IsTrackStop() const
void SetSteppingManager(G4SteppingManager *manager)
Bool_t IsTrackDisappeared() const
Bool_t IsTrackEntering() const
Double_t TrackStep() const
TG4StepManager(const TString &userGeometry)
G4Track * GetTrack() const
Double_t TrackTime() const
void SetMaxNStep(Int_t maxNofSteps)
const char * CurrentVolName() const
G4String fNameBuffer
buffer for current volume name or path
void GetSecondary(Int_t index, Int_t &particleId, TLorentzVector &position, TLorentzVector &momentum)
Double_t MaxStep() const
G4SteppingManager * fSteppingManager
G4SteppingManager.
TG4Limits * GetCurrentLimits() const
Double_t TrackMass() const
Int_t NSecondaries() const
Double_t NIELEdep() const
void CheckGflashSpot(const G4String &method) const
Bool_t CurrentBoundaryNormal(Double_t &x, Double_t &y, Double_t &z) const
Double_t TrackWeight() const
G4GFlashSpot * fGflashSpot
current Gflash spot
TG4TrackManager * fTrackManager
Cached pointer to thread-local track manager.
static TG4StepManager * Instance()
TG4StepStatus fStepStatus
step status
const G4VTouchable * GetCurrentTouchable() const
Int_t CurrentVolID(Int_t &copyNo) const
Bool_t IsTrackAlive() const
void CheckSteppingManager() const
TG4StepStatus GetStepStatus() const
TG4StepManager(const TG4StepManager &right)
Not implemented.
Double_t TrackCharge() const
Int_t CurrentMedium() const
Double_t TrackLength() const
Bool_t IsTrackInside() const
static G4ThreadLocal TG4StepManager * fgInstance
this instance
Bool_t IsCollectTracks() const
void Gdtom(Double_t *xd, Double_t *xm, Int_t iflag)
G4int fCopyNoOffset
volume copy number offset
Bool_t IsNewTrack() const
G4Step * GetStep() const
void SetStep(G4Step *step, TG4StepStatus status)
Bool_t IsTrackOut() const
void CheckStep(const G4String &method) const
Int_t StepNumber() const
G4VPhysicalVolume * GetCurrentPhysicalVolume() const
TG4Limits * fLimitsModifiedOnFly
limits which step limit was modified during tracking
void SetTLorentzVector(G4ThreeVector xyz, G4double t, TLorentzVector &lv) const
TG4Limits * GetLimitsModifiedOnFly() const
Bool_t IsTrackExiting() const
Int_t TrackPid() const
void Gmtod(Double_t *xm, Double_t *xd, Int_t iflag)
TMCParticleStatus * fInitialVMCTrackStatus
The initial status of a VMC track when it was popped from the VMC stack.
void SetCollectTracks(Bool_t collectTracks)
void ForceDecayTime(Float_t pdg)
G4Step * fStep
current step
void TrackPolarization(Double_t &polX, Double_t &polY, Double_t &polZ) const
Int_t GetMaxNStep() const
G4VPhysicalVolume * GetCurrentOffPhysicalVolume(G4int off, G4bool warn=false) const
Double_t Etot() const
TG4StepManager & operator=(const TG4StepManager &right)
Not implemented.
void TrackPosition(TLorentzVector &position) const
void SetInitialVMCTrackStatus(TMCParticleStatus *status)
void SetMaxStep(Double_t step)
Actions at each step.
The class for storing G4 tracks in VMC sack.
TG4StepStatus
Step status enumeration.