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