EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4_Magnet_Beast.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4_Magnet_Beast.C
1 #ifndef MACRO_G4MAGNETBEAST_C
2 #define MACRO_G4MAGNETBEAST_C
3 
4 #include <GlobalVariables.C>
5 
6 #include <eicdetectors/BeastMagnetSubsystem.h>
7 
8 #include <g4main/PHG4Reco.h>
9 
10 R__LOAD_LIBRARY(libeicdetectors.so)
11 
12 namespace Enable
13 {
14  bool MAGNET = false;
15  bool MAGNET_ABSORBER = false;
16 } // namespace Enable
17 
18 namespace G4MAGNET
19 {
20  double magnet_outer_radius = 300.;
21  double magnet_inner_radius = 135.;
22  double magnet_length = 500.;
23 } // namespace G4MAGNET
24 
26 {
27  if (!isfinite(G4MAGNET::magfield_rescale))
28  {
30  }
31  if (G4MAGNET::magfield.empty())
32  {
33  G4MAGNET::magfield = string(getenv("CALIBRATIONROOT")) + string("/Field/Map/mfield.4col.dat");
34  }
35 }
36 
37 void MagnetInit()
38 {
43 }
44 
45 double Magnet(PHG4Reco* g4Reco, double radius)
46 
47 {
48  bool AbsorberActive = Enable::ABSORBER || Enable::MAGNET_ABSORBER;
49 
50  if (radius > G4MAGNET::magnet_inner_radius)
51  {
52  cout << "previous outer radius " << radius << " larger then magnet inner radius " << G4MAGNET::magnet_inner_radius << endl;
53  gSystem->Exit(1);
54  }
56  beast->set_string_param("GDMPath", (string(getenv("CALIBRATIONROOT")) + string("/Magnet/BeastSolenoid.gdml")));
57  beast->set_string_param("TopVolName", "SOLENOID");
58  beast->SetActive(AbsorberActive);
59  beast->SuperDetector("MAGNET");
60  g4Reco->registerSubsystem(beast);
62 }
63 
64 #endif // MACRO_G4MAGNETBEAST_C