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