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
ITTrackingInteractivity.cc
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file ITTrackingInteractivity.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
//
29
30
#include "ITTrackingInteractivity.hh"
31
#include "
G4TrackingInformation.hh
"
32
#include "
G4VTrajectory.hh
"
33
#include "
G4Trajectory.hh
"
34
#include "
G4SmoothTrajectory.hh
"
35
#include "
G4RichTrajectory.hh
"
36
#include "
G4UserTrackingAction.hh
"
37
#include "
G4UserSteppingAction.hh
"
38
#include "
G4IT.hh
"
39
#include "
G4EventManager.hh
"
40
#include "
G4Event.hh
"
41
#include "
G4VSteppingVerbose.hh
"
42
#include "
G4VisManager.hh
"
43
44
class
G4Trajectory_Lock
45
{
46
friend
class
ITTrackingInteractivity
;
47
G4Trajectory_Lock
()
48
:
fpTrajectory
(0)
49
{;}
50
51
~G4Trajectory_Lock
()
52
{;}
53
54
G4VTrajectory
*
fpTrajectory
;
55
};
56
57
ITTrackingInteractivity::ITTrackingInteractivity
()
58
:
G4ITTrackingInteractivity
()
59
,
fStoreTrajectory
(0)
60
{
61
fpUserTrackingAction
.reset(
62
G4EventManager::GetEventManager
()->
63
GetTrackingManager()->
GetUserTrackingAction
());
64
}
65
66
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
67
68
ITTrackingInteractivity::~ITTrackingInteractivity
()
69
{}
70
71
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
72
73
void
ITTrackingInteractivity::Initialize
()
74
{
75
G4TrackingManager
* trackingManager =
76
G4EventManager::GetEventManager
()->
GetTrackingManager
();
77
fStoreTrajectory
= trackingManager->
GetStoreTrajectory
();
78
fVerboseLevel
= trackingManager->
GetVerboseLevel
();
79
}
80
81
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
82
83
void
ITTrackingInteractivity::StartTracking
(
G4Track
*
track
)
84
{
85
#ifdef G4VERBOSE
86
if
(
fVerboseLevel
)
87
{
88
TrackBanner
(track,
"G4ITTrackingManager::StartTracking : "
);
89
}
90
#endif
91
92
if
(
fVerboseLevel
>0 &&
93
(
G4VSteppingVerbose::GetSilent
()!=1) )
94
{
95
TrackBanner
(track);
96
}
97
if
(
fpUserTrackingAction
!=
nullptr
)
98
{
99
fpUserTrackingAction
->
PreUserTrackingAction
(track);
100
}
101
102
G4TrackingInformation
* trackingInfo =
GetIT
(track)->
GetTrackingInfo
();
103
G4Trajectory_Lock
* trajectory_lock = trackingInfo->
GetTrajectory_Lock
();
104
105
if
(
fStoreTrajectory
&& (!trajectory_lock))
106
{
107
trajectory_lock =
new
G4Trajectory_Lock
();
108
trackingInfo->
SetTrajectory_Lock
(trajectory_lock);
109
G4VTrajectory
* trajectory = 0;
110
switch
(
fStoreTrajectory
)
111
{
112
default
:
113
case
1: trajectory =
new
G4Trajectory
(track);
break
;
114
case
2: trajectory =
new
G4SmoothTrajectory
(track);
break
;
115
case
3: trajectory =
new
G4RichTrajectory
(track);
break
;
116
}
117
trajectory_lock->
fpTrajectory
= trajectory;
118
}
119
}
120
121
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
122
123
void
124
ITTrackingInteractivity::AppendStep
(
G4Track
* track,
G4Step
*
step
)
125
{
126
if
(
fpUserSteppingAction
!=
nullptr
)
127
{
128
fpUserSteppingAction
->
UserSteppingAction
(step);
129
}
130
131
if
(
fStoreTrajectory
)
132
{
133
G4TrackingInformation
* trackingInfo =
GetIT
(track)->
GetTrackingInfo
();
134
G4Trajectory_Lock
* trajectory_lock = trackingInfo->
GetTrajectory_Lock
();
135
trajectory_lock->
fpTrajectory
->
AppendStep
(step);
136
}
137
}
138
139
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
140
141
void
ITTrackingInteractivity::EndTracking
(
G4Track
* track)
142
{
143
#ifdef G4VERBOSE
144
if
(
fVerboseLevel
)
145
{
146
TrackBanner
(track,
"G4ITTrackingManager::EndTracking : "
);
147
}
148
#endif
149
if
(
fpUserTrackingAction
!=
nullptr
)
150
{
151
fpUserTrackingAction
->
PostUserTrackingAction
(track);
152
}
153
G4TrackingInformation
* trackingInfo =
GetIT
(track)->
GetTrackingInfo
();
154
G4Trajectory_Lock
* trajectory_lock = trackingInfo->
GetTrajectory_Lock
();
155
156
if
(trajectory_lock)
157
{
158
G4VTrajectory
*& trajectory = trajectory_lock->
fpTrajectory
;
159
160
if
(
fStoreTrajectory
&& trajectory)
161
{
162
#ifdef G4VERBOSE
163
if
(
fVerboseLevel
>10)
164
{
165
trajectory->
ShowTrajectory
();
166
}
167
#endif
168
G4TrackStatus
istop = track->
GetTrackStatus
();
169
170
if
(trajectory && (istop !=
fStopButAlive
) &&
171
(istop !=
fSuspend
))
172
{
173
G4Event
* currentEvent =
G4EventManager::GetEventManager
()
174
->
GetNonconstCurrentEvent
();
175
if
(currentEvent !=
nullptr
)
176
{
177
G4TrajectoryContainer
* trajectoryContainer =
178
currentEvent->
GetTrajectoryContainer
();
179
if
(!trajectoryContainer)
180
{
181
trajectoryContainer =
new
G4TrajectoryContainer
;
182
currentEvent->
183
SetTrajectoryContainer(trajectoryContainer);
184
}
185
trajectoryContainer->
insert
(trajectory);
186
}
187
else
188
{
189
fTrajectories
.push_back(trajectory);
190
}
191
}
192
}
193
else
if
( (!
fStoreTrajectory
)&&trajectory )
194
{
195
delete
trajectory;
196
trajectory =
nullptr
;
197
}
198
delete
trajectory_lock;
199
trackingInfo->
SetTrajectory_Lock
(0);
200
}
201
}
202
203
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
204
205
void
ITTrackingInteractivity::Finalize
()
206
{
207
for
(std::vector<G4VTrajectory*>::iterator
it
=
208
fTrajectories
.begin();
209
it
!=
fTrajectories
.end();
it
++)
210
{
211
G4VisManager::GetConcreteInstance
()->
Draw
(**
it
);
212
}
213
}
geant4
tree
geant4-10.6-release
examples
extended
medical
dna
dnadamage1
src
ITTrackingInteractivity.cc
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:25:07
using
1.8.2 with
ECCE GitHub integration