EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4Setup_JLeic.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4Setup_JLeic.C
1 #ifndef MACRO_G4SETUPJLEIC_C
2 #define MACRO_G4SETUPJLEIC_C
3 
4 #include <GlobalVariables.C>
5 
6 #include <G4_Barrel_Hcal_JLeic.C>
7 #include <G4_BeamLine_JLeic.C>
8 #include <G4_BlackHole.C>
9 #include <G4_CTD_JLeic.C>
10 #include <G4_DIRC_JLeic.C>
11 #include <G4_DRich_JLeic.C>
13 #include <G4_EndCap_Hadron_JLeic.C>
14 #include <G4_Gem_JLeic.C>
15 #include <G4_Magnet_Cleo.C>
16 #include <G4_Pipe_EIC.C>
17 #include <G4_User.C>
18 #include <G4_VTX_JLeic.C>
19 #include <G4_World.C>
20 
21 #include <g4decayer/EDecayType.hh>
22 
23 #include <g4main/PHG4Reco.h>
25 
26 #include <phfield/PHFieldConfig.h>
27 
29 #include <fun4all/Fun4AllServer.h>
30 
31 R__LOAD_LIBRARY(libg4decayer.so)
32 
34 {
35  // load detector/material macros and execute Init() function
36 
37  if (Enable::PIPE) PipeInit();
38  if (Enable::VTX) VTXInit();
39  if (Enable::CTD) CTDInit();
41  MagnetFieldInit(); // We want the field - even if the magnet volume is disabled
42  if (Enable::GEM) GemInit();
43  if (Enable::DIRC) JLDIRCInit();
45  if (Enable::DRICH) DRichInit();
49 }
50 
51 void G4Setup()
52 {
53  //---------------
54  // Fun4All server
55  //---------------
56 
58 
59  PHG4Reco *g4Reco = new PHG4Reco();
60 
61  WorldInit(g4Reco);
62 
63  // global coverage used for length of cylinders if lengthviarapidity is set
64  // probably needs to be adjusted for JLeic
65  g4Reco->set_rapidity_coverage(1.1);
66 
68  {
70  }
71 
72  double fieldstrength;
73  istringstream stringline(G4MAGNET::magfield);
74  stringline >> fieldstrength;
75  if (stringline.fail())
76  { // conversion to double fails -> we have a string
77 
79  }
80  else
81  {
82  g4Reco->set_field(fieldstrength); // use const soleniodal field
83  }
85 
86  double radius = 0.;
87 
88  if (Enable::PIPE) radius = Pipe(g4Reco, radius);
89  if (Enable::VTX) radius = VTX(g4Reco, radius);
90  if (Enable::CTD) radius = CTD(g4Reco, radius);
91  if (Enable::DIRC) radius = JLDIRC(g4Reco, radius);
92  if (Enable::MAGNET) radius = Magnet(g4Reco, radius);
93  if (Enable::BARREL_HCAL) radius = Barrel_Hcal(g4Reco, radius);
94  if (Enable::GEM) Gem(g4Reco);
95  if (Enable::DRICH) DRich(g4Reco);
98  if (Enable::BEAMLINE) BeamLine(g4Reco);
99  if (Enable::USER) UserDetector(g4Reco);
100 
101  //----------------------------------------
102  // BLACKHOLE needs to be last
103 
104  if (Enable::BLACKHOLE) BlackHole(g4Reco, radius);
105 
106  PHG4TruthSubsystem *truth = new PHG4TruthSubsystem();
107  g4Reco->registerSubsystem(truth);
108  // finally adjust the world size in case the default is too small
109  WorldSize(g4Reco, radius);
110 
111  se->registerSubsystem(g4Reco);
112  return;
113 }
114 
116 {
117  if (out)
118  {
119  out->StripNode("G4HIT_PIPE");
120  }
121 }
122 
123 #endif // MACRO_G4SETUPJLEIC_C