Geant4 10.7.0
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 43 of file G4TrackingManager.cc.

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

◆ ~G4TrackingManager()

G4TrackingManager::~G4TrackingManager ( )

Definition at line 51 of file G4TrackingManager.cc.

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

Member Function Documentation

◆ EventAborted()

void G4TrackingManager::EventAborted ( )

Definition at line 187 of file G4TrackingManager.cc.

189{
191 EventIsAborted = true;
192}
@ 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 145 of file G4TrackingManager.hh.

146{
147 return StoreTrajectory;
148}

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

◆ GetTrack()

G4Track * G4TrackingManager::GetTrack ( ) const
inline

Definition at line 140 of file G4TrackingManager.hh.

141{
142 return fpTrack;
143}

◆ GetUserTrackingAction()

G4UserTrackingAction * G4TrackingManager::GetUserTrackingAction ( ) const
inline

Definition at line 160 of file G4TrackingManager.hh.

161{
162 return fpUserTrackingAction;
163}

◆ GetVerboseLevel()

G4int G4TrackingManager::GetVerboseLevel ( ) const
inline

Definition at line 199 of file G4TrackingManager.hh.

200{
201 return verboseLevel;
202}

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

◆ GimmeSecondaries()

G4TrackVector * G4TrackingManager::GimmeSecondaries ( ) const
inline

Definition at line 170 of file G4TrackingManager.hh.

171{
172 return fpSteppingManager->GetfSecondary();
173}
G4TrackVector * GetfSecondary()

Referenced by ProcessOneTrack().

◆ GimmeTrajectory()

G4VTrajectory * G4TrackingManager::GimmeTrajectory ( ) const
inline

Definition at line 165 of file G4TrackingManager.hh.

166{
167 return fpTrajectory;
168}

◆ ProcessOneTrack()

void G4TrackingManager::ProcessOneTrack ( G4Track apValueG4Track)

Definition at line 60 of file G4TrackingManager.cc.

62{
63 // Receiving a G4Track from the EventManager, this funciton has the
64 // responsibility to trace the track till it stops
65
66 fpTrack = apValueG4Track;
67 EventIsAborted = false;
68
69 // Clear secondary particle vector
70 //
71 for(std:: size_t itr=0; itr<GimmeSecondaries()->size(); ++itr)
72 {
73 delete (*GimmeSecondaries())[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 {
88 fpUserTrackingAction->PreUserTrackingAction(fpTrack);
89 }
90
91 // we need this to scope the G4Track::ProfilerConfig b/t
92 // the PreUserTrackingAction and PostUserTrackingAction
93 {
94#if defined(GEANT4_USE_TIMEMORY)
95 ProfilerConfig profiler{ fpTrack };
96#endif
97
98#ifdef G4_STORE_TRAJECTORY
99 // Construct a trajectory if it is requested
100 //
101 if(StoreTrajectory && (fpTrajectory == nullptr))
102 {
103 // default trajectory concrete class object
104 switch(StoreTrajectory)
105 {
106 default:
107 case 1:
108 fpTrajectory = new G4Trajectory(fpTrack);
109 break;
110 case 2:
111 fpTrajectory = new G4SmoothTrajectory(fpTrack);
112 break;
113 case 3:
114 fpTrajectory = new G4RichTrajectory(fpTrack);
115 break;
116 case 4:
117 fpTrajectory = new G4RichTrajectory(fpTrack);
118 break;
119 }
120 }
121#endif
122
123 // Give SteppingManger the maxmimum number of processes
124 fpSteppingManager->GetProcessNumber();
125
126 // Give track the pointer to the Step
127 fpTrack->SetStep(fpSteppingManager->GetStep());
128
129 // Inform beginning of tracking to physics processes
130 fpTrack->GetDefinition()->GetProcessManager()->StartTracking(fpTrack);
131
132 // Track the particle Step-by-Step while it is alive
133 //
134 while((fpTrack->GetTrackStatus() == fAlive) ||
135 (fpTrack->GetTrackStatus() == fStopButAlive))
136 {
138 fpSteppingManager->Stepping();
139#ifdef G4_STORE_TRAJECTORY
140 if(StoreTrajectory)
141 {
142 fpTrajectory->AppendStep(fpSteppingManager->GetStep());
143 }
144#endif
145 if(EventIsAborted)
146 {
148 }
149 }
150 // Inform end of tracking to physics processes
152 }
153
154 // Post tracking user intervention process.
155 if( fpUserTrackingAction != nullptr )
156 {
157 fpUserTrackingAction->PostUserTrackingAction(fpTrack);
158 }
159
160 // Destruct the trajectory if it was created
161#ifdef G4VERBOSE
162 if(StoreTrajectory&&verboseLevel>10)
163 {
164 fpTrajectory->ShowTrajectory();
165 }
166#endif
167 if( (!StoreTrajectory) && (fpTrajectory != nullptr) )
168 {
169 delete fpTrajectory;
170 fpTrajectory = nullptr;
171 }
172}
@ 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 *)
static G4int GetSilent()
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 150 of file G4TrackingManager.hh.

151{
152 StoreTrajectory = value;
153}

Referenced by G4TrackingMessenger::SetNewValue().

◆ SetTrajectory()

void G4TrackingManager::SetTrajectory ( G4VTrajectory aTrajectory)

Definition at line 175 of file G4TrackingManager.cc.

177{
178#ifndef G4_STORE_TRAJECTORY
179 G4Exception("G4TrackingManager::SetTrajectory()",
180 "Tracking0015", FatalException,
181 "Invoked without G4_STORE_TRAJECTORY option set!");
182#endif
183 fpTrajectory = aTrajectory;
184}
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:35

◆ SetUserAction() [1/2]

void G4TrackingManager::SetUserAction ( G4UserSteppingAction apAction)
inline

Definition at line 184 of file G4TrackingManager.hh.

185{
186 fpSteppingManager->SetUserAction(apAction);
187 if(apAction != nullptr)
188 {
189 apAction->SetSteppingManagerPointer(fpSteppingManager);
190 }
191}
void SetUserAction(G4UserSteppingAction *apAction)
virtual void SetSteppingManagerPointer(G4SteppingManager *pValue)

◆ SetUserAction() [2/2]

void G4TrackingManager::SetUserAction ( G4UserTrackingAction apAction)
inline

Definition at line 175 of file G4TrackingManager.hh.

176{
177 fpUserTrackingAction = apAction;
178 if(apAction != nullptr)
179 {
180 apAction->SetTrackingManagerPointer(this);
181 }
182}
virtual void SetTrackingManagerPointer(G4TrackingManager *pValue)

Referenced by G4EventManager::SetUserAction().

◆ SetUserTrackInformation()

void G4TrackingManager::SetUserTrackInformation ( G4VUserTrackInformation aValue)
inline

Definition at line 205 of file G4TrackingManager.hh.

206{
207 if(fpTrack != nullptr) fpTrack->SetUserInformation(aValue);
208}
void SetUserInformation(G4VUserTrackInformation *aValue) const

◆ SetVerboseLevel()

void G4TrackingManager::SetVerboseLevel ( G4int  vLevel)
inline

Definition at line 193 of file G4TrackingManager.hh.

194{
195 verboseLevel = vLevel;
196 fpSteppingManager -> SetVerboseLevel( vLevel );
197}
void SetVerboseLevel(G4int vLevel)

Referenced by G4TrackingMessenger::SetNewValue(), and SetVerboseLevel().


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