EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4Setup_LBLDetector.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4Setup_LBLDetector.C
1 #ifndef MACRO_G4SETUPLBLDETECTOR_C
2 #define MACRO_G4SETUPLBLDETECTOR_C
3 
4 #include <GlobalVariables.C>
5 
6 #include <G4_Aerogel.C>
7 #include <G4_AllSilicon.C>
8 #include <G4_Bbc.C>
9 #include <G4_BlackHole.C>
10 #include <G4_CEmc_EIC.C>
11 #include <G4_DIRC.C>
12 #include <G4_EEMC.C>
13 #include <G4_FEMC_EIC.C>
14 #include <G4_FHCAL.C>
15 #include <G4_HcalIn_ref.C>
16 #include <G4_HcalOut_ref.C>
17 #include <G4_Input.C>
18 #include <G4_Magnet.C>
19 #include <G4_Mvtx_EIC.C>
20 #include <G4_PlugDoor_EIC.C>
21 #include <G4_RICH.C>
22 #include <G4_Tracking_LBL.C>
23 #include <G4_User.C>
24 #include <G4_World.C>
25 
27 
29 
30 #include <g4main/PHG4Reco.h>
32 
33 #include <phfield/PHFieldConfig.h>
34 
35 #include <g4decayer/EDecayType.hh>
36 
38 #include <fun4all/Fun4AllServer.h>
39 
40 R__LOAD_LIBRARY(libg4decayer.so)
41 R__LOAD_LIBRARY(libg4detectors.so)
42 
43 void G4Init()
44 {
47  if (Enable::BBC) BbcInit();
48  if (Enable::CEMC) CEmcInit(72); // make it 2*2*2*3*3 so we can try other combinations
51  MagnetFieldInit(); // We want the field - even if the magnet volume is disabled
53  if (Enable::FEMC) FEMCInit();
54  if (Enable::FHCAL) FHCALInit();
55  if (Enable::EEMC) EEMCInit();
56  if (Enable::DIRC) DIRCInit();
57  if (Enable::RICH) RICHInit();
60  if (Enable::USER) UserInit();
62 }
63 
64 int G4Setup()
65 {
66  //---------------
67  // Fun4All server
68  //---------------
69 
71 
72  PHG4Reco *g4Reco = new PHG4Reco();
73 
74  WorldInit(g4Reco);
75 
76  g4Reco->set_rapidity_coverage(1.1); // according to drawings
77  // uncomment to set QGSP_BERT_HP physics list for productions
78  // (default is QGSP_BERT for speed)
79  // g4Reco->SetPhysicsList("QGSP_BERT_HP");
80 
82  {
84  }
85 
86  double fieldstrength;
87  istringstream stringline(G4MAGNET::magfield);
88  stringline >> fieldstrength;
89  if (stringline.fail())
90  { // conversion to double fails -> we have a string
91 
92  if (G4MAGNET::magfield.find("sphenix3dbigmapxyz") != string::npos)
93  {
95  }
96  else
97  {
99  }
100  }
101  else
102  {
103  g4Reco->set_field(fieldstrength); // use const soleniodal field
104  }
106 
107  double radius = 0.;
108 
109  if (Enable::ALLSILICON) AllSiliconSetup(g4Reco);
110  if (Enable::BBC) Bbc(g4Reco);
111  if (Enable::CEMC) radius = CEmc(g4Reco, radius);
112  if (Enable::HCALIN) radius = HCalInner(g4Reco, radius, 4);
113  if (Enable::MAGNET) radius = Magnet(g4Reco, radius);
114  if (Enable::HCALOUT) radius = HCalOuter(g4Reco, radius, 4);
115  if (Enable::FEMC) FEMCSetup(g4Reco);
116  if (Enable::FHCAL) FHCALSetup(g4Reco);
117  if (Enable::EEMC) EEMCSetup(g4Reco);
118 
119  //----------------------------------------
120  // PID
121 
122  if (Enable::DIRC) DIRCSetup(g4Reco);
123  if (Enable::RICH) RICHSetup(g4Reco);
124  if (Enable::AEROGEL) AerogelSetup(g4Reco);
125 
126  //----------------------------------------
127  // Babar-EIC forward flux return door
128  if (Enable::PLUGDOOR) PlugDoor(g4Reco);
129  if (Enable::USER) UserDetector(g4Reco);
130  //----------------------------------------
131  // BLACKHOLE if enabled, needs info from all previous sub detectors for dimensions
132  if (Enable::BLACKHOLE) BlackHole(g4Reco, radius);
133 
134  PHG4TruthSubsystem *truth = new PHG4TruthSubsystem();
135  g4Reco->registerSubsystem(truth);
136  // finally adjust the world size in case the default is too small
137  WorldSize(g4Reco, radius);
138 
139  se->registerSubsystem(g4Reco);
140  return 0;
141 }
142 
144 {
146 
147  PHG4DstCompressReco *compress = new PHG4DstCompressReco("PHG4DstCompressReco");
148  compress->AddHitContainer("G4HIT_PIPE");
149  compress->AddHitContainer("G4HIT_FIELDCAGE");
150  compress->AddHitContainer("G4HIT_CEMC_ELECTRONICS");
151  compress->AddHitContainer("G4HIT_CEMC");
152  compress->AddHitContainer("G4HIT_ABSORBER_CEMC");
153  compress->AddHitContainer("G4HIT_CEMC_SPT");
154  compress->AddHitContainer("G4HIT_ABSORBER_HCALIN");
155  compress->AddHitContainer("G4HIT_HCALIN");
156  compress->AddHitContainer("G4HIT_HCALIN_SPT");
157  compress->AddHitContainer("G4HIT_MAGNET");
158  compress->AddHitContainer("G4HIT_ABSORBER_HCALOUT");
159  compress->AddHitContainer("G4HIT_HCALOUT");
160  compress->AddHitContainer("G4HIT_BH_1");
161  compress->AddHitContainer("G4HIT_BH_FORWARD_PLUS");
162  compress->AddHitContainer("G4HIT_BH_FORWARD_NEG");
163  compress->AddCellContainer("G4CELL_CEMC");
164  compress->AddCellContainer("G4CELL_HCALIN");
165  compress->AddCellContainer("G4CELL_HCALOUT");
166  compress->AddTowerContainer("TOWER_SIM_CEMC");
167  compress->AddTowerContainer("TOWER_RAW_CEMC");
168  compress->AddTowerContainer("TOWER_CALIB_CEMC");
169  compress->AddTowerContainer("TOWER_SIM_HCALIN");
170  compress->AddTowerContainer("TOWER_RAW_HCALIN");
171  compress->AddTowerContainer("TOWER_CALIB_HCALIN");
172  compress->AddTowerContainer("TOWER_SIM_HCALOUT");
173  compress->AddTowerContainer("TOWER_RAW_HCALOUT");
174  compress->AddTowerContainer("TOWER_CALIB_HCALOUT");
175 
176  compress->AddHitContainer("G4HIT_FEMC");
177  compress->AddHitContainer("G4HIT_ABSORBER_FEMC");
178  compress->AddHitContainer("G4HIT_FHCAL");
179  compress->AddHitContainer("G4HIT_ABSORBER_FHCAL");
180  compress->AddCellContainer("G4CELL_FEMC");
181  compress->AddCellContainer("G4CELL_FHCAL");
182  compress->AddTowerContainer("TOWER_SIM_FEMC");
183  compress->AddTowerContainer("TOWER_RAW_FEMC");
184  compress->AddTowerContainer("TOWER_CALIB_FEMC");
185  compress->AddTowerContainer("TOWER_SIM_FHCAL");
186  compress->AddTowerContainer("TOWER_RAW_FHCAL");
187  compress->AddTowerContainer("TOWER_CALIB_FHCAL");
188 
189  compress->AddHitContainer("G4HIT_EEMC");
190  compress->AddHitContainer("G4HIT_ABSORBER_EEMC");
191  compress->AddCellContainer("G4CELL_EEMC");
192  compress->AddTowerContainer("TOWER_SIM_EEMC");
193  compress->AddTowerContainer("TOWER_RAW_EEMC");
194  compress->AddTowerContainer("TOWER_CALIB_EEMC");
195 
196  se->registerSubsystem(compress);
197 
198  return;
199 }
200 
202 {
203  if (out)
204  {
205  out->StripNode("G4HIT_PIPE");
206  out->StripNode("G4HIT_SVTXSUPPORT");
207  out->StripNode("G4HIT_CEMC_ELECTRONICS");
208  out->StripNode("G4HIT_CEMC");
209  out->StripNode("G4HIT_ABSORBER_CEMC");
210  out->StripNode("G4HIT_CEMC_SPT");
211  out->StripNode("G4HIT_ABSORBER_HCALIN");
212  out->StripNode("G4HIT_HCALIN");
213  out->StripNode("G4HIT_HCALIN_SPT");
214  out->StripNode("G4HIT_MAGNET");
215  out->StripNode("G4HIT_ABSORBER_HCALOUT");
216  out->StripNode("G4HIT_HCALOUT");
217  out->StripNode("G4HIT_BH_1");
218  out->StripNode("G4HIT_BH_FORWARD_PLUS");
219  out->StripNode("G4HIT_BH_FORWARD_NEG");
220  out->StripNode("G4CELL_CEMC");
221  out->StripNode("G4CELL_HCALIN");
222  out->StripNode("G4CELL_HCALOUT");
223 
224  out->StripNode("G4HIT_FEMC");
225  out->StripNode("G4HIT_ABSORBER_FEMC");
226  out->StripNode("G4HIT_FHCAL");
227  out->StripNode("G4HIT_ABSORBER_FHCAL");
228  out->StripNode("G4CELL_FEMC");
229  out->StripNode("G4CELL_FHCAL");
230 
231  out->StripNode("G4HIT_EEMC");
232  out->StripNode("G4HIT_ABSORBER_EEMC");
233  out->StripNode("G4CELL_EEMC");
234  }
235 }
236 #endif