EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4_Mvtx_EIC.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4_Mvtx_EIC.C
1 #ifndef MACRO_G4MVTXEIC_C
2 #define MACRO_G4MVTXEIC_C
3 
4 #include <GlobalVariables.C>
5 
7 #include <g4mvtx/PHG4MvtxDefs.h>
8 
9 #include <g4main/PHG4Reco.h>
10 
11 #include <fun4all/Fun4AllServer.h>
12 
13 #include <cmath>
14 #include <vector>
15 
16 R__LOAD_LIBRARY(libg4mvtx.so)
17 
18 namespace Enable
19 {
20  bool MVTX = false;
21  bool MVTX_OVERLAPCHECK = false;
22  int MVTX_VERBOSITY = 0;
23 
24 } // namespace Enable
25 
26 namespace G4MVTX
27 {
28  int n_maps_layer = 3; // must be 0-3, setting it to zero removes Mvtx completely, n < 3 gives the first n layers
29  vector<int> N_staves = {18, 24, 30};
30  vector<double> nom_radius = {36.4, 48.1, 59.8};
31 } // namespace G4MVTX
32 
33 void MvtxInit(int verbosity = 0)
34 {
38 }
39 
40 double Mvtx(PHG4Reco* g4Reco, double radius,
41  const int absorberactive = 0)
42 {
43  bool maps_overlapcheck = Enable::OVERLAPCHECK || Enable::MVTX_OVERLAPCHECK;
45 
46  // Update EIC MAPS layer structure based on inner two layers of U. Birmingham tracker
47 
48  PHG4EICMvtxSubsystem* mvtx = new PHG4EICMvtxSubsystem("MVTX");
49  mvtx->Verbosity(verbosity);
50 
51  // H?kan Wennl?f <hwennlof@kth.se> :
52  // Without time-stamping layer:
53  // Stave type Length Overlap Radius [mm] Tilt Radiation length Number of staves
54  // ALICE inner 270 mm 2 mm 36.4 12.0 deg 0.3 % X0 18
55  // ALICE inner 270 mm 2 mm 59.8 12.0 deg 0.3 % X0 30
56  // ALICE outer 840 mm 4 mm 133.8 6.0 deg 0.8 % X0 16
57  // ALICE outer 840 mm 4 mm 180 6.0 deg 0.8 % X0 21
58 
59  // int N_staves[G4MVTX::n_maps_layer] = {18, 24, 30};
60  // double nom_radius[G4MVTX::n_maps_layer] = {36.4, 48.1, 59.8};
62  {
63  cout << "vector<int> N_staves too small: " << G4MVTX::N_staves.size()
64  << " needs to be at least of size " << G4MVTX::n_maps_layer << endl;
65  gSystem->Exit(1);
66  }
68  {
69  cout << "vector<double> nom_radius too small: " << G4MVTX::nom_radius.size()
70  << " needs to be at least of size " << G4MVTX::n_maps_layer << endl;
71  gSystem->Exit(1);
72  }
73  for (int ilyr = 0; ilyr < G4MVTX::n_maps_layer; ilyr++)
74  {
75  mvtx->set_int_param(ilyr, "active", 1); //non-automatic initialization in PHG4DetectorGroupSubsystem
76  mvtx->set_int_param(ilyr, "layer", ilyr);
77  mvtx->set_int_param(ilyr, "N_staves", G4MVTX::N_staves[ilyr]);
78  mvtx->set_double_param(ilyr, "layer_nominal_radius", G4MVTX::nom_radius[ilyr]); // mm
79  mvtx->set_double_param(ilyr, "phitilt", 12.0 * 180. / M_PI + M_PI);
80  mvtx->set_double_param(ilyr, "phi0", 0);
81  }
82 
83  mvtx->set_string_param(PHG4MvtxDefs::GLOBAL, "stave_geometry_file", string(getenv("CALIBRATIONROOT")) + string("/Tracking/geometry/mvtx_stave_v1.gdml"));
84  mvtx->SetActive(1);
85  mvtx->OverlapCheck(maps_overlapcheck);
86  g4Reco->registerSubsystem(mvtx);
87  return G4MVTX::nom_radius[G4MVTX::n_maps_layer - 1] / 10.; // return cm
88 }
89 #endif