ECCE @ EIC Software
 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 
7 
9 
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;
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 //-----------------------------------------------------------------------------//
42 {
43  TRACKING::FastKalmanFilter = new PHG4TrackFastSim("PHG4TrackFastSim");
44  TRACKING::FastKalmanFilterSiliconTrack = new PHG4TrackFastSim("FastKalmanFilterSiliconTrack");
45  TRACKING::FastKalmanFilterInnerTrack = new PHG4TrackFastSim("FastKalmanFilterInnerTrack");
46 }
47 
49 {
50  // kalman_filter->Smearing(false);
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(50e-4);
66  kalman_filter->set_vertex_z_resolution(50e-4);
67  }
68 
69  kalman_filter->set_sub_top_node_name("TRACKS");
70 }
71 
72 //-----------------------------------------------------------------------------//
74 {
76  //---------------
77  // Fun4All server
78  //---------------
79 
81 
82  if (TRACKING::FastKalmanFilter == nullptr)
83  {
84  cout << __PRETTY_FUNCTION__ << " : missing the expected initialization for TRACKING::FastKalmanFilter." << endl;
85  exit(1);
86  }
87 
91 
92  //-------------------------
93  // FEMC
94  //-------------------------
95  // Saved track states (projections)
97  {
99  TRACKING::ProjectionNames.insert("FEMC");
100  }
101 
102  //-------------------------
103  // FHCAL
104  //-------------------------
106  {
108  TRACKING::ProjectionNames.insert("FHCAL");
109  }
110  //-------------------------
111  // LFHCAL
112  //-------------------------
114  {
116  TRACKING::ProjectionNames.insert("LFHCAL");
117  }
118  //-------------------------
119  // CEMC
120  //-------------------------
122  {
124  TRACKING::ProjectionNames.insert("CEMC");
125  }
126  //-------------------------
127  // BECAL
128  //-------------------------
130  {
132  TRACKING::ProjectionNames.insert("BECAL");
133  }
134  //-------------------------
135  // HCALIN
136  //-------------------------
138  {
140  TRACKING::ProjectionNames.insert("HCALIN");
141  }
142  //-------------------------
143  // HCALOUT
144  //-------------------------
146  {
148  TRACKING::ProjectionNames.insert("HCALOUT");
149  }
150  //-------------------------
151  // EEMC
152  //-------------------------
154  {
156  TRACKING::ProjectionNames.insert("EEMC");
157  }
158  //-------------------------
159  // EHCAL
160  //-------------------------
162  {
164  TRACKING::ProjectionNames.insert("EHCAL");
165  }
166 
168 
169  // next, tracks with partial usage of the tracker stack
171  {
172  cout << __PRETTY_FUNCTION__ << " : missing the expected initialization for TRACKING::FastKalmanFilterInnerTrack." << endl;
173  exit(1);
174  }
180 
182  {
183  cout << __PRETTY_FUNCTION__ << " : missing the expected initialization for TRACKING::FastKalmanFilterSiliconTrack." << endl;
184  exit(1);
185  }
191  return;
192 }
193 
194 //-----------------------------------------------------------------------------//
195 
196 void Tracking_Eval(const std::string &outputfile)
197 {
199  //---------------
200  // Fun4All server
201  //---------------
202 
204 
205  //----------------
206  // Fast Tracking evaluation
207  //----------------
208 
209  PHG4TrackFastSimEval *fast_sim_eval = new PHG4TrackFastSimEval("FastTrackingEval");
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