EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4_TPC_EIC.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4_TPC_EIC.C
1 #ifndef MACRO_G4TPCEIC_C
2 #define MACRO_G4TPCEIC_C
3 
4 #include <GlobalVariables.C>
5 
6 #include <G4_Mvtx_EIC.C>
7 
9 
11 
12 #include <g4main/PHG4Reco.h>
13 
14 #include <fun4all/Fun4AllServer.h>
15 
16 #include <cmath>
17 #include <vector>
18 
19 R__LOAD_LIBRARY(libg4eval.so)
20 R__LOAD_LIBRARY(libg4mvtx.so)
21 R__LOAD_LIBRARY(libg4tpc.so)
22 
23 namespace Enable
24 {
25  bool TPC = false;
26  bool TPC_ENDCAP = false;
27  bool TPC_ABSORBER = false;
28  bool TPC_OVERLAPCHECK = false;
29 } // namespace Enable
30 
31 namespace G4TPC
32 {
34  double tpc_layer_thick_inner = 1.25; // EIC- recover default inner radius of TPC vol.
36 
37  int n_tpc_layer_mid = 16;
38  double tpc_layer_thick_mid = 1.25;
40 
42  double tpc_layer_thick_outer = 1.125; // outer later reach from 60-78 cm (instead of 80 cm), that leads to radial thickness of 1.125 cm
44 
45  double outer_radius = 78.;
46  double inner_cage_radius = 20.;
47  double cage_length = 211.0; // From TPC group, gives eta = 1.1 at 78 cm
48  double n_rad_length_cage = 1.13e-02;
49  double cage_thickness = 28.6 * n_rad_length_cage; // Kapton X_0 = 28.6 cm // mocks up Kapton + carbon fiber structure
50 
51  string tpcgas = "sPHENIX_TPC_Gas"; // Ne(90%) CF4(10%) - defined in g4main/PHG4Reco.cc
52 
53 } // namespace G4TPC
54 
55 void TPCInit()
56 {
57  // BlackHoleGeometry::max_radius set at the end of the TPC function
60 }
61 
63 void TPC_Endcaps(PHG4Reco* g4Reco)
64 {
65  bool OverlapCheck = Enable::OVERLAPCHECK || Enable::TPC_OVERLAPCHECK;
66  bool AbsorberActive = Enable::ABSORBER || Enable::TPC_ABSORBER;
67 
68  PHG4TpcEndCapSubsystem* tpc_endcap = new PHG4TpcEndCapSubsystem("TPC_ENDCAP");
69  tpc_endcap->SuperDetector("TPC_ENDCAP");
70 
71  if (AbsorberActive) tpc_endcap->SetActive();
72  tpc_endcap->OverlapCheck(OverlapCheck);
73 
74  // tpc_endcap->set_int_param("construction_verbosity", 2);
75 
76  g4Reco->registerSubsystem(tpc_endcap);
77 
78  return;
79 }
80 
81 double TPC(PHG4Reco* g4Reco, double radius,
82  const int absorberactive = 0,
83  int verbosity = 0)
84 {
85  // time projection chamber layers --------------------------------------------
86 
88 
89  radius = G4TPC::inner_cage_radius;
90 
91  // inner field cage
92  cyl = new PHG4CylinderSubsystem("FIELDCAGE", G4MVTX::n_maps_layer);
93  cyl->set_double_param("radius", radius);
94  cyl->set_double_param("length", G4TPC::cage_length);
95  cyl->set_string_param("material", "G4_KAPTON");
96  cyl->set_double_param("thickness", G4TPC::cage_thickness);
97  cyl->SuperDetector("FIELDCAGE");
98  cyl->Verbosity(0);
99  g4Reco->registerSubsystem(cyl);
100 
101  radius += G4TPC::cage_thickness;
102 
103  // double inner_readout_radius = radius;
104  // if (inner_readout_radius < radius) inner_readout_radius = radius;
105  //
106  //
107 
108  int n_tpc_layers[3] = {16, 16, 16};
109  int tpc_layer_rphi_count[3] = {1152, 1536, 2304};
110 
111  double tpc_region_thickness[3] = {20., 20., 18.};
112  // Active layers of the TPC (inner layers)
113  int nlayer = G4MVTX::n_maps_layer;
114  for (int irange = 0; irange < 3; irange++)
115  {
116  double tpc_layer_thickness = tpc_region_thickness[irange] / n_tpc_layers[irange]; // thickness per layer
117  for (int ilayer = 0; ilayer < n_tpc_layers[irange]; ilayer++)
118  {
119  cyl = new PHG4CylinderSubsystem("TPC", nlayer);
120  cyl->set_double_param("radius", radius);
121  cyl->set_double_param("length", G4TPC::cage_length);
122  cyl->set_string_param("material", G4TPC::tpcgas);
123  cyl->set_double_param("thickness", tpc_layer_thickness - 0.01);
124  cyl->SetActive();
125  cyl->SuperDetector("TPC");
126  g4Reco->registerSubsystem(cyl);
127 
128  radius += tpc_layer_thickness;
129  nlayer++;
130  }
131  }
132 
133  // outer field cage
134  cyl = new PHG4CylinderSubsystem("FIELDCAGE", nlayer);
135  cyl->set_double_param("radius", radius);
136  cyl->set_int_param("lengthviarapidity", 0);
137  cyl->set_double_param("length", G4TPC::cage_length);
138  cyl->set_string_param("material", "G4_KAPTON");
139  cyl->set_double_param("thickness", G4TPC::cage_thickness); // Kapton X_0 = 28.6 cm
140  cyl->SuperDetector("FIELDCAGE");
141  g4Reco->registerSubsystem(cyl);
142 
143  radius += G4TPC::cage_thickness;
144 
145  if (Enable::TPC_ENDCAP)
146  {
147  TPC_Endcaps(g4Reco);
148  }
149  // update now that we know the outer radius
151  return radius;
152 }
153 
154 #endif