ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4_FST_EIC.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4_FST_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_G4FSTEIC_C
10 #define MACRO_G4FSTEIC_C
11 
12 #include "GlobalVariables.C"
13 
17 
18 #include <g4main/PHG4Reco.h>
19 
20 #include <string>
21 
22 R__LOAD_LIBRARY(libg4detectors.so)
23 
24 int make_LANL_FST_station(string name, PHG4Reco *g4Reco, double zpos, double Rmin,
25  double Rmax, double tSilicon, double pitch);
26 int make_supportCyl(string name, PHG4Reco *g4Reco,
27  double r, double t, double length);
28 //-----------------------------------------------------------------------------------//
29 namespace Enable
30 {
31  static bool FST = false;
32  bool FST_OVERLAPCHECK = false;
33 } // namespace Enable
34 
35 namespace G4FST
36 {
37  namespace SETTING
38  {
39  bool FST_TPC = false;
40  bool SUPPORTCYL = false;
41  } // namespace SETTING
42 } // namespace G4FST
43 
44 //-----------------------------------------------------------------------------------//
45 void FST_Init()
46 {
50  {
52  }
53 }
54 //-----------------------------------------------------------------------------------//
55 
56 /*
57 
58 The idea is to calculate all the rmax rmin based on z and theta1 and theta2 in a python script (obj_fun.py)
59 Once calculated just pass the disk dimensions into this script
60 
61 */
62 
63 void FSTSetup(PHG4Reco *g4Reco)
64 {
66  const double mm = .1 * cm;
67  const double um = 1e-3 * mm;
68  //const double max_radius = 50.;
69 
70 
71 
72  const double bkwd_z[] = {25, 52, 79, 106};
73  double bkwd_rmin[] = {3.5, 3.5, 4.5, 5.5};
74  double bkwd_rmax[] = {18.5, 36.5, 40.5, 41.5};
75  const int n_bkwd_disk = sizeof(bkwd_z) / sizeof(*bkwd_z);
76  for (unsigned int i = 0; i < n_bkwd_disk; i++)
77  {
78 /*
79  // Below was made to auto calculate the min and max Radius
80  if(bkwd_z[i] < uRwell1_e_length) bkwd_rmax[i] = std::min(max_radius, e_slope1*bkwd_z[i] + e_intercept1) - 0.5;
81  else if (bkwd_z[i] >= uRwell1_e_length && bkwd_z[i] <= (uRwell1_e_length + uRwell_plateau_length)){bkwd_rmax[i] = uRwell1_radius - 1.5;}
82  else if(bkwd_z[i] > (uRwell1_e_length + uRwell_plateau_length)){bkwd_rmax[i] = std::min(max_radius, e_slope2*bkwd_z[i] + e_intercept2) - 0.5;}
83  else {cout << "Cannot calculate the RMax exiting" << endl; gSystem->Exit(0); }
84 
85  if(bkwd_z[i]>79.8 && bkwd_z[i]>0) bkwd_rmin[i] = (0.0521*bkwd_z[i] + 1.0);
86  else bkwd_rmin[i] = 3.3;
87 */
88  make_LANL_FST_station(Form("EST_%i", i), g4Reco, -1*bkwd_z[i], bkwd_rmin[i], bkwd_rmax[i], 35 * um, 10e-4); //cm
89  }
90 
91 
92  const double fwd_z[] = {25, 52, 73, 106, 125};
93  double fwd_rmin[] = {3.5, 3.5, 4.5, 5.5, 7.5};
94  double fwd_rmax[] = {18.5, 36.5, 40.5, 41.5, 43.4};
95  const int n_fwd_disk = sizeof(fwd_z) / sizeof(*fwd_z);
96  for (unsigned int i = 0; i < n_fwd_disk; i++)
97  {
98 
99 /*
100  if(fwd_z[i] < uRwell1_h_length) fwd_rmax[i] = std::min(max_radius, h_slope1*fwd_z[i] + h_intercept1) - 0.5;
101  else if (fwd_z[i] >= uRwell1_h_length && fwd_z[i] <= (uRwell1_h_length + uRwell_plateau_length)){fwd_rmax[i] = uRwell1_radius - 1.5;}
102  //else if(fwd_z[i] > (uRwell1_h_length + uRwell_plateau_length)){fwd_rmax[i] = std::min(max_radius, h_slope2*fwd_z[i] + h_intercept2) - 0.5;}
103  else if(fwd_z[i] > (uRwell1_h_length + uRwell_plateau_length) && fwd_z[i] <= 130.){ fwd_rmax[i] = std::min(max_radius, h_slope2*fwd_z[i] + h_intercept2) - 0.5;}
104  //else if(fwd_z[i] > 113.){fwd_rmax[i] = h_slope2*(fwd_z[i] + 5.) + h_intercept2 - 0.25;}
105  else {cout << "Cannot calculate the RMax exiting" << endl; gSystem->Exit(0); }
106 
107  if(fwd_z[i]>66.8 && fwd_z[i]>0) fwd_rmin[i] = (0.0521*fwd_z[i] + 1.0);
108  else fwd_rmin[i] = 3.3;
109 */
110  make_LANL_FST_station(Form("FST_%i", i), g4Reco, fwd_z[i], fwd_rmin[i], fwd_rmax[i], 35 * um, 10e-4); //cm
111  }
112 
114  {
115  double gap = 8; //cm
116  double tSupport = 0.2; //cm
117  make_supportCyl("FSTSupportCyl", g4Reco, 50.1 + gap, tSupport, 125.0 * 2.0); //cm
118  }
119 }
120 //-----------------------------------------------------------------------------------//
121 int make_LANL_FST_station(string name, PHG4Reco *g4Reco,
122  double zpos, double Rmin, double Rmax, double tSilicon, double pitch) //silicon thickness
123 {
124  bool OverlapCheck = Enable::OVERLAPCHECK || Enable::FST_OVERLAPCHECK;
125 
126  double min_polar_angle = atan2(Rmin, zpos);
127  double max_polar_angle = atan2(Rmax, zpos);
128 
129  // always facing the interaction point
130  double polar_angle = 0;
131  if (zpos < 0)
132  {
133  zpos = -zpos;
134  polar_angle = M_PI;
135  }
136  if (max_polar_angle < min_polar_angle)
137  {
138  double t = max_polar_angle;
139  max_polar_angle = min_polar_angle;
140  min_polar_angle = t;
141  }
142  PHG4SectorSubsystem *fst;
143  fst = new PHG4SectorSubsystem(name);
144 
145  fst->SuperDetector(name);
146 
147  fst->get_geometry().set_normal_polar_angle(polar_angle);
149  fst->get_geometry().set_min_polar_angle(min_polar_angle);
150  fst->get_geometry().set_max_polar_angle(max_polar_angle);
153  fst->get_geometry().set_N_Sector(1);
154  fst->get_geometry().set_material("G4_AIR");
155  fst->OverlapCheck(OverlapCheck); //true);//overlapcheck);
156 
157  const double cm = PHG4Sector::Sector_Geometry::Unit_cm();
158  const double mm = .1 * cm;
159  const double um = 1e-3 * mm;
160  // build up layers
161 
162  fst->get_geometry().AddLayer("SiliconSensor", "G4_Si", tSilicon, true, 100);
163  fst->get_geometry().AddLayer("Metalconnection", "G4_Al", 15 * um, false, 100);
164  fst->get_geometry().AddLayer("HDI", "G4_KAPTON", 20 * um, false, 100);
165  fst->get_geometry().AddLayer("Cooling", "G4_WATER", 100 * um, false, 100);
166  fst->get_geometry().AddLayer("Support", "G4_GRAPHITE", 50 * um, false, 100);
167  fst->get_geometry().AddLayer("Support_Gap", "G4_AIR", 1 * cm, false, 100);
168  fst->get_geometry().AddLayer("Support2", "G4_GRAPHITE", 50 * um, false, 100);
169 
170  g4Reco->registerSubsystem(fst);
171 
173  {
174  TRACKING::FastKalmanFilter->add_phg4hits(string("G4HIT_") + name, // const std::string& phg4hitsNames,
175  PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype,
176  pitch / sqrt(12.), // const float radres,
177  pitch / sqrt(12.), // const float phires,
178  50e-4 / sqrt(12.), // const float lonres, *ignored in plane detector*
179  0.9, // const float eff,
180  0); // const float noise
181  TRACKING::FastKalmanFilterInnerTrack->add_phg4hits(string("G4HIT_") + name, // const std::string& phg4hitsNames,
182  PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype,
183  pitch / sqrt(12.), // const float radres,
184  pitch / sqrt(12.), // const float phires,
185  50e-4 / sqrt(12.), // const float lonres, *ignored in plane detector*
186  0.9, // const float eff,
187  0); // const float noise
188  TRACKING::FastKalmanFilterSiliconTrack->add_phg4hits(string("G4HIT_") + name, // const std::string& phg4hitsNames,
189  PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype,
190  pitch / sqrt(12.), // const float radres,
191  pitch / sqrt(12.), // const float phires,
192  50e-4 / sqrt(12.), // const float lonres, *ignored in plane detector*
193  0.9, // const float eff,
194  0); // const float noise
195  }
196  return 0;
197 }
198 //-----------------------------------------------------------------------------------//
199 int make_supportCyl(string name, PHG4Reco *g4Reco, double r, double t, double length)
200 {
201  bool OverlapCheck = Enable::OVERLAPCHECK || Enable::FST_OVERLAPCHECK;
202 
203  PHG4CylinderSubsystem *cyl = new PHG4CylinderSubsystem(name, 5);
204  cyl->set_double_param("radius", r);
205  cyl->set_double_param("length", length);
206  cyl->set_string_param("material", "CFRP_INTT"); // borrow carbon fiber reinforced polymer used in sPHENIX silicon tracker support
207  cyl->set_double_param("thickness", t);
208  cyl->set_double_param("place_x", 0.);
209  cyl->set_double_param("place_y", 0.);
210  cyl->set_double_param("place_z", 0);
211  cyl->OverlapCheck(OverlapCheck); //true);//overlapcheck);
212  cyl->SetActive(0);
213  //cyl->SuperDetector("");
214  cyl->OverlapCheck(Enable::FST_OVERLAPCHECK); //OverlapCheck);
215 
216  g4Reco->registerSubsystem(cyl);
217  return 0;
218 }
219 #endif
220