Geant4 11.3.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4TrackingManager Class Reference

#include <G4TrackingManager.hh>

Public Member Functions

 G4TrackingManager ()
 
 ~G4TrackingManager ()
 
G4TrackGetTrack () const
 
G4int GetStoreTrajectory () const
 
void SetStoreTrajectory (G4int value)
 
G4SteppingManagerGetSteppingManager () const
 
G4UserTrackingActionGetUserTrackingAction () const
 
G4VTrajectoryGimmeTrajectory () const
 
void SetTrajectory (G4VTrajectory *aTrajectory)
 
G4TrackVectorGimmeSecondaries () const
 
void SetUserAction (G4UserTrackingAction *apAction)
 
void SetUserAction (G4UserSteppingAction *apAction)
 
void SetVerboseLevel (G4int vLevel)
 
G4int GetVerboseLevel () const
 
void ProcessOneTrack (G4Track *apValueG4Track)
 
void EventAborted ()
 
void SetUserTrackInformation (G4VUserTrackInformation *aValue)
 

Detailed Description

Definition at line 59 of file G4TrackingManager.hh.

Constructor & Destructor Documentation

◆ G4TrackingManager()

G4TrackingManager::G4TrackingManager ( )

Definition at line 42 of file G4TrackingManager.cc.

44{
45 messenger = new G4TrackingMessenger(this);
46 fpSteppingManager = new G4SteppingManager();
47}

◆ ~G4TrackingManager()

G4TrackingManager::~G4TrackingManager ( )

Definition at line 50 of file G4TrackingManager.cc.

52{
53 delete messenger;
54 delete fpSteppingManager;
55 delete fpUserTrackingAction;
56}

Member Function Documentation

◆ EventAborted()

void G4TrackingManager::EventAborted ( )

Definition at line 170 of file G4TrackingManager.cc.

172{
173 fpTrack->SetTrackStatus(fKillTrackAndSecondaries);
174 EventIsAborted = true;
175}
@ fKillTrackAndSecondaries

◆ GetSteppingManager()

G4SteppingManager * G4TrackingManager::GetSteppingManager ( ) const
inline

Definition at line 138 of file G4TrackingManager.hh.

139{
140 return fpSteppingManager;
141}

Referenced by G4ErrorPropagator::G4ErrorPropagator(), and G4ErrorPropagatorManager::SetSteppingManagerVerboseLevel().

◆ GetStoreTrajectory()

G4int G4TrackingManager::GetStoreTrajectory ( ) const
inline

Definition at line 136 of file G4TrackingManager.hh.

136{ return StoreTrajectory; }

Referenced by G4VisManager::Disable().

◆ GetTrack()

G4Track * G4TrackingManager::GetTrack ( ) const
inline

Definition at line 134 of file G4TrackingManager.hh.

134{ return fpTrack; }

◆ GetUserTrackingAction()

G4UserTrackingAction * G4TrackingManager::GetUserTrackingAction ( ) const
inline

Definition at line 143 of file G4TrackingManager.hh.

144{
145 return fpUserTrackingAction;
146}

◆ GetVerboseLevel()

G4int G4TrackingManager::GetVerboseLevel ( ) const
inline

Definition at line 177 of file G4TrackingManager.hh.

177{ return verboseLevel; }

Referenced by G4ErrorPropagatorManager::SetSteppingManagerVerboseLevel().

◆ GimmeSecondaries()

G4TrackVector * G4TrackingManager::GimmeSecondaries ( ) const
inline

Definition at line 150 of file G4TrackingManager.hh.

151{
152 return fpSteppingManager->GetfSecondary();
153}

Referenced by ProcessOneTrack().

◆ GimmeTrajectory()

G4VTrajectory * G4TrackingManager::GimmeTrajectory ( ) const
inline

Definition at line 148 of file G4TrackingManager.hh.

148{ return fpTrajectory; }

◆ ProcessOneTrack()

void G4TrackingManager::ProcessOneTrack ( G4Track * apValueG4Track)

Definition at line 59 of file G4TrackingManager.cc.

