Analysis Software
Documentation for sPHENIX simulation 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  // STAR Beampipe for sPHENIX - based on STAR DWG 30006
24  double be_pipe_radius = 2.00025; // 4.0005 cm inner diameter
25  double be_pipe_thickness = 0.0762; // 0.762 mm
26  double be_pipe_length = 120.015; // 120 cm or 47.25"
27  double be_pipe_zshift = -41.1639; // amount Be pipe is shifted south
28 
29  double al_pipe_radius = 2.00025; // same as Be pipe
30  double al_pipe_thickness = 0.1397; // 1.397 mm or 0.055"
31  double al_pipe_south_length = 101.486; // Al extension south (from Dan's drawing, slight diff from STAR drawing)
32  double al_pipe_north_length = 61.51; // Al extension north (from Dan's drawing, slight diff from STAR drawing)
33  double al_pipe_north_ext_length = 123.393; // additional north extension
34 
35  double flange_thickness = 6.934/2 - (al_pipe_radius + al_pipe_thickness); // Atlas 2.75" flange, radial thickness
36  double flange_length = 1.2825; // Atlas 2.75" flange
37 
38  double outer_pipe_precone_length = 22.86;
39  double outer_pipe_precone_radius = 2.00025; // same as Be pipe
40  double outer_pipe_thickness = 0.1397; // 1.397 mm or 0.055"
41  double outer_pipe_cone_length = 38.1;
42  double outer_pipe_ext_radius = 3.81; // past the cone
43 // double outer_pipe_ext_length = 67.087; // extension beyond conical part
44  double outer_pipe_ext_length = 100.; // extension beyond conical part through epd
45 
46  // maximum extent of the central part of beampipe (the forward regions are implemented in G4_Beamline.C)
49 
50 } // namespace G4PIPE
51 
52 void PipeInit()
53 {
57 }
58 
59 double Pipe(PHG4Reco* g4Reco, double radius)
60 {
61  bool AbsorberActive = Enable::ABSORBER || Enable::PIPE_ABSORBER;
62  bool OverlapCheck = Enable::OVERLAPCHECK || Enable::PIPE_OVERLAPCHECK;
64 
65  if (radius > G4PIPE::be_pipe_radius)
66  {
67  cout << "inconsistency: radius: " << radius
68  << " larger than pipe inner radius: " << G4PIPE::be_pipe_radius << endl;
69  gSystem->Exit(-1);
70  }
71 
72  int ilayer = 0;
73 
74  // mid-rapidity beryllium pipe
75  PHG4CylinderSubsystem* cyl = new PHG4CylinderSubsystem("VAC_BE_PIPE", ilayer++);
77  cyl->set_double_param("radius", 0.0);
78  cyl->set_int_param("lengthviarapidity", 0);
80  cyl->set_string_param("material", "G4_Galactic");
81  cyl->set_double_param("thickness", G4PIPE::be_pipe_radius);
82  cyl->SuperDetector("PIPE");
83  if (AbsorberActive) cyl->SetActive();
84  cyl->OverlapCheck(OverlapCheck);
85  g4Reco->registerSubsystem(cyl);
86 
87  cyl = new PHG4CylinderSubsystem("BE_PIPE", ilayer++);
89  cyl->set_double_param("radius", G4PIPE::be_pipe_radius); // inner radius
90  cyl->set_int_param("lengthviarapidity", 0);
92  cyl->set_string_param("material", "G4_Be");
94  cyl->SuperDetector("PIPE");
95  if (AbsorberActive) cyl->SetActive();
96  cyl->OverlapCheck(OverlapCheck);
97  g4Reco->registerSubsystem(cyl);
98 
99  // north aluminum pipe
101  cyl = new PHG4CylinderSubsystem("VAC_N_AL_PIPE", ilayer++);
102  cyl->set_double_param("place_z", north_pipe_place_z + no_overlapp);
103  cyl->set_double_param("radius", 0.0);
104  cyl->set_int_param("lengthviarapidity", 0);
106  cyl->set_string_param("material", "G4_Galactic");
107  cyl->set_double_param("thickness", G4PIPE::al_pipe_radius);
108  cyl->SuperDetector("PIPE");
109  if (AbsorberActive) cyl->SetActive();
110  cyl->OverlapCheck(OverlapCheck);
111  g4Reco->registerSubsystem(cyl);
112 
113  cyl = new PHG4CylinderSubsystem("N_AL_PIPE", ilayer++);
114  cyl->set_double_param("place_z", north_pipe_place_z + no_overlapp);
116  cyl->set_int_param("lengthviarapidity", 0);
118  cyl->set_string_param("material", "G4_Al");
119  cyl->set_double_param("thickness", G4PIPE::al_pipe_thickness);
120  cyl->SuperDetector("PIPE");
121  if (AbsorberActive) cyl->SetActive();
122  cyl->OverlapCheck(OverlapCheck);
123  g4Reco->registerSubsystem(cyl);
124 
125  // north flange 1A
126  double flange_place_z = G4PIPE::be_pipe_zshift + 0.5 * G4PIPE::be_pipe_length + G4PIPE::al_pipe_north_length; // center of flange coupling
127  // Al half, towards IP
128  cyl = new PHG4CylinderSubsystem("N_FLANGE_1A_AL", ilayer++);
129  cyl->set_double_param("place_z", flange_place_z - 0.75*G4PIPE::flange_length);
131  cyl->set_int_param("lengthviarapidity", 0);
132  cyl->set_double_param("length", G4PIPE::flange_length/2);
133  cyl->set_string_param("material", "G4_Al");
134  cyl->set_double_param("thickness", G4PIPE::flange_thickness);
135  cyl->SuperDetector("PIPE");
136  if (AbsorberActive) cyl->SetActive();
137  cyl->OverlapCheck(OverlapCheck);
138  g4Reco->registerSubsystem(cyl);
139 
140  // SS half, away from IP
141  cyl = new PHG4CylinderSubsystem("N_FLANGE_1A_SS", ilayer++);
142  cyl->set_double_param("place_z", flange_place_z - 0.25*G4PIPE::flange_length);
144  cyl->set_int_param("lengthviarapidity", 0);
145  cyl->set_double_param("length", G4PIPE::flange_length/2);
146  cyl->set_string_param("material", "G4_STAINLESS-STEEL");
147  cyl->set_double_param("thickness", G4PIPE::flange_thickness);
148  cyl->SuperDetector("PIPE");
149  if (AbsorberActive) cyl->SetActive();
150  cyl->OverlapCheck(OverlapCheck);
151  g4Reco->registerSubsystem(cyl);
152 
153  // north flange 1B
154  // SS half, towards IP
155  cyl = new PHG4CylinderSubsystem("N_FLANGE_1B_SS", ilayer++);
156  cyl->set_double_param("place_z", flange_place_z + 0.25*G4PIPE::flange_length);
158  cyl->set_int_param("lengthviarapidity", 0);
159  cyl->set_double_param("length", G4PIPE::flange_length/2);
160  cyl->set_string_param("material", "G4_STAINLESS-STEEL");
161  cyl->set_double_param("thickness", G4PIPE::flange_thickness);
162  cyl->SuperDetector("PIPE");
163  if (AbsorberActive) cyl->SetActive();
164  cyl->OverlapCheck(OverlapCheck);
165  g4Reco->registerSubsystem(cyl);
166 
167  // Al half, away from IP
168  cyl = new PHG4CylinderSubsystem("N_FLANGE_1B_Al", ilayer++);
169  cyl->set_double_param("place_z", flange_place_z + 0.75*G4PIPE::flange_length);
171  cyl->set_int_param("lengthviarapidity", 0);
172  cyl->set_double_param("length", G4PIPE::flange_length/2);
173  cyl->set_string_param("material", "G4_Al");
174  cyl->set_double_param("thickness", G4PIPE::flange_thickness);
175  cyl->SuperDetector("PIPE");
176  if (AbsorberActive) cyl->SetActive();
177  cyl->OverlapCheck(OverlapCheck);
178  g4Reco->registerSubsystem(cyl);
179 
180  // north flange 2A
181  flange_place_z = G4PIPE::be_pipe_zshift + 0.5 * G4PIPE::be_pipe_length + G4PIPE::al_pipe_north_length + G4PIPE::al_pipe_north_ext_length;
182  // Al half, towards IP
183  cyl = new PHG4CylinderSubsystem("N_FLANGE_2A_Al", ilayer++);
184  cyl->set_double_param("place_z", flange_place_z - 0.75*G4PIPE::flange_length);
186  cyl->set_int_param("lengthviarapidity", 0);
187  cyl->set_double_param("length", G4PIPE::flange_length/2);
188  cyl->set_string_param("material", "G4_Al");
189  cyl->set_double_param("thickness", G4PIPE::flange_thickness);
190  cyl->SuperDetector("PIPE");
191  if (AbsorberActive) cyl->SetActive();
192  cyl->OverlapCheck(OverlapCheck);
193  g4Reco->registerSubsystem(cyl);
194 
195  // SS half, away from IP
196  cyl = new PHG4CylinderSubsystem("N_FLANGE_2A_SS", ilayer++);
197  cyl->set_double_param("place_z", flange_place_z - 0.25*G4PIPE::flange_length);
199  cyl->set_int_param("lengthviarapidity", 0);
200  cyl->set_double_param("length", G4PIPE::flange_length/2);
201  cyl->set_string_param("material", "G4_STAINLESS-STEEL");
202  cyl->set_double_param("thickness", G4PIPE::flange_thickness);
203  cyl->SuperDetector("PIPE");
204  if (AbsorberActive) cyl->SetActive();
205  cyl->OverlapCheck(OverlapCheck);
206  g4Reco->registerSubsystem(cyl);
207 
208  // north flange 2B
209  // SS half, towards IP
210  cyl = new PHG4CylinderSubsystem("N_FLANGE_2B_SS", ilayer++);
211  cyl->set_double_param("place_z", flange_place_z + 0.25*G4PIPE::flange_length);
213  cyl->set_int_param("lengthviarapidity", 0);
214  cyl->set_double_param("length", G4PIPE::flange_length/2);
215  cyl->set_string_param("material", "G4_STAINLESS-STEEL");
216  cyl->set_double_param("thickness", G4PIPE::flange_thickness);
217  cyl->SuperDetector("PIPE");
218  if (AbsorberActive) cyl->SetActive();
219  cyl->OverlapCheck(OverlapCheck);
220  g4Reco->registerSubsystem(cyl);
221 
222  // Al half, away from IP
223  cyl = new PHG4CylinderSubsystem("N_FLANGE_2B_Al", ilayer++);
224  cyl->set_double_param("place_z", flange_place_z + 0.75*G4PIPE::flange_length);
226  cyl->set_int_param("lengthviarapidity", 0);
227  cyl->set_double_param("length", G4PIPE::flange_length/2);
228  cyl->set_string_param("material", "G4_Al");
229  cyl->set_double_param("thickness", G4PIPE::flange_thickness);
230  cyl->SuperDetector("PIPE");
231  if (AbsorberActive) cyl->SetActive();
232  cyl->OverlapCheck(OverlapCheck);
233  g4Reco->registerSubsystem(cyl);
234 
235  // south aluminum pipe
236  double south_pipe_place_z = G4PIPE::be_pipe_zshift - 0.5 * G4PIPE::be_pipe_length - 0.5 * G4PIPE::al_pipe_south_length;
237  cyl = new PHG4CylinderSubsystem("VAC_S_AL_PIPE", ilayer++);
238  cyl->set_double_param("place_z", south_pipe_place_z - no_overlapp);
239  cyl->set_double_param("radius", 0.0);
240  cyl->set_int_param("lengthviarapidity", 0);
242  cyl->set_string_param("material", "G4_Galactic");
243  cyl->set_double_param("thickness", G4PIPE::al_pipe_radius);
244  cyl->SuperDetector("PIPE");
245  if (AbsorberActive) cyl->SetActive();
246  cyl->OverlapCheck(OverlapCheck);
247  g4Reco->registerSubsystem(cyl);
248 
249  cyl = new PHG4CylinderSubsystem("S_AL_PIPE", ilayer++);
250  cyl->set_double_param("place_z", south_pipe_place_z - no_overlapp);
252  cyl->set_int_param("lengthviarapidity", 0);
254  cyl->set_string_param("material", "G4_Al");
255  cyl->set_double_param("thickness", G4PIPE::al_pipe_thickness);
256  cyl->SuperDetector("PIPE");
257  if (AbsorberActive) cyl->SetActive();
258  cyl->OverlapCheck(OverlapCheck);
259  g4Reco->registerSubsystem(cyl);
260 
261  // south flange 1A
263  // Al half, towards IP
264  cyl = new PHG4CylinderSubsystem("S_FLANGE_1A_Al", ilayer++);
265  cyl->set_double_param("place_z", flange_place_z + 0.75*G4PIPE::flange_length);
267  cyl->set_int_param("lengthviarapidity", 0);
268  cyl->set_double_param("length", G4PIPE::flange_length/2);
269  cyl->set_string_param("material", "G4_Al");
270  cyl->set_double_param("thickness", G4PIPE::flange_thickness);
271  cyl->SuperDetector("PIPE");
272  if (AbsorberActive) cyl->SetActive();
273  cyl->OverlapCheck(OverlapCheck);
274  g4Reco->registerSubsystem(cyl);
275 
276  // SS half, away from IP
277  cyl = new PHG4CylinderSubsystem("S_FLANGE_1A_SS", ilayer++);
278  cyl->set_double_param("place_z", flange_place_z + 0.25*G4PIPE::flange_length);
280  cyl->set_int_param("lengthviarapidity", 0);
281  cyl->set_double_param("length", G4PIPE::flange_length/2);
282  cyl->set_string_param("material", "G4_STAINLESS-STEEL");
283  cyl->set_double_param("thickness", G4PIPE::flange_thickness);
284  cyl->SuperDetector("PIPE");
285  if (AbsorberActive) cyl->SetActive();
286  cyl->OverlapCheck(OverlapCheck);
287  g4Reco->registerSubsystem(cyl);
288 
289  // south flange 1B
290  // SS half, towards IP
291  cyl = new PHG4CylinderSubsystem("S_FLANGE_1B_SS", ilayer++);
292  cyl->set_double_param("place_z", flange_place_z - 0.25*G4PIPE::flange_length);
294  cyl->set_int_param("lengthviarapidity", 0);
295  cyl->set_double_param("length", G4PIPE::flange_length/2);
296  cyl->set_string_param("material", "G4_STAINLESS-STEEL");
297  cyl->set_double_param("thickness", G4PIPE::flange_thickness);
298  cyl->SuperDetector("PIPE");
299  if (AbsorberActive) cyl->SetActive();
300  cyl->OverlapCheck(OverlapCheck);
301  g4Reco->registerSubsystem(cyl);
302 
303  // Al half, away from IP
304  cyl = new PHG4CylinderSubsystem("S_FLANGE_1B_AL", ilayer++);
305  cyl->set_double_param("place_z", flange_place_z - 0.75*G4PIPE::flange_length);
307  cyl->set_int_param("lengthviarapidity", 0);
308  cyl->set_double_param("length", G4PIPE::flange_length/2);
309  cyl->set_string_param("material", "G4_Al");
310  cyl->set_double_param("thickness", G4PIPE::flange_thickness);
311  cyl->SuperDetector("PIPE");
312  if (AbsorberActive) cyl->SetActive();
313  cyl->OverlapCheck(OverlapCheck);
314  g4Reco->registerSubsystem(cyl);
315 
316  /* north outermost pipe (extension) [vacuum] */
317  north_pipe_place_z += 0.5 * (G4PIPE::al_pipe_north_length + G4PIPE::al_pipe_north_ext_length) + 0.5 * G4PIPE::outer_pipe_precone_length;
318  cyl = new PHG4CylinderSubsystem("VAC_N_OUTER_PIPE_PRECONE", ilayer++);
319  cyl->set_double_param("place_z", north_pipe_place_z + no_overlapp);
320  cyl->set_double_param("radius", 0.);
321  cyl->set_int_param("lengthviarapidity", 0);
323  cyl->set_string_param("material", "G4_Galactic");
325  cyl->SuperDetector("PIPE");
326  if (AbsorberActive) cyl->SetActive();
327  cyl->OverlapCheck(OverlapCheck);
328  g4Reco->registerSubsystem(cyl);
329 
330  /* north outermost pipe (pre-conical part) */
331  cyl = new PHG4CylinderSubsystem("N_OUTER_PIPE_PRECONE", ilayer++);
332  cyl->set_double_param("place_z", north_pipe_place_z + no_overlapp);
334  cyl->set_int_param("lengthviarapidity", 0);
336  cyl->set_string_param("material", "G4_Al");
338  cyl->SuperDetector("PIPE");
339  if (AbsorberActive) cyl->SetActive();
340  cyl->OverlapCheck(OverlapCheck);
341  g4Reco->registerSubsystem(cyl);
342 
343  PHG4ConeSubsystem* cone = nullptr;
344 
345  /* north outermost pipe (conical part) [vacuum] */
346  north_pipe_place_z += 0.5 * G4PIPE::outer_pipe_precone_length + 0.5 * G4PIPE::outer_pipe_cone_length;
347  cone = new PHG4ConeSubsystem("VAC_N_OUTER_PIPE_CONE", ilayer++);
351  cone->SetPlaceZ(north_pipe_place_z + no_overlapp);
352  cone->SetMaterial("G4_Galactic");
353  cone->SuperDetector("PIPE");
354  if (AbsorberActive) cone->SetActive();
355  cone->OverlapCheck(OverlapCheck);
356  g4Reco->registerSubsystem(cone);
357 
358  /* north outermost pipe (conical part) */
359  cone = new PHG4ConeSubsystem("N_OUTER_PIPE_CONE", ilayer++);
363  cone->SetPlaceZ(north_pipe_place_z + no_overlapp);
364  cone->SetMaterial("G4_Al");
365  cone->SuperDetector("PIPE");
366  if (AbsorberActive) cone->SetActive();
367  cone->OverlapCheck(OverlapCheck);
368  g4Reco->registerSubsystem(cone);
369 
370  /* north outermost pipe (extension) [vacuum] */
371  north_pipe_place_z += 0.5 * G4PIPE::outer_pipe_cone_length + 0.5 * G4PIPE::outer_pipe_ext_length;
372  cyl = new PHG4CylinderSubsystem("VAC_N_OUTER_PIPE_EXT", ilayer++);
373  cyl->set_double_param("place_z", north_pipe_place_z + no_overlapp);
374  cyl->set_double_param("radius", 0.);
375  cyl->set_int_param("lengthviarapidity", 0);
377  cyl->set_string_param("material", "G4_Galactic");
379  cyl->SuperDetector("PIPE");
380  if (AbsorberActive) cyl->SetActive();
381  cyl->OverlapCheck(OverlapCheck);
382  g4Reco->registerSubsystem(cyl);
383 
384  /* north outermost pipe (extension) */
385  cyl = new PHG4CylinderSubsystem("N_OUTER_PIPE_EXT", ilayer++);
386  cyl->set_double_param("place_z", north_pipe_place_z + no_overlapp);
388  cyl->set_int_param("lengthviarapidity", 0);
390  cyl->set_string_param("material", "G4_Al");
392  cyl->SuperDetector("PIPE");
393  if (AbsorberActive) cyl->SetActive();
394  cyl->OverlapCheck(OverlapCheck);
395  g4Reco->registerSubsystem(cyl);
396 
397  /* south outermost pipe (pre-conical part) [vacuum] */
398  south_pipe_place_z -= (0.5 * G4PIPE::al_pipe_south_length + 0.5 * G4PIPE::outer_pipe_precone_length);
399  cyl = new PHG4CylinderSubsystem("VAC_S_OUTER_PIPE_PRECONE", ilayer++);
400  cyl->set_double_param("place_z", south_pipe_place_z - no_overlapp);
401  cyl->set_double_param("radius", 0.);
402  cyl->set_int_param("lengthviarapidity", 0);
404  cyl->set_string_param("material", "G4_Galactic");
406  cyl->SuperDetector("PIPE");
407  if (AbsorberActive) cyl->SetActive();
408  cyl->OverlapCheck(OverlapCheck);
409  g4Reco->registerSubsystem(cyl);
410 
411  /* south outermost pipe (pre-conical part) */
412  cyl = new PHG4CylinderSubsystem("S_OUTER_PIPE_PRECONE", ilayer++);
413  cyl->set_double_param("place_z", south_pipe_place_z - no_overlapp);
415  cyl->set_int_param("lengthviarapidity", 0);
417  cyl->set_string_param("material", "G4_Al");
419  cyl->SuperDetector("PIPE");
420  if (AbsorberActive) cyl->SetActive();
421  cyl->OverlapCheck(OverlapCheck);
422  g4Reco->registerSubsystem(cyl);
423 
424  /* south outermost pipe (conical part) [vacuum] */
425  south_pipe_place_z -= (0.5 * G4PIPE::outer_pipe_precone_length + 0.5 * G4PIPE::outer_pipe_cone_length);
426  cone = new PHG4ConeSubsystem("VAC_S_AL_PIPE_CONE", ilayer++);
430  cone->SetPlaceZ(south_pipe_place_z - no_overlapp);
431  cone->SetMaterial("G4_Galactic");
432  cone->SuperDetector("PIPE");
433  if (AbsorberActive) cone->SetActive();
434  cone->OverlapCheck(OverlapCheck);
435  g4Reco->registerSubsystem(cone);
436 
437  /* south outermost pipe (conical part) */
438  cone = new PHG4ConeSubsystem("S_OUTER_PIPE_CONE", ilayer++);
442  cone->SetPlaceZ(south_pipe_place_z - no_overlapp);
443  cone->SetMaterial("G4_Al");
444  cone->SuperDetector("PIPE");
445  if (AbsorberActive) cone->SetActive();
446  cone->OverlapCheck(OverlapCheck);
447  g4Reco->registerSubsystem(cone);
448 
449  /* south outermost pipe (extension) [vacuum] */
450  south_pipe_place_z -= (0.5 * G4PIPE::outer_pipe_cone_length + 0.5 * G4PIPE::outer_pipe_ext_length);
451  cyl = new PHG4CylinderSubsystem("VAC_S_OUTER_PIPE_EXT", ilayer++);
452  cyl->set_double_param("place_z", south_pipe_place_z - no_overlapp);
453  cyl->set_double_param("radius", 0.);
454  cyl->set_int_param("lengthviarapidity", 0);
456  cyl->set_string_param("material", "G4_Galactic");
458  cyl->SuperDetector("PIPE");
459  if (AbsorberActive) cyl->SetActive();
460  cyl->OverlapCheck(OverlapCheck);
461  g4Reco->registerSubsystem(cyl);
462 
463  /* south outermost pipe (extension) */
464  cyl = new PHG4CylinderSubsystem("S_OUTER_PIPE_EXT", ilayer++);
465  cyl->set_double_param("place_z", south_pipe_place_z - no_overlapp);
467  cyl->set_int_param("lengthviarapidity", 0);
469  cyl->set_string_param("material", "G4_Al");
471  cyl->SuperDetector("PIPE");
472  if (AbsorberActive) cyl->SetActive();
473  cyl->OverlapCheck(OverlapCheck);
474  g4Reco->registerSubsystem(cyl);
475 
477 
478  if (verbosity > 0)
479  {
480  cout << "=========================== G4_Pipe.C::Pipe() =============================" << endl;
481  cout << " PIPE Material Description:" << endl;
482  cout << " inner radius = " << G4PIPE::be_pipe_radius << " cm" << endl;
483  cout << " thickness = " << G4PIPE::be_pipe_thickness << " cm" << endl;
484  cout << " outer radius = " << G4PIPE::be_pipe_radius + G4PIPE::be_pipe_thickness << " cm" << endl;
485  cout << " length = " << G4PIPE::be_pipe_length << " cm" << endl;
486  cout << "===========================================================================" << endl;
487  }
488 
489  radius += no_overlapp;
490 
491  return radius;
492 }
493 #endif