Geant4 VMC Version 6.6
Loading...
Searching...
No Matches
TG4TrackManager.h
Go to the documentation of this file.
1#ifndef TG4_TRACK_MANAGER_H
2#define TG4_TRACK_MANAGER_H
3
4//------------------------------------------------
5// The Geant4 Virtual Monte Carlo package
6// Copyright (C) 2007 - 2014 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 "TG4TrackSaveControl.h"
19#include "TG4Verbose.h"
20
21#ifdef USE_G4ROOT
22#include <TG4RootNavMgr.h>
23#endif
24
25#include <G4TrackVector.hh>
26#include <G4UserTrackingAction.hh>
27
29class TG4StackPopper;
30
31class TVirtualMCStack;
32class TMCManagerStack;
33
34class G4Track;
35class G4PrimaryVertex;
36class G4PrimaryParticle;
37struct TMCParticleStatus;
38#ifdef USE_G4ROOT
39class TMCManager;
40#endif
41
51
53{
54 public:
56 virtual ~TG4TrackManager();
57
58 // static access method
59 static TG4TrackManager* Instance();
60
61 // methods
62 void LateInitialize();
63 void AddPrimaryParticleId(G4int id);
64 void AddParticleStatus(const TMCParticleStatus* particleStatus);
66 const G4Track* aTrack, G4bool overWrite = false);
67 void SetParentToTrackInformation(const G4Track* aTrack);
68 void SetBackPDGLifetime(const G4Track* aTrack);
69
70 void TrackToStack(const G4Track* track, G4bool overWrite = false);
71 void PrimaryToStack(
72 const G4PrimaryVertex* vertex, const G4PrimaryParticle* particle);
73
74 void SaveSecondaries(const G4Track* track, const G4TrackVector* secondaries);
75
76 // set methods
77 void SetMCStack(TVirtualMCStack* mcStack);
78 void SetMCManagerStack(TMCManagerStack* mcManagerStack);
80 void SetSaveDynamicCharge(G4bool saveDynamicCharge);
81 void SetNofTracks(G4int nofTracks);
82 void SetG4TrackingManager(G4TrackingManager* trackingManager);
85
86 // get methods
87 TG4TrackInformation* GetTrackInformation(const G4Track* track) const;
89 G4bool GetSaveDynamicCharge() const;
90 G4int GetNofTracks() const;
91 G4bool IsUserTrack(const G4Track* track) const;
92
93 private:
98
99 // static data members
100 static G4ThreadLocal TG4TrackManager* fgInstance;
101
102 // data members
103 G4TrackingManager* fG4TrackingManager;
104 std::vector<G4int> fPrimaryParticleIds;
106 std::vector<TMCParticleStatus*> fParticlesStatus;
110
112 TVirtualMCStack* fMCStack;
113
116 TMCManagerStack* fMCManagerStack;
117
120
126#ifdef USE_G4ROOT
127 TG4RootNavMgr* fRootNavMgr;
129 TMCManager* fMCManager;
130#endif
131};
132
133// inline methods
134
140
141inline void TG4TrackManager::SetMCStack(TVirtualMCStack* mcStack)
142{
144 fMCStack = mcStack;
145}
146
147inline void TG4TrackManager::SetMCManagerStack(TMCManagerStack* mcManagerStack)
148{
151 fMCManagerStack = mcManagerStack;
152}
153
159
160inline void TG4TrackManager::SetSaveDynamicCharge(G4bool saveDynamicCharge)
161{
164 fSaveDynamicCharge = saveDynamicCharge;
165}
166
167inline void TG4TrackManager::SetNofTracks(G4int nofTracks)
168{
170 fTrackCounter = nofTracks;
171}
172
174 G4TrackingManager* trackingManager)
175{
177 fG4TrackingManager = trackingManager;
178#ifdef USE_G4ROOT
179 if (fRootNavMgr) {
180 fRootNavMgr->SetG4TrackingManager(fG4TrackingManager);
181 }
182#endif
183}
184
190
192{
194 return fSaveDynamicCharge;
195}
196
198{
200 return fTrackCounter;
201}
202
203#endif // TG4_TRACK_MANAGER_H
Definition of the enumeration TG4TrackSaveControl.
Definition of the TG4Verbose class.
The process which pops particles defined by user from the VMC stack and passes them to tracking.
Defines additional track information.
The class for storing G4 tracks in VMC sack.
void SaveSecondaries(const G4Track *track, const G4TrackVector *secondaries)
G4int fTrackCounter
tracks counter
void SetMCStack(TVirtualMCStack *mcStack)
G4int fCurrentTrackID
current track ID
TG4TrackSaveControl GetTrackSaveControl() const
void AddParticleStatus(const TMCParticleStatus *particleStatus)
void SetTrackSaveControl(TG4TrackSaveControl control)
G4TrackingManager * fG4TrackingManager
G4 tracking manager.
TG4StackPopper * fStackPopper
Cached pointer to thread-local stack popper.
G4int GetNofTracks() const
void SetG4TrackingManager(G4TrackingManager *trackingManager)
G4bool GetSaveDynamicCharge() const
TVirtualMCStack * fMCStack
Cached pointer to thread-local VMC stack.
TG4TrackManager & operator=(const TG4TrackManager &right)
Not implemented.
void SetBackPDGLifetime(const G4Track *aTrack)
static TG4TrackManager * Instance()
TG4TrackInformation * GetTrackInformation(const G4Track *track) const
virtual ~TG4TrackManager()
void SetParentToTrackInformation(const G4Track *aTrack)
std::vector< G4int > fPrimaryParticleIds
TG4TrackManager(const TG4TrackManager &right)
Not implemented.
G4bool IsUserTrack(const G4Track *track) const
void TrackToStack(const G4Track *track, G4bool overWrite=false)
void SetNofTracks(G4int nofTracks)
void SetMCManagerStack(TMCManagerStack *mcManagerStack)
void SetSaveDynamicCharge(G4bool saveDynamicCharge)
static G4ThreadLocal TG4TrackManager * fgInstance
this instance
std::vector< TMCParticleStatus * > fParticlesStatus
TG4TrackSaveControl fTrackSaveControl
control of saving secondaries
TMCManagerStack * fMCManagerStack
void AddPrimaryParticleId(G4int id)
void PrimaryToStack(const G4PrimaryVertex *vertex, const G4PrimaryParticle *particle)
TG4TrackInformation * SetTrackInformation(const G4Track *aTrack, G4bool overWrite=false)
G4int fNofSavedSecondaries
number of secondaries already saved
Base class for defining the verbose level and a common messenger.
Definition TG4Verbose.h:36
TG4TrackSaveControl
Enumeration for options for storing secondary tracks.