ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4_TrackingSupport.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4_TrackingSupport.C
1 #ifndef MACRO_G4TrackingService_C
2 #define MACRO_G4TrackingService_C
3 
4 #include <GlobalVariables.C>
5 #include <QA.C>
6 
9 #include <g4main/PHG4Reco.h>
10 
11 #include <qa_modules/QAG4SimulationMvtx.h>
12 
13 #include <fun4all/Fun4AllServer.h>
14 
15 #include <cmath>
16 #include <vector>
17 
18 //ECCE Tracking Services
19 //Should be 5 barrels and 4 cones
20 
21 using namespace std;
22 
24 {
25  public:
27 
28  explicit ServiceProperties(const string &name,
29  const double &rad_len_copper,
30  const double &rad_len_aluminum,
31  const double &rad_len_water,
32  const double &rad_len_plastic,
33  const double &rad_len_carbon,
34  const double &rad_len_iron,
35  const double &z_south,
36  const double &z_north,
37  const double &r_south,
38  const double &r_north);
39 
40  virtual ~ServiceProperties(){};
41 
42  const string get_name();
43  const double get_rad_len_copper();
44  const double get_rad_len_aluminum();
45  const double get_rad_len_water();
46  const double get_rad_len_plastic();
47  const double get_rad_len_carbon();
48  const double get_rad_len_iron();
49  const double get_z_south();
50  const double get_z_north();
51  const double get_r_south();
52  const double get_r_north();
53 
54  private:
55  const string m_name = "service";
56  const double m_rad_len_copper = 0.0;
57  const double m_rad_len_aluminum = 0.0;
58  const double m_rad_len_water = 0.0;
59  const double m_rad_len_plastic = 0.0;
60  const double m_rad_len_carbon = 0.0;
61  const double m_rad_len_iron = 0.0;
62  const double m_z_south = 0.0;
63  const double m_z_north = 0.0;
64  const double m_r_south = 0.0;
65  const double m_r_north = 0.0;
66 };
68  const double &rad_len_copper,
69  const double &rad_len_aluminum,
70  const double &rad_len_water,
71  const double &rad_len_plastic,
72  const double &rad_len_carbon,
73  const double &rad_len_iron,
74  const double &z_south,
75  const double &z_north,
76  const double &r_south,
77  const double &r_north)
78  : m_name(name)
79  , m_rad_len_copper(rad_len_copper)
80  , m_rad_len_aluminum(rad_len_aluminum)
81  , m_rad_len_water(rad_len_water)
82  , m_rad_len_plastic(rad_len_plastic)
83  , m_rad_len_carbon(rad_len_carbon)
84  , m_rad_len_iron(rad_len_iron)
85  , m_z_south(z_south)
86  , m_z_north(z_north)
87  , m_r_south(r_south)
88  , m_r_north(r_north)
89 {
90 }
91 
92 const string ServiceProperties::get_name() { return m_name; }
99 const double ServiceProperties::get_z_south() { return m_z_south; }
100 const double ServiceProperties::get_z_north() { return m_z_north; }
101 const double ServiceProperties::get_r_south() { return m_r_south; }
102 const double ServiceProperties::get_r_north() { return m_r_north; }
103 
104 namespace Enable
105 {
106  bool TrackingService = false;
110 
111 } // namespace Enable
112 
113 namespace G4TrackingService
114 { //List materials and radiation length in cm
115  const int nMaterials = 6;
116  pair<string, double> materials[nMaterials] = {make_pair("G4_Cu", 1.436)
117  ,make_pair("G4_Al", 8.897)
118  ,make_pair("G4_WATER", 36.08)
119  ,make_pair("G4_POLYETHYLENE", 50.31)
120  ,make_pair("PEEK", 30.00)
121  ,make_pair("G4_Fe", 1.757)};
122 
123  double GlobalOffset = 0.0;
124  double ShellThickness = 0.3; //Thickness in cm
125  int subsysID = 0;
126 } // namespace G4TrackingService
127 
128 vector<double> get_thickness(ServiceProperties *object)
129 {
130  vector<double> thickness = {(object->get_rad_len_copper() / 100) * G4TrackingService::materials[0].second
131  ,(object->get_rad_len_aluminum() / 100) * G4TrackingService::materials[1].second
132  ,(object->get_rad_len_water() / 100) * G4TrackingService::materials[2].second
133  ,(object->get_rad_len_plastic() / 100) * G4TrackingService::materials[3].second
134  ,(object->get_rad_len_carbon() / 100) * G4TrackingService::materials[4].second
135  ,(object->get_rad_len_iron() / 100) * G4TrackingService::materials[5].second};
136  return thickness;
137 }
138 
140 {
142  // extends only to -z
144 }
145 
146 double TrackingServiceCone(ServiceProperties *object, PHG4Reco *g4Reco, double radius)
147 {
148  bool AbsorberActive = Enable::ABSORBER || Enable::TrackingService_ABSORBER;
151 
152  PHG4ConeSubsystem *cone;
153 
154  double innerRadiusSouth = object->get_r_south();
155  double innerRadiusNorth = object->get_r_north();
156  double length = abs(object->get_z_north() - object->get_z_south());
157  vector<double> thickness = get_thickness(object);
158 
159  for (int i = 0; i < G4TrackingService::nMaterials; ++i)
160  {
161  if (thickness[i] == 0) continue;
163  cone->Verbosity(verbosity);
164  cone->SetR1(innerRadiusSouth, innerRadiusSouth + thickness[i]);
165  cone->SetR2(innerRadiusNorth, innerRadiusNorth + thickness[i]);
166  cone->SetPlaceZ(object->get_z_south() + length / 2 + G4TrackingService::GlobalOffset);
167  cone->SetZlength(length / 2);
169  cone->SuperDetector("TrackingService");
170  if (AbsorberActive) cone->SetActive();
171  cone->OverlapCheck(OverlapCheck);
172  g4Reco->registerSubsystem(cone);
174  innerRadiusSouth += thickness[i];
175  innerRadiusNorth += thickness[i];
176  }
177  radius = max(innerRadiusSouth, innerRadiusNorth);
178 
179  return radius;
180 }
181 
183 {
184  bool AbsorberActive = Enable::ABSORBER || Enable::TrackingService_ABSORBER;
187 
189 
190  double innerRadius = object->get_r_south();
191  double length = abs(object->get_z_north() - object->get_z_south());
192  vector<double> thickness = get_thickness(object);
193 
194  for (int i = 0; i < G4TrackingService::nMaterials; ++i)
195  {
196  if (thickness[i] == 0) continue;
198  cyl->Verbosity(verbosity);
199  cyl->set_double_param("place_z", object->get_z_south() + length / 2 + G4TrackingService::GlobalOffset);
200  cyl->set_double_param("radius", innerRadius);
201  cyl->set_double_param("length", length);
202  cyl->set_string_param("material", G4TrackingService::materials[i].first);
203  cyl->set_double_param("thickness", thickness[i]);
204  cyl->SuperDetector("TrackingService");
205  if (AbsorberActive) cyl->SetActive();
206  cyl->OverlapCheck(OverlapCheck);
207  g4Reco->registerSubsystem(cyl);
209  innerRadius += thickness[i];
210  }
211  radius = innerRadius;
212 
213  return radius;
214 }
215 
216 double TrackingService(PHG4Reco *g4Reco, double radius)
217 {
218  vector<ServiceProperties *> cylinders, cones;
219 
220  double shellX0 = 100 * G4TrackingService::ShellThickness / G4TrackingService::materials[4].second;
221  double disk_cone_radii = 50.; // max radius for the inner tracker Thickness incorporated in here
222  double avg_thickness_inner = 1.0; // for 13, 0, 0.56, 0.48, shellX0
223  double vtx_support_radius = 9.0;
224  double vtx_e_length = 19.44;
225  double vtx_h_length = 19.44;
226  double sagitta_support_radius = 17.0 + 1.5; // 17.0 cms is the radiius of the second sagitta layer. 1.5cms is the gap given for support structure
227  double sagitta_support_e_length = 37.7861; // +1.5 is the gap given for the support structure
228  double sagitta_support_h_length = 37.7861;
229  double plateau_length = 5.1;
230 
231  /* Inclination 2 for e-going and h-going directions*/
232 
233  double inner_uRwell_radius = 33.12; // Radius of the inner uRwell
234  double gap = 1. * avg_thickness_inner;
235  inner_uRwell_radius -= gap; // subtract the thickness
236  double inner_uRwell_e_length = 67.54;
237  double inner_uRwell_h_length = 67.54;
238  double inner_uRwell_length = inner_uRwell_e_length + inner_uRwell_h_length;
239 
240  double e_cone_ends = 110.;
241  double h_cone_ends = 110.;
242 
243  /* Below are the support structures beyond EGEM*/
244  cylinders.push_back(new ServiceProperties("ETrackingCylinderService_1", 9, 0, 0.42, 0.32, shellX0, 0, -400, -310, 270, 0));
245  cones.push_back(new ServiceProperties("ETrackingConeService_1", 9, 0, 0.42, 0.32, shellX0, 0, -310, -300, 270, 68));
246  cylinders.push_back(new ServiceProperties("ETrackingCylinderService_2", 17, 0, 0.56, 0.64, shellX0, 0, -300, -200, 68, 0));
247  cylinders.push_back(new ServiceProperties("ETrackingCylinderService_3", 15, 0, 0.56, 0.56, shellX0, 0, -200, -147.47, 68, 0));
248 
249  /* Support structure thickness*/
250 
251  double CuThickness = 13.; // 0.18668 cms
252  double AlThickness = 0.; // 0. cms
253  double WaterThickness = 0.70; // 0.25256 cms
254  double PlasticThickness = 0.48; // 0.241488 cms
255  double CarbonThickness = shellX0; // 0.3 cms
256 
257  double X_X0_percent = 0.1; // % X0
258 
259  // Cone service from the end Disk to the uRwell1 radius
260  cones.push_back(new ServiceProperties("ETrackingCone_Disk4TouRwell", CuThickness, AlThickness, WaterThickness, PlasticThickness, CarbonThickness, 0, -147.47, -90, 68, 41.5));
261 
262  // The cylindrical plateau structure for Electron uRwell side.
263  cylinders.push_back(new ServiceProperties("ETrackingCyl_uRWellPlateau", CuThickness, AlThickness, WaterThickness, PlasticThickness, CarbonThickness, 0, -90, -56.08, 41.5, 0));
264 
265  // Cone service from electron side uRwell1 to vertex support.
266  cones.push_back(new ServiceProperties("ETrackingCone_uRwellToVertex", CuThickness, AlThickness, WaterThickness, PlasticThickness, CarbonThickness, 0, -56.08, -7.699, 41.5, 5.7));
267 
268  // Sagitta Cylindrical Support Structure
269  cylinders.push_back(new ServiceProperties("BTrackingCyl_Vertex2", 0, 0, 0, 0, X_X0_percent, 0, -15.3, 15.3, 12.6, 0));
270 
271  // Vertex Cylindrical Support Structure
272  cylinders.push_back(new ServiceProperties("BTrackingCyl_Vertex", 0, 0, 0, 0, X_X0_percent, 0, -7.699, 7.699, 5.7, 0));
273 
274  // Cone service in H-region from vertex to inner uRwell
275  cones.push_back(new ServiceProperties("HTrackingCone_VertexTouRwell", CuThickness, AlThickness, WaterThickness, PlasticThickness, CarbonThickness, 0, 7.699, 56.08, 5.7, 41.5));
276 
277  // Cylinder service to rest the uRwell in H region Plateau
278  cylinders.push_back(new ServiceProperties("HTrackingRWellPlateau", CuThickness, AlThickness, WaterThickness, PlasticThickness, CarbonThickness, 0, 56.08, 103.75, 41.5, 0));
279 
280  // Cone service from uRwell to Disk 5 in h-region
281  cones.push_back(new ServiceProperties("HTrackingCone_uRwellToDisk5", CuThickness, AlThickness, WaterThickness, PlasticThickness, CarbonThickness, 0, 103.75, 173, 41.5, 69.2));
282 
283  // Supports beyond FGEM
284  cones.push_back(new ServiceProperties("HTrackingConeService_7", 13, 0, 0.70, 0.48, shellX0, 0, 173, 173.1, 69.2, 85));
285  cones.push_back(new ServiceProperties("HTrackingConeService_8", 13, 0, 0.70, 0.48, shellX0, 0, 173.1, 195, 85, 100));
286 
287  cylinders.push_back(new ServiceProperties("EEMCalSupport", 0, 0, 0, 0, 0, 171, -200, -197, 62, 0));
288 
289  for (ServiceProperties *cylinder : cylinders) radius += TrackingServiceCylinder(cylinder, g4Reco, radius);
290  for (ServiceProperties *cone : cones) radius += TrackingServiceCone(cone, g4Reco, radius);
291 
292  return radius;
293 }
294 
295 #endif