ECCE @ EIC Software
Reference for
ECCE @ EIC
simulation and reconstruction software on GitHub
Home page
Related Pages
Modules
Namespaces
Classes
Files
External Links
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
G4TrackingManager.cc
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file G4TrackingManager.cc
1
//
2
// ********************************************************************
3
// * License and Disclaimer *
4
// * *
5
// * The Geant4 software is copyright of the Copyright Holders of *
6
// * the Geant4 Collaboration. It is provided under the terms and *
7
// * conditions of the Geant4 Software License, included in the file *
8
// * LICENSE and available at http://cern.ch/geant4/license . These *
9
// * include a list of copyright holders. *
10
// * *
11
// * Neither the authors of this software system, nor their employing *
12
// * institutes,nor the agencies providing financial support for this *
13
// * work make any representation or warranty, express or implied, *
14
// * regarding this software system or assume any liability for its *
15
// * use. Please see the license in the file LICENSE and URL above *
16
// * for the full disclaimer and the limitation of liability. *
17
// * *
18
// * This code implementation is the result of the scientific and *
19
// * technical work of the GEANT4 collaboration. *
20
// * By using, copying, modifying or distributing the software (or *
21
// * any work based on the software) you agree to acknowledge its *
22
// * use in resulting scientific publications, and indicate your *
23
// * acceptance of all terms of the Geant4 Software license. *
24
// ********************************************************************
25
//
26
//
27
//
28
//---------------------------------------------------------------
29
//
30
// G4TrackingManager.cc
31
//
32
// Contact:
33
// Questions and comments to this code should be sent to
34
// Katsuya Amako (e-mail: Katsuya.Amako@kek.jp)
35
// Takashi Sasaki (e-mail: Takashi.Sasaki@kek.jp)
36
//
37
//---------------------------------------------------------------
38
39
#include "
G4TrackingManager.hh
"
40
#include "
G4Trajectory.hh
"
41
#include "
G4SmoothTrajectory.hh
"
42
#include "
G4RichTrajectory.hh
"
43
#include "
G4ios.hh
"
44
class
G4VSteppingVerbose
;
45
47
G4TrackingManager::G4TrackingManager
()
49
: fpUserTrackingAction(0), fpTrajectory(0),
50
StoreTrajectory(0),
verboseLevel
(0), EventIsAborted(
false
)
51
{
52
fpSteppingManager
=
new
G4SteppingManager
();
53
messenger
=
new
G4TrackingMessenger
(
this
);
54
}
55
57
G4TrackingManager::~G4TrackingManager
()
59
{
60
delete
messenger
;
61
delete
fpSteppingManager
;
62
if
(
fpUserTrackingAction
)
delete
fpUserTrackingAction
;
63
}
64
66
void
G4TrackingManager::ProcessOneTrack
(
G4Track
* apValueG4Track)
68
{
69
70
// Receiving a G4Track from the EventManager, this funciton has the
71
// responsibility to trace the track till it stops.
72
fpTrack
= apValueG4Track;
73
EventIsAborted
=
false
;
74
75
// Clear 2ndary particle vector
76
// GimmeSecondaries()->clearAndDestroy();
77
// std::vector<G4Track*>::iterator itr;
78
size_t
itr;
79
// for(itr=GimmeSecondaries()->begin();itr=GimmeSecondaries()->end();itr++){
80
for
(itr=0;itr<
GimmeSecondaries
()->size();itr++){
81
delete
(*
GimmeSecondaries
())[itr];
82
}
83
GimmeSecondaries
()->clear();
84
85
if
(
verboseLevel
>0 && (
G4VSteppingVerbose::GetSilent
()!=1) )
TrackBanner
();
86
87
// Give SteppingManger the pointer to the track which will be tracked
88
fpSteppingManager
->
SetInitialStep
(
fpTrack
);
89
90
// Pre tracking user intervention process.
91
fpTrajectory
= 0;
92
if
(
fpUserTrackingAction
!= 0 ) {
93
fpUserTrackingAction
->
PreUserTrackingAction
(
fpTrack
);
94
}
95
#ifdef G4_STORE_TRAJECTORY
96
// Construct a trajectory if it is requested
97
if
(
StoreTrajectory
&&(!
fpTrajectory
)) {
98
// default trajectory concrete class object
99
switch
(
StoreTrajectory
) {
100
default
:
101
case
1:
fpTrajectory
=
new
G4Trajectory
(
fpTrack
);
break
;
102
case
2:
fpTrajectory
=
new
G4SmoothTrajectory
(
fpTrack
);
break
;
103
case
3:
fpTrajectory
=
new
G4RichTrajectory
(
fpTrack
);
break
;
104
case
4:
fpTrajectory
=
new
G4RichTrajectory
(
fpTrack
);
break
;
105
}
106
}
107
#endif
108
109
// Give SteppingManger the maxmimum number of processes
110
fpSteppingManager
->
GetProcessNumber
();
111
112
// Give track the pointer to the Step
113
fpTrack
->
SetStep
(
fpSteppingManager
->
GetStep
());
114
115
// Inform beginning of tracking to physics processes
116
fpTrack
->
GetDefinition
()->
GetProcessManager
()->
StartTracking
(
fpTrack
);
117
118
// Track the particle Step-by-Step while it is alive
119
// G4StepStatus stepStatus;
120
121
while
( (
fpTrack
->
GetTrackStatus
() ==
fAlive
) ||
122
(
fpTrack
->
GetTrackStatus
() ==
fStopButAlive
) ){
123
124
fpTrack
->
IncrementCurrentStepNumber
();
125
fpSteppingManager
->
Stepping
();
126
#ifdef G4_STORE_TRAJECTORY
127
if
(
StoreTrajectory
)
fpTrajectory
->
128
AppendStep(
fpSteppingManager
->
GetStep
());
129
#endif
130
if
(
EventIsAborted
) {
131
fpTrack
->
SetTrackStatus
(
fKillTrackAndSecondaries
);
132
}
133
}
134
// Inform end of tracking to physics processes
135
fpTrack
->
GetDefinition
()->
GetProcessManager
()->
EndTracking
();
136
137
// Post tracking user intervention process.
138
if
(
fpUserTrackingAction
!= 0 ) {
139
fpUserTrackingAction
->
PostUserTrackingAction
(
fpTrack
);
140
}
141
142
// Destruct the trajectory if it was created
143
#ifdef G4VERBOSE
144
if
(
StoreTrajectory
&&
verboseLevel
>10)
fpTrajectory
->
ShowTrajectory
();
145
#endif
146
if
( (!
StoreTrajectory
)&&
fpTrajectory
) {
147
delete
fpTrajectory
;
148
fpTrajectory
= 0;
149
}
150
}
151
152
void
G4TrackingManager::SetTrajectory
(
G4VTrajectory
* aTrajectory)
153
{
154
#ifndef G4_STORE_TRAJECTORY
155
G4Exception
(
"G4TrackingManager::SetTrajectory()"
,
156
"Tracking0015"
,
FatalException
,
157
"Invoked without G4_STORE_TRAJECTORY option set!"
);
158
#endif
159
fpTrajectory
= aTrajectory;
160
}
161
163
void
G4TrackingManager::EventAborted
()
165
{
166
fpTrack
->
SetTrackStatus
(
fKillTrackAndSecondaries
);
167
EventIsAborted
=
true
;
168
}
169
170
171
void
G4TrackingManager::TrackBanner
()
172
{
173
G4cout
<<
G4endl
;
174
G4cout
<<
"*******************************************************"
175
<<
"**************************************************"
176
<<
G4endl
;
177
G4cout
<<
"* G4Track Information: "
178
<<
" Particle = "
<<
fpTrack
->
GetDefinition
()->
GetParticleName
()
179
<<
","
180
<<
" Track ID = "
<<
fpTrack
->
GetTrackID
()
181
<<
","
182
<<
" Parent ID = "
<<
fpTrack
->
GetParentID
()
183
<<
G4endl
;
184
G4cout
<<
"*******************************************************"
185
<<
"**************************************************"
186
<<
G4endl
;
187
G4cout
<<
G4endl
;
188
}
189
190
191
192
193
194
195
geant4
tree
geant4-10.6-release
source
tracking
src
G4TrackingManager.cc
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:25:54
using
1.8.2 with
ECCE GitHub integration