ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4Setup.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4Setup.C
1 #ifndef MACRO_G4SETUP_C
2 #define MACRO_G4SETUP_C
3 
4 #include <GlobalVariables.C>
5 
6 #include <G4_BlackHole.C>
7 #include <G4_Magnet.C>
8 #include "G4_Disk.C"
9 #include <G4_World.C>
10 #include <G4_Pipe.C>
11 
12 #include <g4main/PHG4Reco.h>
14 
15 #include <phfield/PHFieldConfig.h>
16 
17 #include <g4decayer/EDecayType.hh>
18 
19 #include <fun4all/Fun4AllServer.h>
20 
21 R__LOAD_LIBRARY(libg4detectors.so)
22 
23 using namespace mySim;
24 
25 void G4Init()
26 {
27  DiskInit();
29  BlackHoleInit();
30 }
31 
32 int G4Setup()
33 {
34  //---------------
35  // Fun4All server
36  //---------------
38 
39  PHG4Reco *g4Reco = new PHG4Reco();
41 
42  WorldInit(g4Reco);
43 
44  double fieldstrength;
45  istringstream stringline(G4MAGNET::magfield);
46  stringline >> fieldstrength;
47  if (stringline.fail())
48  { // conversion to double fails -> we have a string
49  if (G4MAGNET::magfield.find("sphenix3dbigmapxyz") != string::npos ||
50  G4MAGNET::magfield == "CDB")
51  {
53  }
54  else
55  {
57  }
58  }
59  else
60  {
61  g4Reco->set_field(fieldstrength); // use const soleniodal field
62  }
64 
65  double radius = 0.;
66 
67  Disk(g4Reco, radius);
68  BlackHole(g4Reco, radius);
69 
71  g4Reco->registerSubsystem(truth);
72  // finally adjust the world size in case the default is too small
73  WorldSize(g4Reco, radius);
74 
75  se->registerSubsystem(g4Reco);
76  return 0;
77 }
78 
79 #endif