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

#include <G4TrackingManager.hh>

Public Types

using ProfilerConfig = G4Track::ProfilerConfig
 

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.

Member Typedef Documentation

◆ ProfilerConfig

Constructor & Destructor Documentation

◆ G4TrackingManager()

G4TrackingManager::G4TrackingManager ( )

Definition at line 44 of file G4TrackingManager.cc.

46{
47 messenger = new G4TrackingMessenger(this);
48 fpSteppingManager = new G4SteppingManager();
49}

◆ ~G4TrackingManager()

G4TrackingManager::~G4TrackingManager ( )

Definition at line 52 of file G4TrackingManager.cc.

54{
55 delete messenger;
56 delete fpSteppingManager;
57 delete fpUserTrackingAction;
58}

Member Function Documentation

◆ EventAborted()

void G4TrackingManager::EventAborted ( )

Definition at line 176 of file G4TrackingManager.cc.

178{
180 EventIsAborted = true;
181}
@ fKillTrackAndSecondaries
void SetTrackStatus(const G4TrackStatus aTrackStatus)

Referenced by G4EventManager::AbortCurrentEvent().

◆ GetSteppingManager()

G4SteppingManager * G4TrackingManager::GetSteppingManager ( ) const
inline

◆ GetStoreTrajectory()

G4int G4TrackingManager::GetStoreTrajectory ( ) const
inline

Definition at line 139 of file G4TrackingManager.hh.

139{ return StoreTrajectory; }

Referenced by G4VisManager::Disable(), and G4TrackingMessenger::GetCurrentValue().

◆ GetTrack()

G4Track * G4TrackingManager::GetTrack ( ) const
inline

Definition at line 137 of file G4TrackingManager.hh.

137{ return fpTrack; }

◆ GetUserTrackingAction()

G4UserTrackingAction * G4TrackingManager::GetUserTrackingAction ( ) const
inline

Definition at line 148 of file G4TrackingManager.hh.

149{
150 return fpUserTrackingAction;
151}

◆ GetVerboseLevel()

G4int G4TrackingManager::GetVerboseLevel ( ) const
inline

Definition at line 182 of file G4TrackingManager.hh.

182{ return verboseLevel; }

Referenced by G4TrackingMessenger::GetCurrentValue(), and G4ErrorPropagatorManager::SetSteppingManagerVerboseLevel().

◆ GimmeSecondaries()

G4TrackVector * G4TrackingManager::GimmeSecondaries ( ) const
inline

Definition at line 155 of file G4TrackingManager.hh.

156{
157 return fpSteppingManager->GetfSecondary();
158}
G4TrackVector * GetfSecondary()

Referenced by ProcessOneTrack().

◆ GimmeTrajectory()

G4VTrajectory * G4TrackingManager::GimmeTrajectory ( ) const
inline

Definition at line 153 of file G4TrackingManager.hh.

153{ return fpTrajectory; }

◆ ProcessOneTrack()

void G4TrackingManager::ProcessOneTrack ( G4Track * apValueG4Track)

Definition at line 61 of file G4TrackingManager.cc.

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

◆ SetStoreTrajectory()

void G4TrackingManager::SetStoreTrajectory ( G4int value)
inline

Definition at line 141 of file G4TrackingManager.hh.

141{ StoreTrajectory = value; }

Referenced by G4TrackingMessenger::SetNewValue().

◆ SetTrajectory()

void G4TrackingManager::SetTrajectory ( G4VTrajectory * aTrajectory)

Definition at line 165 of file G4TrackingManager.cc.

167{
168#ifndef G4_STORE_TRAJECTORY
169 G4Exception("G4TrackingManager::SetTrajectory()", "Tracking0015", FatalException,
170 "Invoked without G4_STORE_TRAJECTORY option set!");
171#endif
172 fpTrajectory = aTrajectory;
173}
@ 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 168 of file G4TrackingManager.hh.

169{
170 fpSteppingManager->SetUserAction(apAction);
171 if (apAction != nullptr) {
172 apAction->SetSteppingManagerPointer(fpSteppingManager);
173 }
174}
void SetUserAction(G4UserSteppingAction *apAction)
virtual void SetSteppingManagerPointer(G4SteppingManager *pValue)

◆ SetUserAction() [2/2]

void G4TrackingManager::SetUserAction ( G4UserTrackingAction * apAction)
inline

Definition at line 160 of file G4TrackingManager.hh.

161{
162 fpUserTrackingAction = apAction;
163 if (apAction != nullptr) {
164 apAction->SetTrackingManagerPointer(this);
165 }
166}
virtual void SetTrackingManagerPointer(G4TrackingManager *pValue)

Referenced by G4EventManager::SetUserAction(), and G4EventManager::SetUserAction().

◆ SetUserTrackInformation()

void G4TrackingManager::SetUserTrackInformation ( G4VUserTrackInformation * aValue)
inline

Definition at line 184 of file G4TrackingManager.hh.

185{
186 if (fpTrack != nullptr) fpTrack->SetUserInformation(aValue);
187}
void SetUserInformation(G4VUserTrackInformation *aValue) const

◆ SetVerboseLevel()

void G4TrackingManager::SetVerboseLevel ( G4int vLevel)
inline

Definition at line 176 of file G4TrackingManager.hh.

177{
178 verboseLevel = vLevel;
179 fpSteppingManager->SetVerboseLevel(vLevel);
180}
void SetVerboseLevel(G4int vLevel)

Referenced by G4TrackingMessenger::SetNewValue().


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