EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4_Pipe.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4_Pipe.C
1 #ifndef MACRO_G4PIPE_C
2 #define MACRO_G4PIPE_C
3 
4 #include <GlobalVariables.C>
5 
8 
9 #include <g4main/PHG4Reco.h>
10 
11 R__LOAD_LIBRARY(libg4detectors.so)
12 
13 namespace Enable
14 {
15  bool PIPE = false;
16  bool PIPE_ABSORBER = false;
17  bool PIPE_OVERLAPCHECK = false;
18  int PIPE_VERBOSITY = 0;
19 } // namespace Enable
20 
21 namespace G4PIPE
22 {
23  double be_pipe_radius = 2.0; // 4.0 cm inner diameter from Dans drawing
24  double be_pipe_thickness = 0.0762; // 760 um based on Dans drawing
25  double be_pipe_length = 80.0; // +/- 40 cm
26 
27  double al_pipe_radius = 2.0; // same as Be pipe
28  double al_pipe_thickness = 0.1600; // 1.6 mm based on spec
29  double al_pipe_length = 171.44; // extension beyond +/- 40 cm
30 
31  double al_pipe_cone_length = 8.56;
32 
33  double al_pipe_ext_radius = 2.5005;
34  double al_pipe_ext_length = 90.; // extension beyond conical part
35 } // namespace G4PIPE
36 
37 void PipeInit()
38 {
42 }
43 
44 double Pipe(PHG4Reco* g4Reco, double radius)
45 {
46  bool AbsorberActive = Enable::ABSORBER || Enable::PIPE_ABSORBER;
47  bool OverlapCheck = Enable::OVERLAPCHECK || Enable::PIPE_OVERLAPCHECK;
49 
50  if (radius > G4PIPE::be_pipe_radius)
51  {
52  cout << "inconsistency: radius: " << radius
53  << " larger than pipe inner radius: " << G4PIPE::be_pipe_radius << endl;
54  gSystem->Exit(-1);
55  }
56 
57  // mid-rapidity beryillium pipe
58  PHG4CylinderSubsystem* cyl = new PHG4CylinderSubsystem("VAC_BE_PIPE", 0);
59  cyl->set_double_param("radius", 0.0);
60  cyl->set_int_param("lengthviarapidity", 0);
62  cyl->set_string_param("material", "G4_Galactic");
63  cyl->set_double_param("thickness", G4PIPE::be_pipe_radius);
64  cyl->SuperDetector("PIPE");
65  if (AbsorberActive) cyl->SetActive();
66  cyl->OverlapCheck(OverlapCheck);
67  g4Reco->registerSubsystem(cyl);
68 
69  cyl = new PHG4CylinderSubsystem("BE_PIPE", 1);
71  cyl->set_int_param("lengthviarapidity", 0);
73  cyl->set_string_param("material", "G4_Be");
75  cyl->SuperDetector("PIPE");
76  if (AbsorberActive) cyl->SetActive();
77  cyl->OverlapCheck(OverlapCheck);
78  g4Reco->registerSubsystem(cyl);
79 
80  // north aluminum pipe
81  cyl = new PHG4CylinderSubsystem("VAC_N_AL_PIPE", 2);
83  cyl->set_double_param("radius", 0.0);
84  cyl->set_int_param("lengthviarapidity", 0);
86  cyl->set_string_param("material", "G4_Galactic");
87  cyl->set_double_param("thickness", G4PIPE::al_pipe_radius);
88  cyl->SuperDetector("PIPE");
89  if (AbsorberActive) cyl->SetActive();
90  cyl->OverlapCheck(OverlapCheck);
91  g4Reco->registerSubsystem(cyl);
92 
93  cyl = new PHG4CylinderSubsystem("N_AL_PIPE", 3);
96  cyl->set_int_param("lengthviarapidity", 0);
98  cyl->set_string_param("material", "G4_Al");
100  cyl->SuperDetector("PIPE");
101  if (AbsorberActive) cyl->SetActive();
102  cyl->OverlapCheck(OverlapCheck);
103  g4Reco->registerSubsystem(cyl);
104 
105  // south aluminum pipe
106  cyl = new PHG4CylinderSubsystem("VAC_S_AL_PIPE", 4);
108  cyl->set_double_param("radius", 0.0);
109  cyl->set_int_param("lengthviarapidity", 0);
111  cyl->set_string_param("material", "G4_Galactic");
112  cyl->set_double_param("thickness", G4PIPE::al_pipe_radius);
113  cyl->SuperDetector("PIPE");
114  if (AbsorberActive) cyl->SetActive();
115  cyl->OverlapCheck(OverlapCheck);
116  g4Reco->registerSubsystem(cyl);
117 
118  cyl = new PHG4CylinderSubsystem("S_AL_PIPE", 5);
121  cyl->set_int_param("lengthviarapidity", 0);
123  cyl->set_string_param("material", "G4_Al");
124  cyl->set_double_param("thickness", G4PIPE::al_pipe_thickness);
125  cyl->SuperDetector("PIPE");
126  if (AbsorberActive) cyl->SetActive();
127  cyl->OverlapCheck(OverlapCheck);
128  g4Reco->registerSubsystem(cyl);
129 
130  PHG4ConeSubsystem* cone = nullptr;
131 
132  double cone_position = 0.5 * G4PIPE::be_pipe_length + G4PIPE::al_pipe_length + 0.5 * G4PIPE::al_pipe_cone_length;
134 
135  /* north aluminum pipe (conical part) */
136  cone = new PHG4ConeSubsystem("N_AL_PIPE_CONE", 6);
140  cone->SetPlaceZ(cone_position + no_overlapp);
141  cone->SetMaterial("G4_Al");
142  cone->SuperDetector("PIPE");
143  if (AbsorberActive) cone->SetActive();
144  cone->OverlapCheck(OverlapCheck);
145  g4Reco->registerSubsystem(cone);
146 
147  /* north aluminum pipe (extension) */
148  cyl = new PHG4CylinderSubsystem("N_AL_PIPE_EXT", 7);
149  cyl->set_double_param("place_z", ext_position);
151  cyl->set_int_param("lengthviarapidity", 0);
153  cyl->set_string_param("material", "G4_Al");
154  cyl->set_double_param("thickness", G4PIPE::al_pipe_thickness);
155  cyl->SuperDetector("PIPE");
156  if (AbsorberActive) cyl->SetActive();
157  cyl->OverlapCheck(OverlapCheck);
158  g4Reco->registerSubsystem(cyl);
159 
160  /* south aluminum pipe (conical part) */
161  cone = new PHG4ConeSubsystem("S_AL_PIPE_CONE", 8);
165  cone->SetPlaceZ(-cone_position - no_overlapp);
166  cone->SetMaterial("G4_Al");
167  cone->SuperDetector("PIPE");
168  if (AbsorberActive) cone->SetActive();
169  cone->OverlapCheck(OverlapCheck);
170  g4Reco->registerSubsystem(cone);
171 
172  /* south aluminum pipe (extension) */
173  cyl = new PHG4CylinderSubsystem("S_AL_PIPE_EXT", 9);
174  cyl->set_double_param("place_z", -ext_position);
176  cyl->set_int_param("lengthviarapidity", 0);
178  cyl->set_string_param("material", "G4_Al");
179  cyl->set_double_param("thickness", G4PIPE::al_pipe_thickness);
180  cyl->SuperDetector("PIPE");
181  if (AbsorberActive) cyl->SetActive();
182  cyl->OverlapCheck(OverlapCheck);
183  g4Reco->registerSubsystem(cyl);
184 
185  /* north aluminum pipe (conical part) [vacuum] */
186  cone = new PHG4ConeSubsystem("VAC_N_AL_PIPE_CONE", 10);
187  cone->SetR1(0., G4PIPE::al_pipe_radius);
190  cone->SetPlaceZ(cone_position + no_overlapp);
191  cone->SetMaterial("G4_Galactic");
192  cone->SuperDetector("PIPE");
193  if (AbsorberActive) cone->SetActive();
194  cone->OverlapCheck(OverlapCheck);
195  g4Reco->registerSubsystem(cone);
196 
197  /* north aluminum pipe (extension) [vacuum] */
198  cyl = new PHG4CylinderSubsystem("VAC_N_AL_PIPE_EXT", 11);
199  cyl->set_double_param("place_z", ext_position + no_overlapp);
200  cyl->set_double_param("radius", 0.);
201  cyl->set_int_param("lengthviarapidity", 0);
203  cyl->set_string_param("material", "G4_Galactic");
204  cyl->set_double_param("thickness", G4PIPE::al_pipe_ext_radius);
205  cyl->SuperDetector("PIPE");
206  if (AbsorberActive) cyl->SetActive();
207  cyl->OverlapCheck(OverlapCheck);
208  g4Reco->registerSubsystem(cyl);
209 
210  /* south aluminum pipe (conical part) [vacuum] */
211  cone = new PHG4ConeSubsystem("VAC_S_AL_PIPE_CONE", 12);
213  cone->SetR2(0., G4PIPE::al_pipe_radius);
215  cone->SetPlaceZ(-cone_position - no_overlapp);
216  cone->SetMaterial("G4_Galactic");
217  cone->SuperDetector("PIPE");
218  if (AbsorberActive) cone->SetActive();
219  cone->OverlapCheck(OverlapCheck);
220  g4Reco->registerSubsystem(cone);
221 
222  /* south aluminum pipe (extension) [vacuum] */
223  cyl = new PHG4CylinderSubsystem("VAC_S_AL_PIPE_EXT", 13);
224  cyl->set_double_param("place_z", -ext_position - no_overlapp);
225  cyl->set_double_param("radius", 0.);
226  cyl->set_int_param("lengthviarapidity", 0);
228  cyl->set_string_param("material", "G4_Galactic");
229  cyl->set_double_param("thickness", G4PIPE::al_pipe_ext_radius);
230  cyl->SuperDetector("PIPE");
231  if (AbsorberActive) cyl->SetActive();
232  cyl->OverlapCheck(OverlapCheck);
233  g4Reco->registerSubsystem(cyl);
234 
236 
237  if (verbosity > 0)
238  {
239  cout << "=========================== G4_Pipe.C::Pipe() =============================" << endl;
240  cout << " PIPE Material Description:" << endl;
241  cout << " inner radius = " << G4PIPE::be_pipe_radius << " cm" << endl;
242  cout << " thickness = " << G4PIPE::be_pipe_thickness << " cm" << endl;
243  cout << " outer radius = " << G4PIPE::be_pipe_radius + G4PIPE::be_pipe_thickness << " cm" << endl;
244  cout << " length = " << G4PIPE::be_pipe_length << " cm" << endl;
245  cout << "===========================================================================" << endl;
246  }
247 
248  radius += no_overlapp;
249 
250  return radius;
251 }
252 #endif