61{
62 // Receiving a G4Track from the EventManager, this funciton has the
63 // responsibility to trace the track till it stops
64
65 fpTrack = apValueG4Track;
66 EventIsAborted = false;
67
68 // Clear secondary particle vector
69 //
70 for (auto& itr : *GimmeSecondaries()) {
71 delete itr;
72 }
73 GimmeSecondaries()->clear();
74
75 if (verboseLevel > 0 && (G4VSteppingVerbose::GetSilent() != 1)) TrackBanner();
76
77 // Give SteppingManger the pointer to the track which will be tracked
78 //
79 fpSteppingManager->SetInitialStep(fpTrack);
80
81 // Pre tracking user intervention process
82
83 fpTrajectory = nullptr;
84 if (fpUserTrackingAction != nullptr) {
85 fpUserTrackingAction->PreUserTrackingAction(fpTrack);
86 }
87
88 // we need this to scope the G4Track::ProfilerConfig b/t
89 // the PreUserTrackingAction and PostUserTrackingAction
90 {
91#ifdef G4_STORE_TRAJECTORY
92 // Construct a trajectory if it is requested
93 //
94 if ((StoreTrajectory != 0) && (fpTrajectory == nullptr)) {
95 // default trajectory concrete class object
96 switch (StoreTrajectory) {
97 default:
98 case 1:
99 fpTrajectory = new G4Trajectory(fpTrack);
100 break;
101 case 2:
102 fpTrajectory = new G4SmoothTrajectory(fpTrack);
103 break;
104 case 3:
105 fpTrajectory = new G4RichTrajectory(fpTrack);
106 break;
107 case 4:
108 fpTrajectory = new G4RichTrajectory(fpTrack);
109 break;
110 }
111 }
112#endif
113
114 // Give SteppingManger the maxmimum number of processes
115 fpSteppingManager->GetProcessNumber();
116
117 // Give track the pointer to the Step
118 fpTrack->SetStep(fpSteppingManager->GetStep());
119
120 // Inform beginning of tracking to physics processes
121 fpTrack->GetDefinition()->GetProcessManager()->StartTracking(fpTrack);
122
123 // Track the particle Step-by-Step while it is alive
124 //
125 while ((fpTrack->GetTrackStatus() == fAlive) || (fpTrack->GetTrackStatus() == fStopButAlive)) {
126 fpTrack->IncrementCurrentStepNumber();
127 fpSteppingManager->Stepping();
128#ifdef G4_STORE_TRAJECTORY
129 if (StoreTrajectory != 0) {
130 fpTrajectory->AppendStep(fpSteppingManager->GetStep());
131 }
132#endif
133 if (EventIsAborted) {
134 fpTrack->SetTrackStatus(fKillTrackAndSecondaries);
135 }
136 }
137 // Inform end of tracking to physics processes
138 fpTrack->GetDefinition()->GetProcessManager()->EndTracking();
139 }
140
141 // Post tracking user intervention process.
142 if (fpUserTrackingAction != nullptr) {
143 fpUserTrackingAction->PostUserTrackingAction(fpTrack);
144 }
145
146 // Destruct the trajectory if it was created
147#ifdef G4VERBOSE
148 if ((StoreTrajectory != 0) && verboseLevel > 10) {
149 fpTrajectory->ShowTrajectory();
150 }
151#endif
152 if ((StoreTrajectory == 0) && (fpTrajectory != nullptr)) {
153 delete fpTrajectory;
154 fpTrajectory = nullptr;
155 }
156}
@ fAlive
@ fStopButAlive
G4TrackVector * GimmeSecondaries() const

◆ SetStoreTrajectory()

void G4TrackingManager::SetStoreTrajectory ( G4int value)

Definition at line 194 of file G4TrackingManager.cc.

196{
197 StoreTrajectory = value;
198}

◆ SetTrajectory()

void G4TrackingManager::SetTrajectory ( G4VTrajectory * aTrajectory)

Definition at line 159 of file G4TrackingManager.cc.

161{
162#ifndef G4_STORE_TRAJECTORY
163 G4Exception("G4TrackingManager::SetTrajectory()", "Tracking0015", FatalException,
164 "Invoked without G4_STORE_TRAJECTORY option set!");
165#endif
166 fpTrajectory = aTrajectory;
167}
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)

◆ SetUserAction() [1/2]

void G4TrackingManager::SetUserAction ( G4UserSteppingAction * apAction)
inline

Definition at line 163 of file G4TrackingManager.hh.

164{
165 fpSteppingManager->SetUserAction(apAction);
166 if (apAction != nullptr) {
167 apAction->SetSteppingManagerPointer(fpSteppingManager);
168 }
169}
virtual void SetSteppingManagerPointer(G4SteppingManager *pValue)

◆ SetUserAction() [2/2]

void G4TrackingManager::SetUserAction ( G4UserTrackingAction * apAction)
inline

Definition at line 155 of file G4TrackingManager.hh.

156{
157 fpUserTrackingAction = apAction;
158 if (apAction != nullptr) {
159 apAction->SetTrackingManagerPointer(this);
160 }
161}
virtual void SetTrackingManagerPointer(G4TrackingManager *pValue)

◆ SetUserTrackInformation()

void G4TrackingManager::SetUserTrackInformation ( G4VUserTrackInformation * aValue)
inline

Definition at line 179 of file G4TrackingManager.hh.

180{
181 if (fpTrack != nullptr) fpTrack->SetUserInformation(aValue);
182}

◆ SetVerboseLevel()

void G4TrackingManager::SetVerboseLevel ( G4int vLevel)
inline

Definition at line 171 of file G4TrackingManager.hh.

172{
173 verboseLevel = vLevel;
174 fpSteppingManager->SetVerboseLevel(vLevel);
175}

The documentation for this class was generated from the following files: