EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4Setup_Beast.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4Setup_Beast.C
1 #ifndef MACRO_G4SETUPBEAST_C
2 #define MACRO_G4SETUPBEAST_C
3 
4 #include <GlobalVariables.C>
5 
6 #include <G4_BlackHole.C>
7 #include <G4_Magnet_Beast.C>
8 #include <G4_Pipe_EIC.C>
9 #include <G4_User.C>
10 #include <G4_World.C>
11 
12 #include <g4decayer/EDecayType.hh>
13 
14 #include <g4main/PHG4Reco.h>
16 
17 #include <phfield/PHFieldConfig.h>
18 
20 #include <fun4all/Fun4AllServer.h>
21 
22 R__LOAD_LIBRARY(libg4decayer.so)
23 
25 {
26  // load detector/material macros and execute Init() function
27 
28  if (Enable::PIPE) PipeInit();
30  MagnetFieldInit(); // We want the field - even if the magnet volume is disabled
31 }
32 
33 void G4Setup()
34 {
35  //---------------
36  // Fun4All server
37  //---------------
38 
40 
41  PHG4Reco *g4Reco = new PHG4Reco();
42 
43  WorldInit(g4Reco);
44 
45  // global coverage used for length of cylinders if lengthviarapidity is set
46  // probably needs to be adjusted for JLeic
47  g4Reco->set_rapidity_coverage(1.1);
48 
50  {
52  }
53 
54  double fieldstrength;
55  istringstream stringline(G4MAGNET::magfield);
56  stringline >> fieldstrength;
57  if (stringline.fail())
58  { // conversion to double fails -> we have a string
60  }
61  else
62  {
63  g4Reco->set_field(fieldstrength); // use const soleniodal field
64  }
66 
67  double radius = 0.;
68 
69  if (Enable::PIPE) radius = Pipe(g4Reco, radius);
70  if (Enable::MAGNET) radius = Magnet(g4Reco, radius);
71  if (Enable::USER) UserDetector(g4Reco);
72 
73  //----------------------------------------
74  // BLACKHOLE needs to be last
75 
76  if (Enable::BLACKHOLE) BlackHole(g4Reco, radius);
77 
79  g4Reco->registerSubsystem(truth);
80  // finally adjust the world size in case the default is too small
81  WorldSize(g4Reco, radius);
82 
83  se->registerSubsystem(g4Reco);
84  return;
85 }
86 
88 {
89  if (out)
90  {
91  out->StripNode("G4HIT_PIPE");
92  }
93 }
94 
95 #endif // MACRO_G4SETUPBEAST_C