EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4_Magnet_Cleo.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4_Magnet_Cleo.C
1 #ifndef MACRO_G4MAGNETJLEIC_C
2 #define MACRO_G4MAGNETJLEIC_C
3 
4 #include "GlobalVariables.C"
5 
7 
8 #include <g4main/PHG4Reco.h>
9 
10 R__LOAD_LIBRARY(libg4detectors.so)
11 
12 namespace Enable
13 {
14  bool MAGNET = false;
15  bool MAGNET_ABSORBER = false;
16  bool MAGNET_OVERLAPCHECK = false;
17  int MAGNET_VERBOSITY = 0;
18 } // namespace Enable
19 
20 namespace G4MAGNET
21 {
22  double magnet_inner_radius = 130.;
23  double magnet_outer_radius = 143.;
24  double magnet_length = 400.;
25  double magfield_rescale = 1;
26  string magfield = string(getenv("CALIBRATIONROOT")) + string("/Field/Map/SolenoidMag3D.TABLE");
27 
28 } // namespace G4MAGNET
29 
30 void MagnetInit()
31 {
35 }
36 
37 double Magnet(PHG4Reco* g4Reco,
38  double radius)
39 {
40  bool AbsorberActive = Enable::ABSORBER || Enable::MAGNET_ABSORBER;
43 
44  if (radius > G4MAGNET::magnet_inner_radius)
45  {
46  cout << "inconsistency: radius: " << radius
47  << " larger than Magnet inner radius: " << G4MAGNET::magnet_inner_radius << endl;
48  gSystem->Exit(-1);
49  }
50 
51 // right now Cleo is a massive Al cylinder which is likely not correct
52 // need to know the radiation length and adjust the material for that
53 // or get an idea about the actual cleo magnet design
55  PHG4CylinderSubsystem* cyl = new PHG4CylinderSubsystem("MAGNET", 0);
59  cyl->set_string_param("material", "Al5083");
60  cyl->SuperDetector("MAGNET");
61  if (AbsorberActive) cyl->SetActive();
62  g4Reco->registerSubsystem(cyl);
63 
64  radius = G4MAGNET::magnet_outer_radius; // outside of magnet
65 
66  if (verbosity > 0)
67  {
68  cout << "========================= G4_Magnet.C::Magnet() ===========================" << endl;
69  cout << " MAGNET Material Description:" << endl;
70  cout << " inner radius = " << G4MAGNET::magnet_inner_radius << " cm" << endl;
71  cout << " outer radius = " << G4MAGNET::magnet_outer_radius << " cm" << endl;
72  cout << " length = " << G4MAGNET::magnet_length << " cm" << endl;
73  cout << "===========================================================================" << endl;
74  }
75 
76  radius += no_overlapp;
77 
78  return radius;
79 }
80 
81 #endif // MACRO_G4MAGNETJLEIC_C