ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4_B0Tracking_EIC.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4_B0Tracking_EIC.C
1 #ifndef MACRO_G4B0TRACKINGEIC_C
2 #define MACRO_G4B0TRACKINGEIC_C
3 
4 #include <GlobalVariables.C>
5 
7 
8 #include <eicg4b0/B0TrackFastSimEval.h>
9 #include <eicg4b0/B0TrackFastSim.h>
10 
11 #include <fun4all/Fun4AllServer.h>
12 
13 #include <vector>
14 
15 R__LOAD_LIBRARY(libtrack_reco.so)
16 R__LOAD_LIBRARY(libEICG4B0.so)//
17 
18 namespace Enable
19 {
20  bool B0TRACKING = false;
21  bool B0TRACKING_EVAL = false;
22  int B0TRACKING_VERBOSITY = 0;
23 } // namespace Enable
24 
25 namespace G4B0TRACKING
26 {
27  bool DISPLACED_VERTEX = false;
28  bool PROJECTION_B0 = false;
29  const double PositionResolution(30e-4);
30 } // namespace G4TRACKING
31 
32 //-----------------------------------------------------------------------------//
34 {
35  B0TRACKING::FastKalmanFilter = new B0TrackFastSim("B0TrackFastSim");
36  B0TRACKING::FastKalmanFilterB0Track = new B0TrackFastSim("FastKalmanFilterB0Track"); //b0Truth
37 }
38 
40 {
41  // kalman_filter->Smearing(false);
43  {
44  // do not use truth vertex in the track fitting,
45  // which would lead to worse momentum resolution for prompt tracks
46  // but this allows displaced track analysis including DCA and vertex finding
47  kalman_filter->set_use_vertex_in_fitting(false);
48  kalman_filter->set_vertex_xy_resolution(0); // do not smear the vertex used in the built-in DCA calculation
49  kalman_filter->set_vertex_z_resolution(0); // do not smear the vertex used in the built-in DCA calculation
50  kalman_filter->enable_vertexing(true); // enable vertex finding and fitting
51  }
52  else
53  {
54  // constraint to a primary vertex and use it as part of the fitting level arm
55  kalman_filter->set_use_vertex_in_fitting(true);
58  }
59 
60  kalman_filter->set_sub_top_node_name("TRACKS");
61 }
62 
63 //-----------------------------------------------------------------------------//
65 {
66  int verbosity = std::max(Enable::VERBOSITY, Enable::B0TRACKING_VERBOSITY);
67  //---------------
68  // Fun4All server
69  //---------------
70 
72 
73  if (B0TRACKING::FastKalmanFilter == nullptr)
74  {
75  cout << __PRETTY_FUNCTION__ << " : missing the expected initialization for B0TRACKING::FastKalmanFilter." << endl;
76  exit(1);
77  }
78 
82 
83  //-------------------------
84  // B0
85  //-------------------------
86  if (Enable::B0TRACKING && G4B0TRACKING::PROJECTION_B0)
87  {
88 // TRACKING::FastKalmanFilter->add_state_name("b0Truth");
89 // TRACKING::ProjectionNames.insert("b0Truth");
90  }
91 
93 
94  // next, tracks with partial usage of the tracker stack
96  {
97  cout << __PRETTY_FUNCTION__ << " : missing the expected initialization for TRACKING::FastKalmanFilterB0Track." << endl;
98  exit(1);
99  }
105  return;
106 }
107 
108 //-----------------------------------------------------------------------------//
109 
110 void B0Tracking_Eval(const std::string &outputfile)
111 {
112  int verbosity = std::max(Enable::VERBOSITY, Enable::B0TRACKING_VERBOSITY);
113  //---------------
114  // Fun4All server
115  //---------------
116 
118 
119  //----------------
120  // Fast Tracking evaluation
121  //----------------
122 
123  B0TrackFastSimEval *b0_fast_sim_eval = new B0TrackFastSimEval("B0FastTrackingEval");
124  b0_fast_sim_eval->set_trackmapname(B0TRACKING::TrackNodeName);
125  b0_fast_sim_eval->set_filename(outputfile);
126  b0_fast_sim_eval->Verbosity(verbosity);
127  //-------------------------
128  // FEMC
129  //-------------------------
130 
131  cout << "Tracking_Eval(): configuration of track projections in B0TrackFastSimEval" << endl;
132  cout << "std::set<std::string> B0TRACKING::ProjectionNames = {";
133  bool first = true;
134  for (const string &proj : B0TRACKING::B0ProjectionNames)
135  {
136  if (first)
137  first = false;
138  else
139  cout << ", ";
140  cout << "\"" << proj << "\"";
141 
142  b0_fast_sim_eval->AddProjection(proj);
143  }
144  cout << "};" << endl; // override the TRACKING::ProjectionNames in eval macros
145 
146  se->registerSubsystem(b0_fast_sim_eval);
147  // now partial track fits
148  //B0TrackFastSimEval *b0_fast_sim_eval = new B0TrackFastSimEval("FastTrackingEval_B0TrackMap");
149  b0_fast_sim_eval = new B0TrackFastSimEval("FastTrackingEval_B0TrackMap");
150  b0_fast_sim_eval->set_trackmapname("B0TrackMap");
151  b0_fast_sim_eval->set_filename(outputfile + ".B0TrackMap_debug.root");
152  b0_fast_sim_eval->Verbosity(verbosity);
153  se->registerSubsystem(b0_fast_sim_eval);
154 }
155 #endif