EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4_Barrel_EIC.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4_Barrel_EIC.C
1 /*---------------------------------------------------------------------*
2  * Barrel tracker designed by LANL EIC team *
3  * See technical notes for details: arXiv:2009.02888 *
4  * Contact Ping and Xuan @LANL for questions: *
5  * Xuan: xuanli@lanl.gov *
6  * Ping: cpwong@lanl.gov *
7  *---------------------------------------------------------------------*/
8 
9 #ifndef MACRO_G4BARRELEIC_C
10 #define MACRO_G4BARRELEIC_C
11 
12 #include <GlobalVariables.C>
13 
15 
16 #include <g4main/PHG4Reco.h>
17 
18 #include <fun4all/Fun4AllServer.h>
19 
20 #include <cmath>
21 #include <vector>
22 
23 R__LOAD_LIBRARY(libg4eval.so)
24 R__LOAD_LIBRARY(libg4mvtx.so)
25 
26 int make_barrel_pixel_layer(const string &name, PHG4Reco *g4Reco,
27  double radius, double halflength, double tSilicon, double tAirgap);
28 
29 //---------------------------------------------------------------------//
30 namespace Enable
31 {
32  bool BARREL = false;
33  bool BARREL_ABSORBER = false;
34 } // namespace Enable
35 
36 namespace G4BARREL
37 {
38  namespace SETTING
39  {
40  bool BARRELV0 = false;
41  bool BARRELV1 = false;
42  bool BARRELV2 = false;
43  bool BARRELV3 = false;
44  bool BARRELV4 = false;
45  bool BARRELV5 = false;
46  bool BARRELV6 = false;
47  } // namespace SETTING
48 } // namespace G4BARREL
49 //---------------------------------------------------------------------//
50 void BarrelInit()
51 {
52  //check barrel setting
53  if ((G4BARREL::SETTING::BARRELV0 ? 1 : 0) +
54  (G4BARREL::SETTING::BARRELV1 ? 1 : 0) +
55  (G4BARREL::SETTING::BARRELV2 ? 1 : 0) +
56  (G4BARREL::SETTING::BARRELV3 ? 1 : 0) +
57  (G4BARREL::SETTING::BARRELV4 ? 1 : 0) +
58  (G4BARREL::SETTING::BARRELV5 ? 1 : 0) +
59  (G4BARREL::SETTING::BARRELV6 ? 1 : 0) >
60  1)
61  {
62  cout << "use only ";
63  for (int i = 0; i < 7; i++)
64  {
65  if (i == 0)
66  cout << "G4BARREL::SETTING::BARRELV" << i << "=true ";
67  else
68  cout << " or G4BARREL::SETTING::BARRELV" << i << "=true ";
69  }
70 
71  gSystem->Exit(1);
72  }
73 }
74 
75 //---------------------------------------------------------------------//
76 double Barrel(PHG4Reco *g4Reco, double radius)
77 {
78  const bool AbsorberActive = Enable::ABSORBER || Enable::BARREL_ABSORBER;
79  double max_bh_radius = 0.;
80 
81  //---------------------------------
82  //build barrel detector
83  //---------------------------------
84  int nLayer = 5;
85  const float um = 0.0001; //convert um to cm
86 
87  // Different Barrel versions documented in arXiv:2009.02888
88  double r[6] = {3.64, 4.81, 5.98, 16.0, 22.0, -1}; //cm
89  double halfLength[6] = {20, 20, 25, 25, 25, 25}; //cm
90  double tSilicon[6] = {100 * um, 100 * um, 100 * um, 100 * um, 100 * um, 100 * um};
91  double tAirgap[6] = {0.9, 0.9, 1, 1, 1, 1};
92 
94  {
95  for (Int_t i = 0; i < 3; i++) tSilicon[i] = 50 * um;
96  }
98  {
99  for (Int_t i = 0; i < 5; i++) tSilicon[i] = 35 * um;
100  }
102  {
103  for (Int_t i = 0; i < 3; i++) tSilicon[i] = 50 * um;
104  nLayer = 6;
105  r[3] = 9.2;
106  r[4] = 17.;
107  r[5] = 27.;
108  }
109 
111  {
112  int nLayer1 = 3; //barrel 1
113  int nLayer2 = 2; //barrel 2
114  if (G4BARREL::SETTING::BARRELV6) nLayer2 = 1; //compactible w/ TPC
115 
116  int my_nLayer[2] = {nLayer1, nLayer2};
117 
118  double my_r[2][3] = {{3.64, 4.81, 5.98}, //cm, barrel1
119  {16, 22.0}}; //barrel 2
120 
121  double my_halfLength[2][3] = {{20, 20, 25}, //cm, barrel 1
122  {25, 25}}; //barrel 2
123 
124  double my_tSilicon = 35 * um;
125 
126  for (int n = 0; n < 2; n++)
127  {
128  if (n == 1) my_tSilicon = 85 * um;
129  for (int i = 0; i < my_nLayer[n]; i++)
130  {
131  make_barrel_pixel_layer(Form("BARREL%d_%d", n, i), g4Reco, my_r[n][i], my_halfLength[n][i], my_tSilicon, tAirgap[i]);
132  }
133  }
134 
135  // update now that we know the outer radius
137  BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, halfLength[nLayer1 + nLayer2 - 1]);
138  BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -halfLength[nLayer1 + nLayer2 - 1]);
139 
140  max_bh_radius = my_r[1][nLayer2 - 1] + 1.5;
141  return max_bh_radius;
142  }
143  else
144  { //ver 0 - 4
145  for (int i = 0; i < nLayer; i++)
146  {
147  make_barrel_pixel_layer(Form("BARREL_%d", i), g4Reco, r[i], halfLength[i], tSilicon[i], 1);
148  max_bh_radius = r[i] + 1.5;
149  //std::cout << "done with barrel layer intialization at "<< r[i] << std::endl;
150  }
151 
152  // update now that we know the outer radius
155  BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, -halfLength[nLayer - 1]);
156  return max_bh_radius;
157  }
158 
159  return 0;
160 }
161 //-----------------------------------------------------------------------------------//
162 int make_barrel_pixel_layer(const string &name, PHG4Reco *g4Reco,
163  double radius, double halflength, double tSilicon, double tAirgap)
164 {
165  //---------------------------------
166  //build barrel layer
167  //---------------------------------
168  const int nSubLayer = 7;
169  const double cm = PHG4Sector::Sector_Geometry::Unit_cm();
170  const double mm = .1 * cm;
171  const double um = 1e-3 * mm;
172 
173  string layerName[nSubLayer] = {"SiliconSensor", "Metalconnection", "HDI", "Cooling",
174  "Support1", "Support_Gap", "Support2"};
175  string material[nSubLayer] = {"G4_Si", "G4_Al", "G4_KAPTON", "G4_WATER",
176  "G4_GRAPHITE", "G4_AIR", "G4_GRAPHITE"};
177  double thickness[nSubLayer] = {tSilicon, 15 * um, 20 * um, 100 * um,
178  50 * um, tAirgap, 50 * um};
179 
180  double max_bh_radius = 0.;
182  cout << "started to create cylinder layer: " << name << endl;
183 
184  double currRadius = radius;
185  // cout << currRadius << endl;
186  for (int l = 0; l < nSubLayer; l++)
187  {
188  cout << name << "_" << layerName[l] << "\t" << currRadius;
189  cyl = new PHG4CylinderSubsystem(name + "_" + layerName[l], l);
190  cyl->SuperDetector(name);
191  cyl->set_double_param("radius", currRadius);
192  cyl->set_double_param("length", 2.0 * halflength);
193  cyl->set_string_param("material", material[l]);
194  cyl->set_double_param("thickness", thickness[l]);
195  if (l == 0) cyl->SetActive(); //only the Silicon Sensor is active
196  cyl->OverlapCheck(true);
197  g4Reco->registerSubsystem(cyl);
198  currRadius = currRadius + thickness[l];
199  cout << "\t" << currRadius << endl;
200  }
201 
202  return 0;
203 }
204 
205 //-----------------------------------------------------------------------------------//
206 
207 #endif