EIC Software
Reference for
EIC
simulation and reconstruction software on GitHub
Home page
Related Pages
Modules
Namespaces
Classes
Files
External Links
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
G4Setup_ModularDetector.C
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file G4Setup_ModularDetector.C
1
#ifndef MACRO_G4SETUPMODULARDETECTOR_C
2
#define MACRO_G4SETUPMODULARDETECTOR_C
3
4
#include <GlobalVariables.C>
5
6
#include <
G4_hFarFwdBeamLine_EIC.C
>
7
#include <
G4_Pipe_EIC_simple.C
>
8
9
#include <
G4_Aerogel.C
>
10
#include <
G4_Barrel_EIC.C
>
11
#include <
G4_AllSilicon.C
>
12
#include <
G4_FST_EIC.C
>
13
#include <
G4_TTL_EIC.C
>
14
#include <
G4_GEM_EIC.C
>
15
#include <G4_Bbc.C>
16
#include <G4_CEmc_EIC.C>
17
#include <G4_DIRC.C>
18
#include <
G4_DRCALO.C
>
19
#include <G4_EEMC.C>
20
#include <
G4_EEMC_hybrid.C
>
21
#include <G4_FEMC_EIC.C>
22
#include <G4_FHCAL.C>
23
#include <
G4_LFHCAL.C
>
24
#include <
G4_EHCAL.C
>
25
#include <
G4_HCalIn_EIC.C
>
26
#include <G4_HcalOut_ref.C>
27
#include <
G4_Mvtx_EIC.C
>
28
// #include <G4_RICH.C>
29
#include <
G4_dRICH.C
>
30
#include <
G4_TPC_EIC.C
>
31
#include <
G4_mRICH.C
>
32
#include <
G4_BECAL.C
>
33
34
#include <
G4_Tracking_Modular.C
>
35
36
#include <G4_BlackHole.C>
37
#include <
G4_Magnet.C
>
38
#include <
G4_PlugDoor_EIC.C
>
39
#include <
G4_User.C
>
40
#include <
G4_World.C
>
41
#include <
G4_Input.C
>
42
43
#include <
g4detectors/PHG4CylinderSubsystem.h
>
44
45
#include <
g4decayer/EDecayType.hh
>
46
47
#include <
g4eval/PHG4DstCompressReco.h
>
48
#include <
g4main/PHG4Reco.h
>
49
#include <
g4main/PHG4TruthSubsystem.h
>
50
51
#include <phfield/PHFieldConfig.h>
52
53
54
#include <
fun4all/Fun4AllDstOutputManager.h
>
55
#include <
fun4all/Fun4AllServer.h
>
56
57
R__LOAD_LIBRARY
(libg4decayer.so)
58
R__LOAD_LIBRARY
(libg4detectors.so)
59
60
void
G4Init
()
61
{
62
// First some check for subsystems which do not go together
63
64
if
(
Enable::TPC
&&
Enable::FST
&& !
G4FST::SETTING::FST_TPC
){
65
cout <<
"TPC and FST cannot be enabled together"
<< endl;
66
gSystem->Exit(1);
67
}
else
if
((
Enable::TPC
||
Enable::MVTX
) &&
Enable::BARREL
){
68
cout <<
"TPC/MVTX and BARREL cannot be enabled together"
<< endl;
69
gSystem->Exit(1);
70
}
else
if
( (
Enable::FST
&&
Enable::ALLSILICON
) ||
71
(
Enable::BARREL
&&
Enable::ALLSILICON
) ){
72
cout <<
"FST and ALLSILICON or BARREL and ALLSILICON cannot be enabled together"
<< endl;
73
gSystem->Exit(1);
74
}
else
if
( (
Enable::EGEM
&&
Enable::ALLSILICON
&&
Enable::EGEM_FULL
) ){
75
76
cout <<
"EGEM and ALLSILICON cannot be enabled together, if EGEM is using full setup, set Enable::EGEM_FULL to false to run in parallel"
<< endl;
77
gSystem->Exit(1);
78
}
else
if
( (
Enable::FGEM
&&
Enable::ALLSILICON
) ) {
79
cout <<
"FGEM and ALLSILICON cannot be enabled together"
<< endl;
80
gSystem->Exit(1);
81
}
else
if
( (
Enable::FGEM
&&
Enable::FTTL
) ) {
82
cout <<
"FGEM and FTTL cannot be enabled together"
<< endl;
83
gSystem->Exit(1);
84
}
else
if
( (
Enable::EEMC
&&
Enable::EEMCH
) ) {
85
cout <<
"two different versions of the EEMC are enabled together, please fix"
<< endl;
86
gSystem->Exit(1);
87
}
else
if
( (
Enable::CEMC
&&
Enable::BECAL
) ) {
88
cout <<
"two different versions of the barrel ECal are enabled together, please fix"
<< endl;
89
gSystem->Exit(1);
90
}
91
92
// load detector/material macros and execute Init() function
93
if
(
Enable::PLUGDOOR
)
PlugDoorInit
();
94
if
(
Enable::MAGNET
)
MagnetInit
();
95
MagnetFieldInit
();
// We want the field - even if the magnet volume is disabled
96
if
(
Enable::PIPE
)
PipeInit
();
97
if
(
Enable::HFARFWD_MAGNETS
)
hFarFwdBeamLineInit
();
98
// trackers
99
if
(
Enable::EGEM
)
EGEM_Init
();
100
if
(
Enable::FGEM
)
FGEM_Init
();
101
if
(
Enable::FST
)
FST_Init
();
102
if
(
Enable::ALLSILICON
)
AllSiliconInit
();
103
if
(
Enable::FTTL
||
Enable::ETTL
||
Enable::CTTL
)
TTL_Init
();
104
if
(
Enable::BARREL
)
BarrelInit
();
105
if
(
Enable::MVTX
)
MvtxInit
();
106
if
(
Enable::TPC
)
TPCInit
();
107
// PID
108
if
(
Enable::DIRC
)
DIRCInit
();
109
if
(
Enable::RICH
)
RICHInit
();
110
if
(
Enable::mRICH
)
mRICHInit
();
111
if
(
Enable::AEROGEL
)
AerogelInit
();
112
113
// calorimeters
114
if
(
Enable::CEMC
)
CEmcInit
(72);
// make it 2*2*2*3*3 so we can try other combinations
115
if
(
Enable::HCALIN
)
HCalInnerInit
(1);
116
if
(
Enable::HCALOUT
)
HCalOuterInit
();
117
if
(
Enable::FEMC
)
FEMCInit
();
118
if
(
Enable::DRCALO
)
DRCALOInit
();
119
if
(
Enable::FHCAL
)
FHCALInit
();
120
if
(
Enable::LFHCAL
)
LFHCALInit
();
121
if
(
Enable::EHCAL
)
EHCALInit
();
122
if
(
Enable::EEMC
)
EEMCInit
();
123
if
(
Enable::EEMCH
)
EEMCHInit
();
124
if
(
Enable::BECAL
)
BECALInit
();
125
126
// very forward detectors
127
if
(
Enable::BBC
)
BbcInit
();
128
129
// tracking
130
if
(
Enable::TRACKING
)
TrackingInit
();
131
132
// others
133
if
(
Enable::USER
)
UserInit
();
134
if
(
Enable::BLACKHOLE
)
BlackHoleInit
();
135
136
137
}
138
139
int
G4Setup
(TString specialSetting =
""
){
140
//---------------
141
// Fun4All server
142
//---------------
143
144
Fun4AllServer
*se =
Fun4AllServer::instance
();
145
146
PHG4Reco
*g4Reco =
new
PHG4Reco
();
147
148
WorldInit
(g4Reco);
149
150
g4Reco->
set_rapidity_coverage
(1.1);
// according to drawings
151
// uncomment to set QGSP_BERT_HP physics list for productions
152
// (default is QGSP_BERT for speed)
153
// g4Reco->SetPhysicsList("QGSP_BERT_HP");
154
155
if
(
G4P6DECAYER::decayType
!=
EDecayType::kAll
){
156
g4Reco->
set_force_decay
(
G4P6DECAYER::decayType
);
157
}
158
159
double
fieldstrength;
160
istringstream stringline(
G4MAGNET::magfield
);
161
stringline >> fieldstrength;
162
if
(stringline.fail()){
// conversion to double fails -> we have a string
163
if
(
G4MAGNET::magfield
.find(
"sphenix3dbigmapxyz"
) != string::npos){
164
g4Reco->
set_field_map
(
G4MAGNET::magfield
,
PHFieldConfig::Field3DCartesian
);
165
}
else
{
166
g4Reco->
set_field_map
(
G4MAGNET::magfield
,
PHFieldConfig::kField2D
);
167
}
168
}
else
{
169
g4Reco->
set_field
(fieldstrength);
// use const soleniodal field
170
}
171
g4Reco->
set_field_rescale
(
G4MAGNET::magfield_rescale
);
172
173
// the radius is an older protection against overlaps, it is not
174
// clear how well this works nowadays but it doesn't hurt either
175
double
radius
= 0.;
176
if
(
Enable::PIPE
) radius =
Pipe
(g4Reco, radius);
177
if
(
Enable::HFARFWD_MAGNETS_IP6
||
Enable::HFARFWD_MAGNETS_IP8
)
hFarFwdDefineMagnets
(g4Reco);
178
if
(
Enable::HFARFWD_VIRTUAL_DETECTORS_IP6
)
hFarFwdDefineDetectorsIP6
(g4Reco);
179
if
(
Enable::HFARFWD_VIRTUAL_DETECTORS_IP8
)
hFarFwdDefineDetectorsIP8
(g4Reco);
180
181
//----------------------------------------
182
// trackers
183
if
(
Enable::EGEM
)
EGEMSetup
(g4Reco);
184
if
(
Enable::FGEM
)
FGEMSetup
(g4Reco);
185
if
(
Enable::FST
)
FSTSetup
(g4Reco, 1.2);
186
if
(
Enable::ALLSILICON
)
AllSiliconSetup
(g4Reco);
187
if
(
Enable::BARREL
)
Barrel
(g4Reco, radius);
188
if
(
Enable::MVTX
) radius =
Mvtx
(g4Reco, radius);
189
if
(
Enable::TPC
) radius =
TPC
(g4Reco, radius);
190
if
(
Enable::FTTL
)
FTTLSetup
(g4Reco,specialSetting);
191
if
(
Enable::ETTL
)
ETTLSetup
(g4Reco,specialSetting);
192
if
(
Enable::CTTL
)
CTTLSetup
(g4Reco,specialSetting);
193
194
//----------------------------------------
195
// beam counters
196
if
(
Enable::BBC
)
Bbc
(g4Reco);
197
//----------------------------------------
198
// calos
199
if
(
Enable::CEMC
) radius =
CEmc
(g4Reco, radius);
200
if
(
Enable::BECAL
)
BECALSetup
(g4Reco);
201
if
(
Enable::HCALIN
) radius =
HCalInner
(g4Reco, radius, 4);
202
if
(
Enable::MAGNET
) radius =
Magnet
(g4Reco, radius);
203
if
(
Enable::HCALOUT
) radius =
HCalOuter
(g4Reco, radius, 4);
204
if
(
Enable::FEMC
)
FEMCSetup
(g4Reco);
205
if
(
Enable::FHCAL
)
FHCALSetup
(g4Reco);
206
if
(
Enable::DRCALO
)
DRCALOSetup
(g4Reco);
207
if
(
Enable::LFHCAL
)
LFHCALSetup
(g4Reco);
208
if
(
Enable::EHCAL
)
EHCALSetup
(g4Reco);
209
if
(
Enable::EEMC
)
EEMCSetup
(g4Reco);
210
if
(
Enable::EEMCH
)
EEMCHSetup
(g4Reco);
211
212
//----------------------------------------
213
// PID
214
if
(
Enable::DIRC
)
DIRCSetup
(g4Reco);
215
if
(
Enable::RICH
)
RICHSetup
(g4Reco);
216
if
(
Enable::AEROGEL
)
AerogelSetup
(g4Reco);
217
if
(
Enable::mRICH
)
mRICHSetup
(g4Reco);
218
219
//----------------------------------------
220
// sPHENIX forward flux return door
221
if
(
Enable::PLUGDOOR
)
PlugDoor
(g4Reco);
222
if
(
Enable::USER
)
UserDetector
(g4Reco);
223
224
//----------------------------------------
225
// BLACKHOLE if enabled, needs info from all previous sub detectors for dimensions
226
if
(
Enable::BLACKHOLE
)
BlackHole
(g4Reco, radius);
227
228
PHG4TruthSubsystem
*truth =
new
PHG4TruthSubsystem
();
229
g4Reco->
registerSubsystem
(truth);
230
// finally adjust the world size in case the default is too small
231
WorldSize
(g4Reco, radius);
232
233
se->
registerSubsystem
(g4Reco);
234
return
0;
235
}
236
237
void
ShowerCompress
(){
238
Fun4AllServer
*se =
Fun4AllServer::instance
();
239
240
PHG4DstCompressReco
*
compress
=
new
PHG4DstCompressReco
(
"PHG4DstCompressReco"
);
241
compress->
AddHitContainer
(
"G4HIT_PIPE"
);
242
compress->
AddHitContainer
(
"G4HIT_FIELDCAGE"
);
243
compress->
AddHitContainer
(
"G4HIT_BH_FORWARD_PLUS"
);
244
compress->
AddHitContainer
(
"G4HIT_BH_FORWARD_NEG"
);
245
compress->
AddHitContainer
(
"G4HIT_MAGNET"
);
246
compress->
AddHitContainer
(
"G4HIT_BH_1"
);
247
248
compress->
AddHitContainer
(
"G4HIT_CEMC_ELECTRONICS"
);
249
compress->
AddHitContainer
(
"G4HIT_CEMC"
);
250
compress->
AddHitContainer
(
"G4HIT_ABSORBER_CEMC"
);
251
compress->
AddHitContainer
(
"G4HIT_CEMC_SPT"
);
252
compress->
AddCellContainer
(
"G4CELL_CEMC"
);
253
compress->
AddTowerContainer
(
"TOWER_SIM_CEMC"
);
254
compress->
AddTowerContainer
(
"TOWER_RAW_CEMC"
);
255
compress->
AddTowerContainer
(
"TOWER_CALIB_CEMC"
);
256
257
compress->
AddHitContainer
(
"G4HIT_ABSORBER_HCALIN"
);
258
compress->
AddHitContainer
(
"G4HIT_HCALIN"
);
259
compress->
AddHitContainer
(
"G4HIT_HCALIN_SPT"
);
260
compress->
AddCellContainer
(
"G4CELL_HCALIN"
);
261
compress->
AddTowerContainer
(
"TOWER_SIM_HCALIN"
);
262
compress->
AddTowerContainer
(
"TOWER_RAW_HCALIN"
);
263
compress->
AddTowerContainer
(
"TOWER_CALIB_HCALIN"
);
264
265
compress->
AddHitContainer
(
"G4HIT_ABSORBER_HCALOUT"
);
266
compress->
AddHitContainer
(
"G4HIT_HCALOUT"
);
267
compress->
AddCellContainer
(
"G4CELL_HCALOUT"
);
268
compress->
AddTowerContainer
(
"TOWER_SIM_HCALOUT"
);
269
compress->
AddTowerContainer
(
"TOWER_RAW_HCALOUT"
);
270
compress->
AddTowerContainer
(
"TOWER_CALIB_HCALOUT"
);
271
272
compress->
AddHitContainer
(
"G4HIT_FEMC"
);
273
compress->
AddHitContainer
(
"G4HIT_ABSORBER_FEMC"
);
274
compress->
AddCellContainer
(
"G4CELL_FEMC"
);
275
compress->
AddTowerContainer
(
"TOWER_SIM_FEMC"
);
276
compress->
AddTowerContainer
(
"TOWER_RAW_FEMC"
);
277
compress->
AddTowerContainer
(
"TOWER_CALIB_FEMC"
);
278
279
compress->
AddHitContainer
(
"G4HIT_DRCALO"
);
280
compress->
AddHitContainer
(
"G4HIT_ABSORBER_DRCALO"
);
281
compress->
AddCellContainer
(
"G4CELL_DRCALO"
);
282
compress->
AddTowerContainer
(
"TOWER_SIM_DRCALO"
);
283
compress->
AddTowerContainer
(
"TOWER_RAW_DRCALO"
);
284
compress->
AddTowerContainer
(
"TOWER_CALIB_DRCALO"
);
285
286
compress->
AddHitContainer
(
"G4HIT_FHCAL"
);
287
compress->
AddHitContainer
(
"G4HIT_ABSORBER_FHCAL"
);
288
compress->
AddCellContainer
(
"G4CELL_FHCAL"
);
289
compress->
AddTowerContainer
(
"TOWER_SIM_FHCAL"
);
290
compress->
AddTowerContainer
(
"TOWER_RAW_FHCAL"
);
291
compress->
AddTowerContainer
(
"TOWER_CALIB_FHCAL"
);
292
293
compress->
AddHitContainer
(
"G4HIT_LFHCAL"
);
294
compress->
AddHitContainer
(
"G4HIT_ABSORBER_LFHCAL"
);
295
compress->
AddCellContainer
(
"G4CELL_LFHCAL"
);
296
compress->
AddTowerContainer
(
"TOWER_SIM_LFHCAL"
);
297
compress->
AddTowerContainer
(
"TOWER_RAW_LFHCAL"
);
298
compress->
AddTowerContainer
(
"TOWER_CALIB_LFHCAL"
);
299
300
compress->
AddHitContainer
(
"G4HIT_EHCAL"
);
301
compress->
AddHitContainer
(
"G4HIT_ABSORBER_EHCAL"
);
302
compress->
AddCellContainer
(
"G4CELL_EHCAL"
);
303
compress->
AddTowerContainer
(
"TOWER_SIM_EHCAL"
);
304
compress->
AddTowerContainer
(
"TOWER_RAW_EHCAL"
);
305
compress->
AddTowerContainer
(
"TOWER_CALIB_EHCAL"
);
306
307
compress->
AddHitContainer
(
"G4HIT_EEMC"
);
308
compress->
AddHitContainer
(
"G4HIT_ABSORBER_EEMC"
);
309
compress->
AddCellContainer
(
"G4CELL_EEMC"
);
310
compress->
AddTowerContainer
(
"TOWER_SIM_EEMC"
);
311
compress->
AddTowerContainer
(
"TOWER_RAW_EEMC"
);
312
compress->
AddTowerContainer
(
"TOWER_CALIB_EEMC"
);
313
314
compress->
AddHitContainer
(
"G4HIT_EEMC_glass"
);
315
compress->
AddHitContainer
(
"G4HIT_ABSORBER_EEMC_glass"
);
316
compress->
AddCellContainer
(
"G4CELL_EEMC_glass"
);
317
compress->
AddTowerContainer
(
"TOWER_SIM_EEMC_glass"
);
318
compress->
AddTowerContainer
(
"TOWER_RAW_EEMC_glass"
);
319
compress->
AddTowerContainer
(
"TOWER_CALIB_EEMC_glass"
);
320
321
compress->
AddHitContainer
(
"G4HIT_BECAL"
);
322
compress->
AddHitContainer
(
"G4HIT_ABSORBER_BECAL"
);
323
compress->
AddCellContainer
(
"G4CELL_BECAL"
);
324
compress->
AddTowerContainer
(
"TOWER_SIM_BECAL"
);
325
compress->
AddTowerContainer
(
"TOWER_RAW_BECAL"
);
326
compress->
AddTowerContainer
(
"TOWER_CALIB_BECAL"
);
327
328
se->
registerSubsystem
(compress);
329
330
return
;
331
}
332
333
void
DstCompress
(
Fun4AllDstOutputManager
*out){
334
if
(out) {
335
out->
StripNode
(
"G4HIT_PIPE"
);
336
out->
StripNode
(
"G4HIT_SVTXSUPPORT"
);
337
out->
StripNode
(
"G4HIT_MAGNET"
);
338
out->
StripNode
(
"G4HIT_BH_1"
);
339
out->
StripNode
(
"G4HIT_BH_FORWARD_PLUS"
);
340
out->
StripNode
(
"G4HIT_BH_FORWARD_NEG"
);
341
342
out->
StripNode
(
"G4HIT_CEMC_ELECTRONICS"
);
343
out->
StripNode
(
"G4HIT_CEMC"
);
344
out->
StripNode
(
"G4HIT_ABSORBER_CEMC"
);
345
out->
StripNode
(
"G4HIT_CEMC_SPT"
);
346
347
out->
StripNode
(
"G4HIT_ABSORBER_HCALIN"
);
348
out->
StripNode
(
"G4HIT_HCALIN"
);
349
out->
StripNode
(
"G4HIT_HCALIN_SPT"
);
350
351
out->
StripNode
(
"G4HIT_ABSORBER_HCALOUT"
);
352
out->
StripNode
(
"G4HIT_HCALOUT"
);
353
out->
StripNode
(
"G4CELL_CEMC"
);
354
out->
StripNode
(
"G4CELL_HCALIN"
);
355
out->
StripNode
(
"G4CELL_HCALOUT"
);
356
357
out->
StripNode
(
"G4HIT_FEMC"
);
358
out->
StripNode
(
"G4HIT_ABSORBER_FEMC"
);
359
out->
StripNode
(
"G4CELL_FEMC"
);
360
361
out->
StripNode
(
"G4HIT_FHCAL"
);
362
out->
StripNode
(
"G4HIT_ABSORBER_FHCAL"
);
363
out->
StripNode
(
"G4CELL_FHCAL"
);
364
365
out->
StripNode
(
"G4HIT_LFHCAL"
);
366
out->
StripNode
(
"G4HIT_ABSORBER_LFHCAL"
);
367
out->
StripNode
(
"G4CELL_LFHCAL"
);
368
369
out->
StripNode
(
"G4HIT_EHCAL"
);
370
out->
StripNode
(
"G4HIT_ABSORBER_EHCAL"
);
371
out->
StripNode
(
"G4CELL_EHCAL"
);
372
373
out->
StripNode
(
"G4HIT_DRCALO"
);
374
out->
StripNode
(
"G4HIT_ABSORBER_DRCALO"
);
375
out->
StripNode
(
"G4CELL_DRCALO"
);
376
377
out->
StripNode
(
"G4HIT_EEMC"
);
378
out->
StripNode
(
"G4HIT_ABSORBER_EEMC"
);
379
out->
StripNode
(
"G4CELL_EEMC"
);
380
381
out->
StripNode
(
"G4HIT_EEMC_glass"
);
382
out->
StripNode
(
"G4HIT_ABSORBER_EEMC_glass"
);
383
out->
StripNode
(
"G4CELL_EEMC_glass"
);
384
385
out->
StripNode
(
"G4HIT_BECAL"
);
386
out->
StripNode
(
"G4HIT_ABSORBER_BECAL"
);
387
out->
StripNode
(
"G4CELL_BECAL"
);
388
389
}
390
}
391
#endif
fun4all_eicmacros
blob
master
detectors
Modular
G4Setup_ModularDetector.C
Built by
Jin Huang
. updated:
Mon Jan 22 2024 12:43:53
using
1.8.2 with
EIC GitHub integration