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();
29 
30  //----------------------------------------
31  // MAGNET
32 
34 }
35 
36 void G4Setup()
37 {
38  //---------------
39  // Fun4All server
40  //---------------
41 
43 
44  PHG4Reco *g4Reco = new PHG4Reco();
45 
46  WorldInit(g4Reco);
47 
48  // global coverage used for length of cylinders if lengthviarapidity is set
49  // probably needs to be adjusted for JLeic
50  g4Reco->set_rapidity_coverage(1.1);
51 
53  {
55  }
56 
57  double fieldstrength;
58  istringstream stringline(G4MAGNET::magfield);
59  stringline >> fieldstrength;
60  if (stringline.fail())
61  { // conversion to double fails -> we have a string
63  }
64  else
65  {
66  g4Reco->set_field(fieldstrength); // use const soleniodal field
67  }
69 
70  double radius = 0.;
71 
72  //----------------------------------------
73  // PIPE
74  if (Enable::PIPE) radius = Pipe(g4Reco, radius);
75 
76  //----------------------------------------
77  // MAGNET
78 
79  if (Enable::MAGNET) radius = Magnet(g4Reco, radius);
80 
81  if (Enable::USER) UserDetector(g4Reco);
82 
83  //----------------------------------------
84  // BLACKHOLE
85 
86  if (Enable::BLACKHOLE) BlackHole(g4Reco, radius);
87 
89  g4Reco->registerSubsystem(truth);
90  // finally adjust the world size in case the default is too small
91  WorldSize(g4Reco, radius);
92 
93  se->registerSubsystem(g4Reco);
94  return;
95 }
96 
98 {
99  if (out)
100  {
101  out->StripNode("G4HIT_PIPE");
102  }
103 }
104 
105 #endif // MACRO_G4SETUPBEAST_C