ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4_Disk.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4_Disk.C
1 #ifndef MACRO_G4_Disk_C
2 #define MACRO_G4_Disk_C
3 
4 #include <GlobalVariables.C>
5 
7 #include <g4main/PHG4Reco.h>
8 
10 
11 #include <Geant4/G4SystemOfUnits.hh>
12 #include <Geant4/G4Material.hh>
13 
14 #include <algorithm>
15 #include <cmath>
16 #include <vector>
17 
18 using namespace std;
19 
20 namespace mySim
21 {
22  double dRICH_width = 80;
23  pair<double, double> dRICH_eta_coverage = {1, 4};
24  double dRICH_z = 240;
25  int nLayers = 100;
26 }
27 
28 using namespace mySim;
29 
30 double etaToR(double eta, double z)
31 {
32  double radius = 2*z*atan(exp(-1*eta));
33  return radius;
34 }
35 
36 void DiskInit()
37 {
41 }
42 
43 double Disk(PHG4Reco *g4Reco, double max_radius)
44 {
45  PHG4CylinderSubsystem *cyl = nullptr;
46 
47  double diskWidth = dRICH_width/nLayers;
48  pair<double, double> dRICH_r_coverage(etaToR(dRICH_eta_coverage.second, dRICH_z + 0.5*dRICH_width),
50 
51  for (int i = 0; i < nLayers; ++i)
52  {
53  double z_position = dRICH_z - 0.5*dRICH_width + (i+0.5)*diskWidth;
54 
55  if (Enable::VERBOSITY > 2)
56  {
57  std::cout << "Layer " << i << std::endl;
58  std::cout << "Disk width: = " << diskWidth << std::endl;
59  std::cout << "IR = " << dRICH_r_coverage.first << ", OR = " << dRICH_r_coverage.second << std::endl;
60  std::cout << "Z position = " << z_position << std::endl;
61  }
62 
63  cyl = new PHG4CylinderSubsystem("disk", i);
64  cyl->Verbosity(0);
65  cyl->set_double_param("place_z", z_position);
66  cyl->set_double_param("radius", dRICH_r_coverage.first);
67  cyl->set_double_param("length", 0.5*diskWidth);
68  cyl->set_string_param("material", "G4_AIR");
69  cyl->set_color(0.4, 0.4, 0.4, 0.4);
70  cyl->set_double_param("thickness", (dRICH_r_coverage.second - dRICH_r_coverage.first));
71  cyl->SuperDetector("MySuperDetector");
72  cyl->OverlapCheck(false);
73  cyl->SetActive();
74  g4Reco->registerSubsystem(cyl);
75  }
76 
77  return dRICH_r_coverage.first;
78 }
79 
80 #endif