EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4_DIRC.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4_DIRC.C
1 #ifndef MACRO_G4DIRC_C
2 #define MACRO_G4DIRC_C
3 
4 #include <GlobalVariables.C>
5 
9 
11 #include <g4main/PHG4Reco.h>
12 
13 #include <cmath>
14 
15 R__LOAD_LIBRARY(libg4eicdirc.so)
16 
17 
25 namespace Enable
26 {
27  bool DIRC = false;
28  bool DIRC_OVERLAPCHECK = false;
29 } // namespace Enable
30 
31 namespace G4DIRC
32 {
33 
34 
35  double z_prism = 30;
36  double z_start = -275+z_prism;
37  double z_end = 125;
38  double length = 0.;
39  double z_shift = 0.;
40  double outer_skin_radius = 89.25;
41  double dRad = 5.6;
42  double dInSkin = 7.54;
43  namespace SETTING
44  {
45  bool USECEMCGeo = true;
46  bool USEskinSupports = true;
47  bool NEWDIRC = true;
48  }
49 
50 } // namespace G4DIRC
51 
52 void DIRCInit()
53 {
56  G4DIRC::dRad = 8.;
57  G4DIRC::dInSkin = 9.;
59  G4DIRC::z_end = +168;
60  }
63 
67 }
68 
69 
70 
74 double DIRCSetup(PHG4Reco *g4Reco)
75 {
76  bool OverlapCheck = Enable::OVERLAPCHECK || Enable::DIRC_OVERLAPCHECK;
77 
79  // double z = 185;
80  // double dz = 40;
81 
82  G4EicDircSubsystem *dircSubsys = new G4EicDircSubsystem("hpDIRC");
83  dircSubsys->SuperDetector("hpDIRC");
84  //dircSubsys->set_double_param("place_z", z + dz * 0.5);// relative position to mother vol.
85  dircSubsys->OverlapCheck(OverlapCheck);
86  dircSubsys->Verbosity(0);
87  dircSubsys->SetActive();
88 
89  g4Reco->registerSubsystem(dircSubsys);
90  } else {
92 
93  PHG4SectorSubsystem *dirc;
94  dirc = new PHG4SectorSubsystem("DIRC");
97  dirc->get_geometry().set_min_polar_angle(atan2(radiator_R, G4DIRC::z_end));
98  dirc->get_geometry().set_max_polar_angle(atan2(radiator_R, G4DIRC::z_start));
101  dirc->get_geometry().set_material("Quartz");
102  dirc->get_geometry().set_N_Sector(12);
103  dirc->OverlapCheck(OverlapCheck);
104  dirc->get_geometry().AddLayer("Radiator", "Quartz", 1.7 * PHG4Sector::Sector_Geometry::Unit_cm(), true);
105  g4Reco->registerSubsystem(dirc);
106 
108 
109  // The cylinder skins provide most of the strength
110  // and stiffness of the CST. The thickness of the inner
111  // and outer skins is 1.27 and 0.76 mm, respectively
112 
114  // Inner skin:
115 
117  cyl = new PHG4CylinderSubsystem("DIRC_CST_Inner_Skin", 10);
118  cyl->set_double_param("radius", inner_R);
120  cyl->set_string_param("material", "G4_Al");
121  cyl->set_double_param("thickness", 0.127);
122  cyl->set_double_param("place_x", 0.);
123  cyl->set_double_param("place_y", 0.);
124  cyl->set_double_param("place_z", G4DIRC::z_shift - G4DIRC::z_prism * 0.5);
125  cyl->SetActive(0);
126  cyl->SuperDetector("DIRC");
127  cyl->OverlapCheck(OverlapCheck);
128 
129  g4Reco->registerSubsystem(cyl);
130 
131  // Outer skin:
132  cyl = new PHG4CylinderSubsystem("DIRC_CST_Outer_Skin", 11);
133  cyl->set_double_param("radius", G4DIRC::outer_skin_radius - 0.076);
134  cyl->set_double_param("length", G4DIRC::length);
135  cyl->set_string_param("material", "G4_Al");
136  cyl->set_double_param("thickness", 0.076);
137  cyl->set_double_param("place_x", 0.);
138  cyl->set_double_param("place_y", 0.);
139  cyl->set_double_param("place_z", G4DIRC::z_shift);
140  cyl->SetActive(0);
141  cyl->SuperDetector("DIRC");
142  cyl->OverlapCheck(OverlapCheck);
143 
144  g4Reco->registerSubsystem(cyl);
145  }
146  // simple approximation for DIRC prism
147  PHG4ConeSubsystem *cone = new PHG4ConeSubsystem("DIRC_Prism");
148  cone->set_color(0, 1, 0);
149  // cone->SetR1(radiator_R, radiator_R + 20);
150  // cone->SetR2(radiator_R, radiator_R + 2);
151 
152  cone->SetR1(radiator_R, radiator_R + 20);
153  cone->SetR2(radiator_R, radiator_R + 2);
154 
155  cone->SetZlength(0.5 * G4DIRC::z_prism);
157  cone->SetMaterial("Quartz");
158  cone->SetActive(0);
159  cone->SuperDetector("DIRC");
160  cone->OverlapCheck(OverlapCheck);
161  g4Reco->registerSubsystem(cone);
162  }
163  // Done
165 }
166 #endif