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
G4_Tracking_EIC.C
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file G4_Tracking_EIC.C
1
#ifndef MACRO_G4TRACKINGEIC_C
2
#define MACRO_G4TRACKINGEIC_C
3
4
#include <
GlobalVariables.C
>
5
6
#include <
g4trackfastsim/PHG4TrackFastSim.h
>
7
8
#include <
trackreco/PHRaveVertexing.h
>
9
10
#include <
g4trackfastsim/PHG4TrackFastSimEval.h
>
11
12
#include <
fun4all/Fun4AllServer.h
>
13
14
#include <vector>
15
16
R__LOAD_LIBRARY
(libtrack_reco.so)
17
R__LOAD_LIBRARY
(libg4trackfastsim.so)
18
19
namespace Enable
20
{
21
bool
TRACKING
=
false
;
22
bool
TRACKING_EVAL
=
false
;
23
int
TRACKING_VERBOSITY
= 0;
24
}
// namespace Enable
25
26
namespace
G4TRACKING
27
{
28
bool
DISPLACED_VERTEX
=
false
;
29
bool
PROJECTION_EEMC
=
false
;
30
bool
PROJECTION_EHCAL
=
false
;
31
bool
PROJECTION_CEMC
=
false
;
32
bool
PROJECTION_BECAL
=
false
;
33
bool
PROJECTION_HCALIN
=
false
;
34
bool
PROJECTION_HCALOUT
=
false
;
35
bool
PROJECTION_FEMC
=
false
;
36
bool
PROJECTION_FHCAL
=
false
;
37
bool
PROJECTION_LFHCAL
=
false
;
38
}
// namespace G4TRACKING
39
40
//-----------------------------------------------------------------------------//
41
void
TrackingInit
()
42
{
43
TRACKING::FastKalmanFilter
=
new
PHG4TrackFastSim
(
"PHG4TrackFastSim"
);
44
TRACKING::FastKalmanFilterSiliconTrack
=
new
PHG4TrackFastSim
(
"FastKalmanFilterSiliconTrack"
);
45
TRACKING::FastKalmanFilterInnerTrack
=
new
PHG4TrackFastSim
(
"FastKalmanFilterInnerTrack"
);
46
}
47
48
void
InitFastKalmanFilter
(
PHG4TrackFastSim
*kalman_filter)
49
{
50
// kalman_filter->Smearing(false);
51
if
(
G4TRACKING::DISPLACED_VERTEX
)
52
{
53
// do not use truth vertex in the track fitting,
54
// which would lead to worse momentum resolution for prompt tracks
55
// but this allows displaced track analysis including DCA and vertex finding
56
kalman_filter->
set_use_vertex_in_fitting
(
false
);
57
kalman_filter->
set_vertex_xy_resolution
(0);
// do not smear the vertex used in the built-in DCA calculation
58
kalman_filter->
set_vertex_z_resolution
(0);
// do not smear the vertex used in the built-in DCA calculation
59
kalman_filter->
enable_vertexing
(
true
);
// enable vertex finding and fitting
60
}
61
else
62
{
63
// constraint to a primary vertex and use it as part of the fitting level arm
64
kalman_filter->
set_use_vertex_in_fitting
(
true
);
65
kalman_filter->
set_vertex_xy_resolution
(50
e
-4);
66
kalman_filter->
set_vertex_z_resolution
(50
e
-4);
67
}
68
69
kalman_filter->
set_sub_top_node_name
(
"TRACKS"
);
70
}
71
72
//-----------------------------------------------------------------------------//
73
void
Tracking_Reco
()
74
{
75
int
verbosity =
std::max
(
Enable::VERBOSITY
,
Enable::TRACKING_VERBOSITY
);
76
//---------------
77
// Fun4All server
78
//---------------
79
80
Fun4AllServer
*se =
Fun4AllServer::instance
();
81
82
if
(
TRACKING::FastKalmanFilter
==
nullptr
)
83
{
84
cout << __PRETTY_FUNCTION__ <<
" : missing the expected initialization for TRACKING::FastKalmanFilter."
<< endl;
85
exit
(1);
86
}
87
88
InitFastKalmanFilter
(
TRACKING::FastKalmanFilter
);
89
TRACKING::FastKalmanFilter
->
Verbosity
(verbosity);
90
TRACKING::FastKalmanFilter
->
set_trackmap_out_name
(
TRACKING::TrackNodeName
);
91
92
//-------------------------
93
// FEMC
94
//-------------------------
95
// Saved track states (projections)
96
if
(
Enable::FEMC
&&
G4TRACKING::PROJECTION_FEMC
)
97
{
98
TRACKING::FastKalmanFilter
->
add_state_name
(
"FEMC"
);
99
TRACKING::ProjectionNames
.insert(
"FEMC"
);
100
}
101
102
//-------------------------
103
// FHCAL
104
//-------------------------
105
if
(
Enable::FHCAL
&&
G4TRACKING::PROJECTION_FHCAL
)
106
{
107
TRACKING::FastKalmanFilter
->
add_state_name
(
"FHCAL"
);
108
TRACKING::ProjectionNames
.insert(
"FHCAL"
);
109
}
110
//-------------------------
111
// LFHCAL
112
//-------------------------
113
if
(
Enable::LFHCAL
&&
G4TRACKING::PROJECTION_LFHCAL
)
114
{
115
TRACKING::FastKalmanFilter
->
add_state_name
(
"LFHCAL"
);
116
TRACKING::ProjectionNames
.insert(
"LFHCAL"
);
117
}
118
//-------------------------
119
// CEMC
120
//-------------------------
121
if
(
Enable::CEMC
&&
G4TRACKING::PROJECTION_CEMC
)
122
{
123
TRACKING::FastKalmanFilter
->
add_state_name
(
"CEMC"
);
124
TRACKING::ProjectionNames
.insert(
"CEMC"
);
125
}
126
//-------------------------
127
// BECAL
128
//-------------------------
129
if
(
Enable::BECAL
&&
G4TRACKING::PROJECTION_BECAL
)
130
{
131
TRACKING::FastKalmanFilter
->
add_state_name
(
"BECAL"
);
132
TRACKING::ProjectionNames
.insert(
"BECAL"
);
133
}
134
//-------------------------
135
// HCALIN
136
//-------------------------
137
if
(
Enable::HCALIN
&&
G4TRACKING::PROJECTION_HCALIN
)
138
{
139
TRACKING::FastKalmanFilter
->
add_state_name
(
"HCALIN"
);
140
TRACKING::ProjectionNames
.insert(
"HCALIN"
);
141
}
142
//-------------------------
143
// HCALOUT
144
//-------------------------
145
if
(
Enable::HCALOUT
&&
G4TRACKING::PROJECTION_HCALOUT
)
146
{
147
TRACKING::FastKalmanFilter
->
add_state_name
(
"HCALOUT"
);
148
TRACKING::ProjectionNames
.insert(
"HCALOUT"
);
149
}
150
//-------------------------
151
// EEMC
152
//-------------------------
153
if
((
Enable::EEMC
or
Enable::EEMCH
)&&
G4TRACKING::PROJECTION_EEMC
)
154
{
155
TRACKING::FastKalmanFilter
->
add_state_name
(
"EEMC"
);
156
TRACKING::ProjectionNames
.insert(
"EEMC"
);
157
}
158
//-------------------------
159
// EHCAL
160
//-------------------------
161
if
(
Enable::EHCAL
&&
G4TRACKING::PROJECTION_EHCAL
)
162
{
163
TRACKING::FastKalmanFilter
->
add_state_name
(
"EHCAL"
);
164
TRACKING::ProjectionNames
.insert(
"EHCAL"
);
165
}
166
167
se->
registerSubsystem
(
TRACKING::FastKalmanFilter
);
168
169
// next, tracks with partial usage of the tracker stack
170
if
(
TRACKING::FastKalmanFilterInnerTrack
==
nullptr
)
171
{
172
cout << __PRETTY_FUNCTION__ <<
" : missing the expected initialization for TRACKING::FastKalmanFilterInnerTrack."
<< endl;
173
exit
(1);
174
}
175
InitFastKalmanFilter
(
TRACKING::FastKalmanFilterInnerTrack
);
176
TRACKING::FastKalmanFilterInnerTrack
->
Verbosity
(verbosity);
177
TRACKING::FastKalmanFilterInnerTrack
->
set_trackmap_out_name
(
"InnerTrackMap"
);
178
TRACKING::FastKalmanFilterInnerTrack
->
enable_vertexing
(
false
);
179
se->
registerSubsystem
(
TRACKING::FastKalmanFilterInnerTrack
);
180
181
if
(
TRACKING::FastKalmanFilterSiliconTrack
==
nullptr
)
182
{
183
cout << __PRETTY_FUNCTION__ <<
" : missing the expected initialization for TRACKING::FastKalmanFilterSiliconTrack."
<< endl;
184
exit
(1);
185
}
186
InitFastKalmanFilter
(
TRACKING::FastKalmanFilterSiliconTrack
);
187
TRACKING::FastKalmanFilterSiliconTrack
->
Verbosity
(verbosity);
188
TRACKING::FastKalmanFilterSiliconTrack
->
set_trackmap_out_name
(
"SiliconTrackMap"
);
189
TRACKING::FastKalmanFilterSiliconTrack
->
enable_vertexing
(
false
);
190
se->
registerSubsystem
(
TRACKING::FastKalmanFilterSiliconTrack
);
191
return
;
192
}
193
194
//-----------------------------------------------------------------------------//
195
196
void
Tracking_Eval
(
const
std::string &outputfile)
197
{
198
int
verbosity =
std::max
(
Enable::VERBOSITY
,
Enable::TRACKING_VERBOSITY
);
199
//---------------
200
// Fun4All server
201
//---------------
202
203
Fun4AllServer
*se =
Fun4AllServer::instance
();
204
205
//----------------
206
// Fast Tracking evaluation
207
//----------------
208
209
PHG4TrackFastSimEval
*fast_sim_eval =
new
PHG4TrackFastSimEval
(
"FastTrackingEval"
);
210
fast_sim_eval->
set_trackmapname
(
TRACKING::TrackNodeName
);
211
fast_sim_eval->
set_filename
(outputfile);
212
fast_sim_eval->
Verbosity
(verbosity);
213
//-------------------------
214
// FEMC
215
//-------------------------
216
217
cout <<
"Tracking_Eval(): configuration of track projections in PHG4TrackFastSimEval"
<< endl;
218
cout <<
"/*std::set<std::string>*/ TRACKING::ProjectionNames = {"
;
219
bool
first =
true
;
220
for
(
const
string
&
proj
:
TRACKING::ProjectionNames
)
221
{
222
if
(first)
223
first =
false
;
224
else
225
cout <<
", "
;
226
cout <<
"\""
<<
proj
<<
"\""
;
227
228
fast_sim_eval->
AddProjection
(proj);
229
}
230
cout <<
"};"
<< endl;
// override the TRACKING::ProjectionNames in eval macros
231
232
se->
registerSubsystem
(fast_sim_eval);
233
234
// now partial track fits
235
fast_sim_eval =
new
PHG4TrackFastSimEval
(
"FastTrackingEval_InnerTrackMap"
);
236
fast_sim_eval->
set_trackmapname
(
"InnerTrackMap"
);
237
fast_sim_eval->
set_filename
(outputfile +
".InnerTrackMap.root"
);
238
fast_sim_eval->
Verbosity
(verbosity);
239
se->
registerSubsystem
(fast_sim_eval);
240
241
fast_sim_eval =
new
PHG4TrackFastSimEval
(
"FastTrackingEval_SiliconTrackMap"
);
242
fast_sim_eval->
set_trackmapname
(
"SiliconTrackMap"
);
243
fast_sim_eval->
set_filename
(outputfile +
".SiliconTrackMap.root"
);
244
fast_sim_eval->
Verbosity
(verbosity);
245
se->
registerSubsystem
(fast_sim_eval);
246
}
247
#endif
macros
blob
master
common
G4_Tracking_EIC.C
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:25:58
using
1.8.2 with
ECCE GitHub integration