Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-12-16 09:24:03

0001 #ifndef MACRO_G4PIPE_C
0002 #define MACRO_G4PIPE_C
0003 
0004 #include <GlobalVariables.C>
0005 
0006 #include <G4_TrkrVariables.C>
0007 
0008 #include <g4detectors/PHG4ConeSubsystem.h>
0009 #include <g4detectors/PHG4CylinderSubsystem.h>
0010 
0011 #include <g4main/PHG4Reco.h>
0012 
0013 #include <Rtypes.h>
0014 #include <TSystem.h>
0015 
0016 #include <cmath>
0017 
0018 R__LOAD_LIBRARY(libg4detectors.so)
0019 
0020 namespace Enable
0021 {
0022   bool PIPE = false;
0023   bool PIPE_ABSORBER = false;
0024   bool PIPE_OVERLAPCHECK = false;
0025   int PIPE_VERBOSITY = 0;
0026   bool PIPE_MISALIGNMENT = false;
0027 }  // namespace Enable
0028 
0029 namespace G4PIPE
0030 {
0031   // STAR Beampipe for sPHENIX - based on STAR DWG 30006
0032   double be_pipe_radius = 2.00025;    // 4.0005 cm inner diameter
0033   double be_pipe_thickness = 0.0762;  // 0.762 mm
0034   double be_pipe_length = 120.015;    // 120 cm or 47.25"
0035   double be_pipe_zshift = -41.1639;   // amount Be pipe is shifted south
0036 
0037   double al_pipe_radius = 2.00025;            // same as Be pipe
0038   double al_pipe_thickness = 0.1397;          // 1.397 mm or 0.055"
0039   double al_pipe_south_length = 101.486;      // Al extension south (from Dan's drawing, slight diff from STAR drawing)
0040   double al_pipe_north_length = 61.51;        // Al extension north (from Dan's drawing, slight diff from STAR drawing)
0041   double al_pipe_north_ext_length = 123.393;  // additional north extension
0042 
0043   double flange_thickness = 6.934 / 2. - (al_pipe_radius + al_pipe_thickness);  // Atlas 2.75" flange, radial thickness
0044   double flange_length = 1.2825;                                                // Atlas 2.75" flange
0045 
0046   double outer_pipe_precone_length = 22.86;
0047   double outer_pipe_precone_radius = 2.00025;  // same as Be pipe
0048   double outer_pipe_thickness = 0.1397;        // 1.397 mm or 0.055"
0049   double outer_pipe_cone_length = 38.1;
0050   double outer_pipe_ext_radius = 3.81;  // past the cone
0051                                         //  double outer_pipe_ext_length = 67.087;    // extension beyond conical part
0052   double outer_pipe_ext_length = 100.;  // extension beyond conical part through epd
0053 
0054   // maximum extent of the central part of beampipe (the forward regions are implemented in G4_Beamline.C)
0055   double max_z = be_pipe_zshift + be_pipe_length / 2. + al_pipe_north_length + al_pipe_north_ext_length +
0056                  outer_pipe_precone_length + outer_pipe_cone_length + outer_pipe_ext_length;
0057 
0058   double pipe_xshift = 0.;
0059   double pipe_yshift = 0.;
0060   double pipe_zshift = 0.;
0061 
0062   double pipe_zshift_2024 = 0.751524 * 0.1;  // 0.751524 mm
0063   double max_z_north = be_pipe_zshift + 0.5 * be_pipe_length + al_pipe_north_length + al_pipe_north_ext_length + outer_pipe_precone_length + outer_pipe_cone_length + outer_pipe_ext_length;
0064 
0065   double max_z_south = be_pipe_zshift - 0.5 * be_pipe_length - al_pipe_south_length - outer_pipe_precone_length - outer_pipe_cone_length - outer_pipe_ext_length;
0066 }  // namespace G4PIPE
0067 
0068 void PipeInit()
0069 {
0070   Enable::PIPE_MISALIGNMENT = Enable::MVTX_APPLYMISALIGNMENT;
0071   if (Enable::PIPE_MISALIGNMENT)
0072   {
0073     // Shifts of beam pipe (2024)
0074     G4PIPE::pipe_xshift = (5.161786 + 0.2) * 0.1;  // 5.161786 + 0.2 mm
0075     G4PIPE::pipe_yshift = 0.0 * 0.1;               // 0.0 mm
0076     G4PIPE::pipe_zshift = G4PIPE::pipe_zshift_2024;
0077     G4PIPE::be_pipe_zshift += G4PIPE::pipe_zshift;
0078     G4PIPE::max_z_north += G4PIPE::pipe_zshift;
0079     G4PIPE::max_z_south += G4PIPE::pipe_zshift;
0080   }
0081 
0082   BlackHoleGeometry::max_radius = std::max(BlackHoleGeometry::max_radius, G4PIPE::outer_pipe_ext_radius + G4PIPE::outer_pipe_thickness + std::sqrt(G4PIPE::pipe_xshift * G4PIPE::pipe_xshift + G4PIPE::pipe_yshift * G4PIPE::pipe_yshift) + no_overlapp);
0083   BlackHoleGeometry::max_z = std::max(BlackHoleGeometry::max_z, G4PIPE::max_z_north + no_overlapp);
0084   BlackHoleGeometry::min_z = std::min(BlackHoleGeometry::min_z, G4PIPE::max_z_south - no_overlapp);
0085 }
0086 
0087 double Pipe(PHG4Reco* g4Reco, double radius)
0088 {
0089   bool AbsorberActive = Enable::ABSORBER || Enable::PIPE_ABSORBER;
0090   bool OverlapCheck = Enable::OVERLAPCHECK || Enable::PIPE_OVERLAPCHECK;
0091   int verbosity = std::max(Enable::VERBOSITY, Enable::PIPE_VERBOSITY);
0092 
0093   if (radius > G4PIPE::be_pipe_radius)
0094   {
0095     std::cout << "inconsistency: radius: " << radius
0096               << " larger than pipe inner radius: " << G4PIPE::be_pipe_radius << std::endl;
0097     gSystem->Exit(-1);
0098   }
0099 
0100   if (verbosity > 0)
0101   {
0102     std::cout << "PHG4Reco::Registering Pipe Subsystems, PIPE_MISALIGNMENT = " << Enable::PIPE_MISALIGNMENT << std::endl
0103               << " pipe is shifted by (x,y,z) = (" << G4PIPE::pipe_xshift << ", " << G4PIPE::pipe_yshift << ", " << G4PIPE::pipe_zshift << ") cm" << std::endl;
0104   }
0105 
0106   int ilayer = 0;
0107 
0108   // mid-rapidity beryllium pipe
0109   PHG4CylinderSubsystem* cyl = new PHG4CylinderSubsystem("VAC_BE_PIPE", ilayer++);
0110   cyl->set_double_param("place_x", G4PIPE::pipe_xshift);
0111   cyl->set_double_param("place_y", G4PIPE::pipe_yshift);
0112   cyl->set_double_param("place_z", G4PIPE::be_pipe_zshift);
0113   cyl->set_double_param("radius", 0.0);
0114   cyl->set_int_param("lengthviarapidity", 0);
0115   cyl->set_double_param("length", G4PIPE::be_pipe_length);
0116   cyl->set_string_param("material", "G4_Galactic");
0117   cyl->set_double_param("thickness", G4PIPE::be_pipe_radius);
0118   cyl->SuperDetector("PIPE");
0119   if (AbsorberActive)
0120   {
0121     cyl->SetActive();
0122   }
0123   cyl->OverlapCheck(OverlapCheck);
0124   g4Reco->registerSubsystem(cyl);
0125 
0126   cyl = new PHG4CylinderSubsystem("BE_PIPE", ilayer++);
0127   cyl->set_double_param("place_x", G4PIPE::pipe_xshift);
0128   cyl->set_double_param("place_y", G4PIPE::pipe_yshift);
0129   cyl->set_double_param("place_z", G4PIPE::be_pipe_zshift);
0130   cyl->set_double_param("radius", G4PIPE::be_pipe_radius);  // inner radius
0131   cyl->set_int_param("lengthviarapidity", 0);
0132   cyl->set_double_param("length", G4PIPE::be_pipe_length);
0133   cyl->set_string_param("material", "G4_Be");
0134   cyl->set_double_param("thickness", G4PIPE::be_pipe_thickness);
0135   cyl->SuperDetector("PIPE");
0136   if (AbsorberActive)
0137   {
0138     cyl->SetActive();
0139   }
0140   cyl->OverlapCheck(OverlapCheck);
0141   g4Reco->registerSubsystem(cyl);
0142 
0143   // north aluminum pipe
0144   double north_pipe_place_z = G4PIPE::be_pipe_zshift + 0.5 * G4PIPE::be_pipe_length + 0.5 * (G4PIPE::al_pipe_north_length + G4PIPE::al_pipe_north_ext_length);
0145   cyl = new PHG4CylinderSubsystem("VAC_N_AL_PIPE", ilayer++);
0146   cyl->set_double_param("place_x", G4PIPE::pipe_xshift);
0147   cyl->set_double_param("place_y", G4PIPE::pipe_yshift);
0148   cyl->set_double_param("place_z", north_pipe_place_z);
0149   cyl->set_double_param("radius", 0.0);
0150   cyl->set_int_param("lengthviarapidity", 0);
0151   cyl->set_double_param("length", G4PIPE::al_pipe_north_length + G4PIPE::al_pipe_north_ext_length);
0152   cyl->set_string_param("material", "G4_Galactic");
0153   cyl->set_double_param("thickness", G4PIPE::al_pipe_radius);
0154   cyl->SuperDetector("PIPE");
0155   if (AbsorberActive)
0156   {
0157     cyl->SetActive();
0158   }
0159   cyl->OverlapCheck(OverlapCheck);
0160   g4Reco->registerSubsystem(cyl);
0161 
0162   cyl = new PHG4CylinderSubsystem("N_AL_PIPE", ilayer++);
0163   cyl->set_double_param("place_x", G4PIPE::pipe_xshift);
0164   cyl->set_double_param("place_y", G4PIPE::pipe_yshift);
0165   cyl->set_double_param("place_z", north_pipe_place_z);
0166   cyl->set_double_param("radius", G4PIPE::al_pipe_radius);
0167   cyl->set_int_param("lengthviarapidity", 0);
0168   cyl->set_double_param("length", G4PIPE::al_pipe_north_length + G4PIPE::al_pipe_north_ext_length);
0169   cyl->set_string_param("material", "G4_Al");
0170   cyl->set_double_param("thickness", G4PIPE::al_pipe_thickness);
0171   cyl->SuperDetector("PIPE");
0172   if (AbsorberActive)
0173   {
0174     cyl->SetActive();
0175   }
0176   cyl->OverlapCheck(OverlapCheck);
0177   g4Reco->registerSubsystem(cyl);
0178 
0179   // north flange 1A
0180   double flange_place_z = G4PIPE::be_pipe_zshift + 0.5 * G4PIPE::be_pipe_length + G4PIPE::al_pipe_north_length;  // center of flange coupling
0181   // Al half, towards IP
0182   cyl = new PHG4CylinderSubsystem("N_FLANGE_1A_AL", ilayer++);
0183   cyl->set_double_param("place_x", G4PIPE::pipe_xshift);
0184   cyl->set_double_param("place_y", G4PIPE::pipe_yshift);
0185   cyl->set_double_param("place_z", flange_place_z - 0.75 * G4PIPE::flange_length);
0186   cyl->set_double_param("radius", G4PIPE::al_pipe_radius + G4PIPE::al_pipe_thickness);
0187   cyl->set_int_param("lengthviarapidity", 0);
0188   cyl->set_double_param("length", G4PIPE::flange_length / 2);
0189   cyl->set_string_param("material", "G4_Al");
0190   cyl->set_double_param("thickness", G4PIPE::flange_thickness);
0191   cyl->SuperDetector("PIPE");
0192   if (AbsorberActive)
0193   {
0194     cyl->SetActive();
0195   }
0196   cyl->OverlapCheck(OverlapCheck);
0197   g4Reco->registerSubsystem(cyl);
0198 
0199   // SS half, away from IP
0200   cyl = new PHG4CylinderSubsystem("N_FLANGE_1A_SS", ilayer++);
0201   cyl->set_double_param("place_x", G4PIPE::pipe_xshift);
0202   cyl->set_double_param("place_y", G4PIPE::pipe_yshift);
0203   cyl->set_double_param("place_z", flange_place_z - 0.25 * G4PIPE::flange_length);
0204   cyl->set_double_param("radius", G4PIPE::al_pipe_radius + G4PIPE::al_pipe_thickness);
0205   cyl->set_int_param("lengthviarapidity", 0);
0206   cyl->set_double_param("length", G4PIPE::flange_length / 2);
0207   cyl->set_string_param("material", "G4_STAINLESS-STEEL");
0208   cyl->set_double_param("thickness", G4PIPE::flange_thickness);
0209   cyl->SuperDetector("PIPE");
0210   if (AbsorberActive)
0211   {
0212     cyl->SetActive();
0213   }
0214   cyl->OverlapCheck(OverlapCheck);
0215   g4Reco->registerSubsystem(cyl);
0216 
0217   // north flange 1B
0218   // SS half, towards IP
0219   cyl = new PHG4CylinderSubsystem("N_FLANGE_1B_SS", ilayer++);
0220   cyl->set_double_param("place_x", G4PIPE::pipe_xshift);
0221   cyl->set_double_param("place_y", G4PIPE::pipe_yshift);
0222   cyl->set_double_param("place_z", flange_place_z + 0.25 * G4PIPE::flange_length);
0223   cyl->set_double_param("radius", G4PIPE::al_pipe_radius + G4PIPE::al_pipe_thickness);
0224   cyl->set_int_param("lengthviarapidity", 0);
0225   cyl->set_double_param("length", G4PIPE::flange_length / 2);
0226   cyl->set_string_param("material", "G4_STAINLESS-STEEL");
0227   cyl->set_double_param("thickness", G4PIPE::flange_thickness);
0228   cyl->SuperDetector("PIPE");
0229   if (AbsorberActive)
0230   {
0231     cyl->SetActive();
0232   }
0233   cyl->OverlapCheck(OverlapCheck);
0234   g4Reco->registerSubsystem(cyl);
0235 
0236   // Al half, away from IP
0237   cyl = new PHG4CylinderSubsystem("N_FLANGE_1B_Al", ilayer++);
0238   cyl->set_double_param("place_x", G4PIPE::pipe_xshift);
0239   cyl->set_double_param("place_y", G4PIPE::pipe_yshift);
0240   cyl->set_double_param("place_z", flange_place_z + 0.75 * G4PIPE::flange_length);
0241   cyl->set_double_param("radius", G4PIPE::al_pipe_radius + G4PIPE::al_pipe_thickness);
0242   cyl->set_int_param("lengthviarapidity", 0);
0243   cyl->set_double_param("length", G4PIPE::flange_length / 2);
0244   cyl->set_string_param("material", "G4_Al");
0245   cyl->set_double_param("thickness", G4PIPE::flange_thickness);
0246   cyl->SuperDetector("PIPE");
0247   if (AbsorberActive)
0248   {
0249     cyl->SetActive();
0250   }
0251   cyl->OverlapCheck(OverlapCheck);
0252   g4Reco->registerSubsystem(cyl);
0253 
0254   // north flange 2A
0255   flange_place_z = G4PIPE::be_pipe_zshift + 0.5 * G4PIPE::be_pipe_length + G4PIPE::al_pipe_north_length + G4PIPE::al_pipe_north_ext_length;
0256   // Al half, towards IP
0257   cyl = new PHG4CylinderSubsystem("N_FLANGE_2A_Al", ilayer++);
0258   cyl->set_double_param("place_x", G4PIPE::pipe_xshift);
0259   cyl->set_double_param("place_y", G4PIPE::pipe_yshift);
0260   cyl->set_double_param("place_z", flange_place_z - 0.75 * G4PIPE::flange_length);
0261   cyl->set_double_param("radius", G4PIPE::al_pipe_radius + G4PIPE::al_pipe_thickness);
0262   cyl->set_int_param("lengthviarapidity", 0);
0263   cyl->set_double_param("length", G4PIPE::flange_length / 2);
0264   cyl->set_string_param("material", "G4_Al");
0265   cyl->set_double_param("thickness", G4PIPE::flange_thickness);
0266   cyl->SuperDetector("PIPE");
0267   if (AbsorberActive)
0268   {
0269     cyl->SetActive();
0270   }
0271   cyl->OverlapCheck(OverlapCheck);
0272   g4Reco->registerSubsystem(cyl);
0273 
0274   // SS half, away from IP
0275   cyl = new PHG4CylinderSubsystem("N_FLANGE_2A_SS", ilayer++);
0276   cyl->set_double_param("place_x", G4PIPE::pipe_xshift);
0277   cyl->set_double_param("place_y", G4PIPE::pipe_yshift);
0278   cyl->set_double_param("place_z", flange_place_z - 0.25 * G4PIPE::flange_length);
0279   cyl->set_double_param("radius", G4PIPE::al_pipe_radius + G4PIPE::al_pipe_thickness);
0280   cyl->set_int_param("lengthviarapidity", 0);
0281   cyl->set_double_param("length", G4PIPE::flange_length / 2);
0282   cyl->set_string_param("material", "G4_STAINLESS-STEEL");
0283   cyl->set_double_param("thickness", G4PIPE::flange_thickness);
0284   cyl->SuperDetector("PIPE");
0285   if (AbsorberActive)
0286   {
0287     cyl->SetActive();
0288   }
0289   cyl->OverlapCheck(OverlapCheck);
0290   g4Reco->registerSubsystem(cyl);
0291 
0292   // north flange 2B
0293   // SS half, towards IP
0294   cyl = new PHG4CylinderSubsystem("N_FLANGE_2B_SS", ilayer++);
0295   cyl->set_double_param("place_x", G4PIPE::pipe_xshift);
0296   cyl->set_double_param("place_y", G4PIPE::pipe_yshift);
0297   cyl->set_double_param("place_z", flange_place_z + 0.25 * G4PIPE::flange_length);
0298   cyl->set_double_param("radius", G4PIPE::al_pipe_radius + G4PIPE::al_pipe_thickness);
0299   cyl->set_int_param("lengthviarapidity", 0);
0300   cyl->set_double_param("length", G4PIPE::flange_length / 2);
0301   cyl->set_string_param("material", "G4_STAINLESS-STEEL");
0302   cyl->set_double_param("thickness", G4PIPE::flange_thickness);
0303   cyl->SuperDetector("PIPE");
0304   if (AbsorberActive)
0305   {
0306     cyl->SetActive();
0307   }
0308   cyl->OverlapCheck(OverlapCheck);
0309   g4Reco->registerSubsystem(cyl);
0310 
0311   // Al half, away from IP
0312   cyl = new PHG4CylinderSubsystem("N_FLANGE_2B_Al", ilayer++);
0313   cyl->set_double_param("place_x", G4PIPE::pipe_xshift);
0314   cyl->set_double_param("place_y", G4PIPE::pipe_yshift);
0315   cyl->set_double_param("place_z", flange_place_z + 0.75 * G4PIPE::flange_length);
0316   cyl->set_double_param("radius", G4PIPE::al_pipe_radius + G4PIPE::al_pipe_thickness);
0317   cyl->set_int_param("lengthviarapidity", 0);
0318   cyl->set_double_param("length", G4PIPE::flange_length / 2);
0319   cyl->set_string_param("material", "G4_Al");
0320   cyl->set_double_param("thickness", G4PIPE::flange_thickness);
0321   cyl->SuperDetector("PIPE");
0322   if (AbsorberActive)
0323   {
0324     cyl->SetActive();
0325   }
0326   cyl->OverlapCheck(OverlapCheck);
0327   g4Reco->registerSubsystem(cyl);
0328 
0329   // south aluminum pipe
0330   double south_pipe_place_z = G4PIPE::be_pipe_zshift - 0.5 * G4PIPE::be_pipe_length - 0.5 * G4PIPE::al_pipe_south_length;
0331   cyl = new PHG4CylinderSubsystem("VAC_S_AL_PIPE", ilayer++);
0332   cyl->set_double_param("place_x", G4PIPE::pipe_xshift);
0333   cyl->set_double_param("place_y", G4PIPE::pipe_yshift);
0334   cyl->set_double_param("place_z", south_pipe_place_z);
0335   cyl->set_double_param("radius", 0.0);
0336   cyl->set_int_param("lengthviarapidity", 0);
0337   cyl->set_double_param("length", G4PIPE::al_pipe_south_length);
0338   cyl->set_string_param("material", "G4_Galactic");
0339   cyl->set_double_param("thickness", G4PIPE::al_pipe_radius);
0340   cyl->SuperDetector("PIPE");
0341   if (AbsorberActive)
0342   {
0343     cyl->SetActive();
0344   }
0345   cyl->OverlapCheck(OverlapCheck);
0346   g4Reco->registerSubsystem(cyl);
0347 
0348   cyl = new PHG4CylinderSubsystem("S_AL_PIPE", ilayer++);
0349   cyl->set_double_param("place_x", G4PIPE::pipe_xshift);
0350   cyl->set_double_param("place_y", G4PIPE::pipe_yshift);
0351   cyl->set_double_param("place_z", south_pipe_place_z);
0352   cyl->set_double_param("radius", G4PIPE::al_pipe_radius);
0353   cyl->set_int_param("lengthviarapidity", 0);
0354   cyl->set_double_param("length", G4PIPE::al_pipe_south_length);
0355   cyl->set_string_param("material", "G4_Al");
0356   cyl->set_double_param("thickness", G4PIPE::al_pipe_thickness);
0357   cyl->SuperDetector("PIPE");
0358   if (AbsorberActive)
0359   {
0360     cyl->SetActive();
0361   }
0362   cyl->OverlapCheck(OverlapCheck);
0363   g4Reco->registerSubsystem(cyl);
0364 
0365   // south flange 1A
0366   flange_place_z = G4PIPE::be_pipe_zshift - 0.5 * G4PIPE::be_pipe_length - G4PIPE::al_pipe_south_length;
0367   // Al half, towards IP
0368   cyl = new PHG4CylinderSubsystem("S_FLANGE_1A_Al", ilayer++);
0369   cyl->set_double_param("place_x", G4PIPE::pipe_xshift);
0370   cyl->set_double_param("place_y", G4PIPE::pipe_yshift);
0371   cyl->set_double_param("place_z", flange_place_z + 0.75 * G4PIPE::flange_length);
0372   cyl->set_double_param("radius", G4PIPE::al_pipe_radius + G4PIPE::al_pipe_thickness);
0373   cyl->set_int_param("lengthviarapidity", 0);
0374   cyl->set_double_param("length", G4PIPE::flange_length / 2);
0375   cyl->set_string_param("material", "G4_Al");
0376   cyl->set_double_param("thickness", G4PIPE::flange_thickness);
0377   cyl->SuperDetector("PIPE");
0378   if (AbsorberActive)
0379   {
0380     cyl->SetActive();
0381   }
0382   cyl->OverlapCheck(OverlapCheck);
0383   g4Reco->registerSubsystem(cyl);
0384 
0385   // SS half, away from IP
0386   cyl = new PHG4CylinderSubsystem("S_FLANGE_1A_SS", ilayer++);
0387   cyl->set_double_param("place_x", G4PIPE::pipe_xshift);
0388   cyl->set_double_param("place_y", G4PIPE::pipe_yshift);
0389   cyl->set_double_param("place_z", flange_place_z + 0.25 * G4PIPE::flange_length);
0390   cyl->set_double_param("radius", G4PIPE::al_pipe_radius + G4PIPE::al_pipe_thickness);
0391   cyl->set_int_param("lengthviarapidity", 0);
0392   cyl->set_double_param("length", G4PIPE::flange_length / 2);
0393   cyl->set_string_param("material", "G4_STAINLESS-STEEL");
0394   cyl->set_double_param("thickness", G4PIPE::flange_thickness);
0395   cyl->SuperDetector("PIPE");
0396   if (AbsorberActive)
0397   {
0398     cyl->SetActive();
0399   }
0400   cyl->OverlapCheck(OverlapCheck);
0401   g4Reco->registerSubsystem(cyl);
0402 
0403   // south flange 1B
0404   // SS half, towards IP
0405   cyl = new PHG4CylinderSubsystem("S_FLANGE_1B_SS", ilayer++);
0406   cyl->set_double_param("place_x", G4PIPE::pipe_xshift);
0407   cyl->set_double_param("place_y", G4PIPE::pipe_yshift);
0408   cyl->set_double_param("place_z", flange_place_z - 0.25 * G4PIPE::flange_length);
0409   cyl->set_double_param("radius", G4PIPE::al_pipe_radius + G4PIPE::al_pipe_thickness);
0410   cyl->set_int_param("lengthviarapidity", 0);
0411   cyl->set_double_param("length", G4PIPE::flange_length / 2);
0412   cyl->set_string_param("material", "G4_STAINLESS-STEEL");
0413   cyl->set_double_param("thickness", G4PIPE::flange_thickness);
0414   cyl->SuperDetector("PIPE");
0415   if (AbsorberActive)
0416   {
0417     cyl->SetActive();
0418   }
0419   cyl->OverlapCheck(OverlapCheck);
0420   g4Reco->registerSubsystem(cyl);
0421 
0422   // Al half, away from IP
0423   cyl = new PHG4CylinderSubsystem("S_FLANGE_1B_AL", ilayer++);
0424   cyl->set_double_param("place_x", G4PIPE::pipe_xshift);
0425   cyl->set_double_param("place_y", G4PIPE::pipe_yshift);
0426   cyl->set_double_param("place_z", flange_place_z - 0.75 * G4PIPE::flange_length);
0427   cyl->set_double_param("radius", G4PIPE::al_pipe_radius + G4PIPE::al_pipe_thickness);
0428   cyl->set_int_param("lengthviarapidity", 0);
0429   cyl->set_double_param("length", G4PIPE::flange_length / 2);
0430   cyl->set_string_param("material", "G4_Al");
0431   cyl->set_double_param("thickness", G4PIPE::flange_thickness);
0432   cyl->SuperDetector("PIPE");
0433   if (AbsorberActive)
0434   {
0435     cyl->SetActive();
0436   }
0437   cyl->OverlapCheck(OverlapCheck);
0438   g4Reco->registerSubsystem(cyl);
0439 
0440   /* north outermost pipe (extension) [vacuum] */
0441   north_pipe_place_z += 0.5 * (G4PIPE::al_pipe_north_length + G4PIPE::al_pipe_north_ext_length) + 0.5 * G4PIPE::outer_pipe_precone_length;
0442   cyl = new PHG4CylinderSubsystem("VAC_N_OUTER_PIPE_PRECONE", ilayer++);
0443   cyl->set_double_param("place_x", G4PIPE::pipe_xshift);
0444   cyl->set_double_param("place_y", G4PIPE::pipe_yshift);
0445   cyl->set_double_param("place_z", north_pipe_place_z);
0446   cyl->set_double_param("radius", 0.);
0447   cyl->set_int_param("lengthviarapidity", 0);
0448   cyl->set_double_param("length", G4PIPE::outer_pipe_precone_length);
0449   cyl->set_string_param("material", "G4_Galactic");
0450   cyl->set_double_param("thickness", G4PIPE::outer_pipe_precone_radius);
0451   cyl->SuperDetector("PIPE");
0452   if (AbsorberActive)
0453   {
0454     cyl->SetActive();
0455   }
0456   cyl->OverlapCheck(OverlapCheck);
0457   g4Reco->registerSubsystem(cyl);
0458 
0459   /* north outermost pipe (pre-conical part) */
0460   cyl = new PHG4CylinderSubsystem("N_OUTER_PIPE_PRECONE", ilayer++);
0461   cyl->set_double_param("place_x", G4PIPE::pipe_xshift);
0462   cyl->set_double_param("place_y", G4PIPE::pipe_yshift);
0463   cyl->set_double_param("place_z", north_pipe_place_z);
0464   cyl->set_double_param("radius", G4PIPE::outer_pipe_precone_radius);
0465   cyl->set_int_param("lengthviarapidity", 0);
0466   cyl->set_double_param("length", G4PIPE::outer_pipe_precone_length);
0467   cyl->set_string_param("material", "G4_Al");
0468   cyl->set_double_param("thickness", G4PIPE::outer_pipe_thickness);
0469   cyl->SuperDetector("PIPE");
0470   if (AbsorberActive)
0471   {
0472     cyl->SetActive();
0473   }
0474   cyl->OverlapCheck(OverlapCheck);
0475   g4Reco->registerSubsystem(cyl);
0476 
0477   PHG4ConeSubsystem* cone = nullptr;
0478 
0479   /* north outermost pipe (conical part) [vacuum] */
0480   north_pipe_place_z += 0.5 * G4PIPE::outer_pipe_precone_length + 0.5 * G4PIPE::outer_pipe_cone_length;
0481   cone = new PHG4ConeSubsystem("VAC_N_OUTER_PIPE_CONE", ilayer++);
0482   cone->SetR1(0., G4PIPE::outer_pipe_precone_radius);
0483   cone->SetR2(0., G4PIPE::outer_pipe_ext_radius);
0484   cone->SetZlength(G4PIPE::outer_pipe_cone_length / 2);
0485   cone->SetPlace(G4PIPE::pipe_xshift, G4PIPE::pipe_yshift, north_pipe_place_z);
0486   cone->SetMaterial("G4_Galactic");
0487   cone->SuperDetector("PIPE");
0488   if (AbsorberActive)
0489   {
0490     cone->SetActive();
0491   }
0492   cone->OverlapCheck(OverlapCheck);
0493   g4Reco->registerSubsystem(cone);
0494 
0495   /* north outermost pipe (conical part) */
0496   cone = new PHG4ConeSubsystem("N_OUTER_PIPE_CONE", ilayer++);
0497   cone->SetR1(G4PIPE::outer_pipe_precone_radius, G4PIPE::outer_pipe_precone_radius + G4PIPE::outer_pipe_thickness);
0498   cone->SetR2(G4PIPE::outer_pipe_ext_radius, G4PIPE::outer_pipe_ext_radius + G4PIPE::outer_pipe_thickness);
0499   cone->SetZlength(G4PIPE::outer_pipe_cone_length / 2);
0500   cone->SetPlace(G4PIPE::pipe_xshift, G4PIPE::pipe_yshift, north_pipe_place_z);
0501   cone->SetMaterial("G4_Al");
0502   cone->SuperDetector("PIPE");
0503   if (AbsorberActive)
0504   {
0505     cone->SetActive();
0506   }
0507   cone->OverlapCheck(OverlapCheck);
0508   g4Reco->registerSubsystem(cone);
0509 
0510   /* north outermost pipe (extension) [vacuum] */
0511   north_pipe_place_z += 0.5 * G4PIPE::outer_pipe_cone_length + 0.5 * G4PIPE::outer_pipe_ext_length;
0512   cyl = new PHG4CylinderSubsystem("VAC_N_OUTER_PIPE_EXT", ilayer++);
0513   cyl->set_double_param("place_x", G4PIPE::pipe_xshift);
0514   cyl->set_double_param("place_y", G4PIPE::pipe_yshift);
0515   cyl->set_double_param("place_z", north_pipe_place_z);
0516   cyl->set_double_param("radius", 0.);
0517   cyl->set_int_param("lengthviarapidity", 0);
0518   cyl->set_double_param("length", G4PIPE::outer_pipe_ext_length);
0519   cyl->set_string_param("material", "G4_Galactic");
0520   cyl->set_double_param("thickness", G4PIPE::outer_pipe_ext_radius);
0521   cyl->SuperDetector("PIPE");
0522   if (AbsorberActive)
0523   {
0524     cyl->SetActive();
0525   }
0526   cyl->OverlapCheck(OverlapCheck);
0527   g4Reco->registerSubsystem(cyl);
0528 
0529   /* north outermost pipe (extension) */
0530   cyl = new PHG4CylinderSubsystem("N_OUTER_PIPE_EXT", ilayer++);
0531   cyl->set_double_param("place_x", G4PIPE::pipe_xshift);
0532   cyl->set_double_param("place_y", G4PIPE::pipe_yshift);
0533   cyl->set_double_param("place_z", north_pipe_place_z);
0534   cyl->set_double_param("radius", G4PIPE::outer_pipe_ext_radius);
0535   cyl->set_int_param("lengthviarapidity", 0);
0536   cyl->set_double_param("length", G4PIPE::outer_pipe_ext_length);
0537   cyl->set_string_param("material", "G4_Al");
0538   cyl->set_double_param("thickness", G4PIPE::outer_pipe_thickness);
0539   cyl->SuperDetector("PIPE");
0540   if (AbsorberActive)
0541   {
0542     cyl->SetActive();
0543   }
0544   cyl->OverlapCheck(OverlapCheck);
0545   g4Reco->registerSubsystem(cyl);
0546 
0547   /* south outermost pipe (pre-conical part) [vacuum] */
0548   south_pipe_place_z -= (0.5 * G4PIPE::al_pipe_south_length + 0.5 * G4PIPE::outer_pipe_precone_length);
0549   cyl = new PHG4CylinderSubsystem("VAC_S_OUTER_PIPE_PRECONE", ilayer++);
0550   cyl->set_double_param("place_x", G4PIPE::pipe_xshift);
0551   cyl->set_double_param("place_y", G4PIPE::pipe_yshift);
0552   cyl->set_double_param("place_z", south_pipe_place_z - no_overlapp);
0553   cyl->set_double_param("radius", 0.);
0554   cyl->set_int_param("lengthviarapidity", 0);
0555   cyl->set_double_param("length", G4PIPE::outer_pipe_precone_length);
0556   cyl->set_string_param("material", "G4_Galactic");
0557   cyl->set_double_param("thickness", G4PIPE::outer_pipe_precone_radius);
0558   cyl->SuperDetector("PIPE");
0559   if (AbsorberActive)
0560   {
0561     cyl->SetActive();
0562   }
0563   cyl->OverlapCheck(OverlapCheck);
0564   g4Reco->registerSubsystem(cyl);
0565 
0566   /* south outermost pipe (pre-conical part) */
0567   cyl = new PHG4CylinderSubsystem("S_OUTER_PIPE_PRECONE", ilayer++);
0568   cyl->set_double_param("place_x", G4PIPE::pipe_xshift);
0569   cyl->set_double_param("place_y", G4PIPE::pipe_yshift);
0570   cyl->set_double_param("place_z", south_pipe_place_z - no_overlapp);
0571   cyl->set_double_param("radius", G4PIPE::outer_pipe_precone_radius);
0572   cyl->set_int_param("lengthviarapidity", 0);
0573   cyl->set_double_param("length", G4PIPE::outer_pipe_precone_length);
0574   cyl->set_string_param("material", "G4_Al");
0575   cyl->set_double_param("thickness", G4PIPE::outer_pipe_thickness);
0576   cyl->SuperDetector("PIPE");
0577   if (AbsorberActive)
0578   {
0579     cyl->SetActive();
0580   }
0581   cyl->OverlapCheck(OverlapCheck);
0582   g4Reco->registerSubsystem(cyl);
0583 
0584   /* south outermost pipe (conical part) [vacuum] */
0585   south_pipe_place_z -= (0.5 * G4PIPE::outer_pipe_precone_length + 0.5 * G4PIPE::outer_pipe_cone_length);
0586   cone = new PHG4ConeSubsystem("VAC_S_AL_PIPE_CONE", ilayer++);
0587   cone->SetR1(0., G4PIPE::outer_pipe_ext_radius);
0588   cone->SetR2(0., G4PIPE::outer_pipe_precone_radius);
0589   cone->SetZlength(G4PIPE::outer_pipe_cone_length / 2);
0590   cone->SetPlace(G4PIPE::pipe_xshift, G4PIPE::pipe_yshift, south_pipe_place_z - no_overlapp);
0591   cone->SetMaterial("G4_Galactic");
0592   cone->SuperDetector("PIPE");
0593   if (AbsorberActive)
0594   {
0595     cone->SetActive();
0596   }
0597   cone->OverlapCheck(OverlapCheck);
0598   g4Reco->registerSubsystem(cone);
0599 
0600   /* south outermost pipe (conical part) */
0601   cone = new PHG4ConeSubsystem("S_OUTER_PIPE_CONE", ilayer++);
0602   cone->SetR1(G4PIPE::outer_pipe_ext_radius, G4PIPE::outer_pipe_ext_radius + G4PIPE::outer_pipe_thickness);
0603   cone->SetR2(G4PIPE::outer_pipe_precone_radius, G4PIPE::outer_pipe_precone_radius + G4PIPE::outer_pipe_thickness);
0604   cone->SetZlength(G4PIPE::outer_pipe_cone_length / 2);
0605   cone->SetPlace(G4PIPE::pipe_xshift, G4PIPE::pipe_yshift, south_pipe_place_z - no_overlapp);
0606   cone->SetMaterial("G4_Al");
0607   cone->SuperDetector("PIPE");
0608   if (AbsorberActive)
0609   {
0610     cone->SetActive();
0611   }
0612   cone->OverlapCheck(OverlapCheck);
0613   g4Reco->registerSubsystem(cone);
0614 
0615   /* south outermost pipe (extension) [vacuum] */
0616   south_pipe_place_z -= (0.5 * G4PIPE::outer_pipe_cone_length + 0.5 * G4PIPE::outer_pipe_ext_length);
0617   cyl = new PHG4CylinderSubsystem("VAC_S_OUTER_PIPE_EXT", ilayer++);
0618   cyl->set_double_param("place_x", G4PIPE::pipe_xshift);
0619   cyl->set_double_param("place_y", G4PIPE::pipe_yshift);
0620   cyl->set_double_param("place_z", south_pipe_place_z - no_overlapp);
0621   cyl->set_double_param("radius", 0.);
0622   cyl->set_int_param("lengthviarapidity", 0);
0623   cyl->set_double_param("length", G4PIPE::outer_pipe_ext_length);
0624   cyl->set_string_param("material", "G4_Galactic");
0625   cyl->set_double_param("thickness", G4PIPE::outer_pipe_ext_radius);
0626   cyl->SuperDetector("PIPE");
0627   if (AbsorberActive)
0628   {
0629     cyl->SetActive();
0630   }
0631   cyl->OverlapCheck(OverlapCheck);
0632   g4Reco->registerSubsystem(cyl);
0633 
0634   /* south outermost pipe (extension) */
0635   cyl = new PHG4CylinderSubsystem("S_OUTER_PIPE_EXT", ilayer++);
0636   cyl->set_double_param("place_x", G4PIPE::pipe_xshift);
0637   cyl->set_double_param("place_y", G4PIPE::pipe_yshift);
0638   cyl->set_double_param("place_z", south_pipe_place_z - no_overlapp);
0639   cyl->set_double_param("radius", G4PIPE::outer_pipe_ext_radius);
0640   cyl->set_int_param("lengthviarapidity", 0);
0641   cyl->set_double_param("length", G4PIPE::outer_pipe_ext_length);
0642   cyl->set_string_param("material", "G4_Al");
0643   cyl->set_double_param("thickness", G4PIPE::outer_pipe_thickness);
0644   cyl->SuperDetector("PIPE");
0645   if (AbsorberActive)
0646   {
0647     cyl->SetActive();
0648   }
0649   cyl->OverlapCheck(OverlapCheck);
0650   g4Reco->registerSubsystem(cyl);
0651 
0652   radius = G4PIPE::outer_pipe_ext_radius + G4PIPE::outer_pipe_thickness;
0653 
0654   if (verbosity > 0)
0655   {
0656     std::cout << "=========================== G4_Pipe.C::Pipe() =============================" << std::endl;
0657     std::cout << " PIPE Material Description:" << std::endl;
0658     std::cout << "  inner radius = " << G4PIPE::be_pipe_radius << " cm" << std::endl;
0659     std::cout << "  thickness = " << G4PIPE::be_pipe_thickness << " cm" << std::endl;
0660     std::cout << "  outer radius = " << G4PIPE::be_pipe_radius + G4PIPE::be_pipe_thickness << " cm" << std::endl;
0661     std::cout << "  length = " << G4PIPE::be_pipe_length << " cm" << std::endl;
0662     std::cout << "===========================================================================" << std::endl;
0663   }
0664 
0665   radius += no_overlapp;
0666 
0667   return radius;
0668 }
0669 #endif