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 
6 #include <G4_GEM_EIC.C>
7 #include <G4_Mvtx_EIC.C>
8 #include <G4_TPC_EIC.C>
9 
11 
13 
15 
16 #include <fun4all/Fun4AllServer.h>
17 
18 #include <vector>
19 
20 R__LOAD_LIBRARY(libtrack_reco.so)
21 R__LOAD_LIBRARY(libg4trackfastsim.so)
22 
23 namespace Enable
24 {
25  bool TRACKING = false;
26  bool TRACKING_EVAL = false;
28 } // namespace Enable
29 
30 namespace G4TRACKING
31 {
32  bool DISPLACED_VERTEX = false;
33  bool PROJECTION_EEMC = false;
34  bool PROJECTION_CEMC = false;
35  bool PROJECTION_FEMC = false;
36  bool PROJECTION_FHCAL = false;
37 } // namespace G4TRACKING
38 
39 //-----------------------------------------------------------------------------//
41 {
42  TRACKING::TrackNodeName = "TrackMap";
43 }
44 //-----------------------------------------------------------------------------//
46 {
48  //---------------
49  // Fun4All server
50  //---------------
51 
53 
54  PHG4TrackFastSim *kalman = new PHG4TrackFastSim("PHG4TrackFastSim");
55  kalman->Verbosity(verbosity);
56  // kalman->Smearing(false);
58  {
59  // do not use truth vertex in the track fitting,
60  // which would lead to worse momentum resolution for prompt tracks
61  // but this allows displaced track analysis including DCA and vertex finding
62  kalman->set_use_vertex_in_fitting(false);
63  kalman->set_vertex_xy_resolution(0); // do not smear the vertex used in the built-in DCA calculation
64  kalman->set_vertex_z_resolution(0); // do not smear the vertex used in the built-in DCA calculation
65  kalman->enable_vertexing(true); // enable vertex finding and fitting
66  }
67  else
68  {
69  // constraint to a primary vertex and use it as part of the fitting level arm
70  kalman->set_use_vertex_in_fitting(true);
71  kalman->set_vertex_xy_resolution(50e-4);
72  kalman->set_vertex_z_resolution(50e-4);
73  }
74 
75  kalman->set_sub_top_node_name("TRACKS");
77 
78  //-------------------------
79  // Barrel
80  //-------------------------
81  if (Enable::BARREL)
82  {
83  double pitch = 20e-4 / sqrt(12);
84 
86  {
87  int nLayer1 = 3; //barrel 1
88  int nLayer2 = 2; //barrel 2
89  if (G4BARREL::SETTING::BARRELV6) nLayer2 = 1; //compactible w/ TPC
90  int nLayer[2] = {nLayer1, nLayer2};
91 
92  for (int n = 0; n < 2; n++)
93  {
94  if (n == 1) pitch = 36.4e-4 / sqrt(12);
95  for (int i = 0; i < nLayer[n]; i++)
96  {
97  kalman->add_phg4hits(Form("G4HIT_BARREL%d_%d", n, i), // const std::string& phg4hitsNames,
98  PHG4TrackFastSim::Cylinder, // const DETECTOR_TYPE phg4dettype,
99  5e-4, // const float radres, *ignored in cylindrical detector*
100  pitch, // const float phires,
101  pitch, // const float lonres,
102  0.95, // const float eff,
103  0); // const float noise
104  }
105  }
106  }
107  else
108  {
109  int nLayer = 5;
110  if (G4BARREL::SETTING::BARRELV4) nLayer = 6;
111  for (int i = 0; i < nLayer; i++)
112  {
113  kalman->add_phg4hits(Form("G4HIT_BARREL_%d", i), // const std::string& phg4hitsNames,
114  PHG4TrackFastSim::Cylinder, // const DETECTOR_TYPE phg4dettype,
115  5e-4, // const float radres, *ignored in cylindrical detector*
116  pitch, // const float phires,
117  pitch, // const float lonres,
118  0.95, // const float eff,
119  0); // const float noise
120  }
121  }
122  }
123  //-------------------------
124  // MVTX
125  //-------------------------
126  if (Enable::MVTX)
127  {
128  // MAPS
129  kalman->add_phg4hits(
130  "G4HIT_MVTX", // const std::string& phg4hitsNames,
131  PHG4TrackFastSim::Cylinder, // const DETECTOR_TYPE phg4dettype,
132  5e-4, // const float radres,
133  5e-4, // const float phires,
134  5e-4, // const float lonres,
135  1, // const float eff,
136  0 // const float noise
137  );
138  }
139  //-------------------------
140  // TPC
141  //-------------------------
142  if (Enable::TPC)
143  {
144  kalman->add_phg4hits(
145  "G4HIT_TPC", // const std::string& phg4hitsNames,
146  PHG4TrackFastSim::Cylinder, // const DETECTOR_TYPE phg4dettype,
147  1, // const float radres,
148  200e-4, // const float phires,
149  500e-4, // const float lonres,
150  1, // const float eff,
151  0 // const float noise
152  );
153  }
154  //-------------------------
155  // EGEM
156  //-------------------------
158  {
159  int first_gem = 0;
160  if (Enable::EGEM)
161  {
162  first_gem = 2;
163  }
164  // GEM, 70um azimuthal resolution, 1cm radial strips
165  for (int i = first_gem; i < 4; i++)
166  {
167  kalman->add_phg4hits(
168  Form("G4HIT_EGEM_%d", i), // const std::string& phg4hitsNames,
169  PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype,
170  1. / sqrt(12.), // const float radres,
171  70e-4, // const float phires,
172  100e-4, // const float lonres,
173  1, // const float eff,
174  0 // const float noise
175  );
176  }
177  }
178  //-------------------------
179  // FGEM
180  //-------------------------
182  {
183  int first_gem(0);
184  if (Enable::FGEM_ORIG)
185  {
186  first_gem = 0;
187  }
188  else
189  {
190  first_gem = 2;
191  }
192  // GEM2, 70um azimuthal resolution, 1cm radial strips
193  for (int i = first_gem; i < 5; i++)
194  {
195  kalman->add_phg4hits(Form("G4HIT_FGEM_%d", i), // const std::string& phg4hitsNames,
196  PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype,
197  1. / sqrt(12.), // const float radres,
198  70e-4, // const float phires,
199  100e-4, // const float lonres,
200  1, // const float eff,
201  0); // const float noise
202  }
203  }
204  //-------------------------
205  // FST
206  //-------------------------
207  if (Enable::FST)
208  {
209  float pitch = 20e-4;
210  int nPlane = 5;
212  {
213  nPlane = 6;
214  }
215 
216  for (int i = 0; i < nPlane; i++)
217  {
218  if (i >= 3) pitch = 36.4e-4;
219  kalman->add_phg4hits(Form("G4HIT_FST_%d", i), // const std::string& phg4hitsNames,
220  PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype,
221  pitch, // const float radres,
222  pitch, // const float phires,
223  50e-4 / sqrt(12.), // const float lonres, *ignored in plane detector*
224  1, // const float eff,
225  0); // const float noise
226  }
227  }
228  //-------------------------
229  // FEMC
230  //-------------------------
231  // Saved track states (projections)
233  {
234  kalman->add_state_name("FEMC");
235  }
236 
237  //-------------------------
238  // FHCAL
239  //-------------------------
241  {
242  kalman->add_state_name("FHCAL");
243  }
244  //-------------------------
245  // CEMC
246  //-------------------------
248  {
249  kalman->add_state_name("CEMC");
250  }
251  //-------------------------
252  // EEMC
253  //-------------------------
255  {
256  kalman->add_state_name("EEMC");
257  }
258 
259  se->registerSubsystem(kalman);
260  return;
261 }
262 
263 //-----------------------------------------------------------------------------//
264 
265 void Tracking_Eval(const std::string &outputfile)
266 {
268  //---------------
269  // Fun4All server
270  //---------------
271 
273 
274  //----------------
275  // Fast Tracking evaluation
276  //----------------
277 
278  PHG4TrackFastSimEval *fast_sim_eval = new PHG4TrackFastSimEval("FastTrackingEval");
280  fast_sim_eval->set_filename(outputfile);
281  fast_sim_eval->Verbosity(verbosity);
282  se->registerSubsystem(fast_sim_eval);
283 }
284 #endif