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_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_Aerogel.C
>
7
#include <
G4_Barrel_EIC.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_FST_EIC.C
>
16
#include <
G4_GEM_EIC.C
>
17
#include <G4_HcalIn_ref.C>
18
#include <G4_HcalOut_ref.C>
19
#include <
G4_Input.C
>
20
#include <
G4_Magnet.C
>
21
#include <
G4_Mvtx_EIC.C
>
22
#include <G4_Pipe_EIC.C>
23
#include <
G4_PlugDoor_EIC.C
>
24
#include <
G4_RICH.C
>
25
#include <
G4_TPC_EIC.C
>
26
#include <
G4_Tracking_EIC.C
>
27
#include <
G4_User.C
>
28
#include <
G4_World.C
>
29
#include <
G4_hFarFwdBeamLine_EIC.C
>
30
#include <
G4_BECAL.C
>
31
32
#include <
g4detectors/PHG4CylinderSubsystem.h
>
33
34
#include <
g4eval/PHG4DstCompressReco.h
>
35
36
#include <
g4main/PHG4Reco.h
>
37
#include <
g4main/PHG4TruthSubsystem.h
>
38
39
#include <phfield/PHFieldConfig.h>
40
41
#include <
g4decayer/EDecayType.hh
>
42
43
#include <
fun4all/Fun4AllDstOutputManager.h
>
44
#include <
fun4all/Fun4AllServer.h
>
45
46
R__LOAD_LIBRARY
(libg4decayer.so)
47
R__LOAD_LIBRARY
(libg4detectors.so)
48
49
void
G4Init
()
50
{
51
// First some check for subsystems which do not go together
52
53
if
(
Enable::TPC
&&
Enable::FST
&& !
G4FST::SETTING::FST_TPC
)
54
{
55
cout <<
"FST setup cannot fit in the TPC"
<< endl;
56
gSystem->Exit(1);
57
}
58
else
if
(
Enable::MVTX
&&
Enable::BARREL
)
59
{
60
cout <<
"MVTX and BARREL cannot be enabled together"
<< endl;
61
gSystem->Exit(1);
62
}
63
else
if
(
Enable::TPC
&&
Enable::BARREL
&& !
G4BARREL::SETTING::BARRELV6
) {
64
cout <<
"Barrel setup cannot fit in the TPC"
<< endl;
65
gSystem->Exit(1);
66
}
67
68
if
(
Enable::FGEM_ORIG
&&
Enable::FST
)
69
{
70
cout <<
"FST cannot be enabled with 5 FGEM setup"
<< endl;
71
gSystem->Exit(1);
72
}
73
74
if
(
Enable::FGEM_ORIG
&&
Enable::FST
)
75
{
76
cout <<
"FST cannot be enabled with 5 FGEM setup"
<< endl;
77
gSystem->Exit(1);
78
}
79
80
// load detector/material macros and execute Init() function
81
if
(
Enable::PIPE
)
PipeInit
();
82
if
(
Enable::HFARFWD_MAGNETS_IP6
||
Enable::HFARFWD_MAGNETS_IP8
)
hFarFwdBeamLineInit
();
83
if
(
Enable::PLUGDOOR
)
PlugDoorInit
();
84
if
(
Enable::EGEM
)
EGEM_Init
();
85
if
(
Enable::FGEM
||
Enable::FGEM_ORIG
)
FGEM_Init
();
86
if
(
Enable::FST
)
FST_Init
();
87
if
(
Enable::BARREL
)
BarrelInit
();
88
if
(
Enable::MVTX
)
MvtxInit
();
89
if
(
Enable::TPC
)
TPCInit
();
90
if
(
Enable::TRACKING
)
TrackingInit
();
91
if
(
Enable::BBC
)
BbcInit
();
92
if
(
Enable::CEMC
)
CEmcInit
(72);
// make it 2*2*2*3*3 so we can try other combinations
93
if
(
Enable::BECAL
)
BECALInit
();
94
if
(
Enable::HCALIN
)
HCalInnerInit
(1);
95
if
(
Enable::MAGNET
)
MagnetInit
();
96
MagnetFieldInit
();
// We want the field - even if the magnet volume is disabled
97
if
(
Enable::HCALOUT
)
HCalOuterInit
();
98
if
(
Enable::FEMC
)
FEMCInit
();
99
if
(
Enable::FHCAL
)
FHCALInit
();
100
if
(
Enable::EEMC
)
EEMCInit
();
101
if
(
Enable::DIRC
)
DIRCInit
();
102
if
(
Enable::RICH
)
RICHInit
();
103
if
(
Enable::AEROGEL
)
AerogelInit
();
104
if
(
Enable::USER
)
UserInit
();
105
if
(
Enable::BLACKHOLE
)
BlackHoleInit
();
106
}
107
108
int
G4Setup
()
109
{
110
//---------------
111
// Fun4All server
112
//---------------
113
114
Fun4AllServer
*se =
Fun4AllServer::instance
();
115
116
PHG4Reco
*g4Reco =
new
PHG4Reco
();
117
118
WorldInit
(g4Reco);
119
120
g4Reco->
set_rapidity_coverage
(1.1);
// according to drawings
121
// uncomment to set QGSP_BERT_HP physics list for productions
122
// (default is QGSP_BERT for speed)
123
// g4Reco->SetPhysicsList("QGSP_BERT_HP");
124
125
if
(
G4P6DECAYER::decayType
!=
EDecayType::kAll
)
126
{
127
g4Reco->
set_force_decay
(
G4P6DECAYER::decayType
);
128
}
129
130
double
fieldstrength;
131
istringstream stringline(
G4MAGNET::magfield
);
132
stringline >> fieldstrength;
133
if
(stringline.fail())
134
{
// conversion to double fails -> we have a string
135
136
if
(
G4MAGNET::magfield
.find(
"sphenix3dbigmapxyz"
) != string::npos)
137
{
138
g4Reco->
set_field_map
(
G4MAGNET::magfield
,
PHFieldConfig::Field3DCartesian
);
139
}
140
else
141
{
142
g4Reco->
set_field_map
(
G4MAGNET::magfield
,
PHFieldConfig::kField2D
);
143
}
144
}
145
else
146
{
147
g4Reco->
set_field
(fieldstrength);
// use const soleniodal field
148
}
149
g4Reco->
set_field_rescale
(
G4MAGNET::magfield_rescale
);
150
151
// the radius is an older protection against overlaps, it is not
152
// clear how well this works nowadays but it doesn't hurt either
153
double
radius
= 0.;
154
155
if
(
Enable::PIPE
) radius =
Pipe
(g4Reco, radius);
156
if
(
Enable::HFARFWD_MAGNETS_IP6
||
Enable::HFARFWD_MAGNETS_IP8
)
hFarFwdDefineMagnets
(g4Reco);
157
if
(
Enable::HFARFWD_VIRTUAL_DETECTORS_IP6
)
hFarFwdDefineDetectorsIP6
(g4Reco);
158
if
(
Enable::HFARFWD_VIRTUAL_DETECTORS_IP8
)
hFarFwdDefineDetectorsIP8
(g4Reco);
159
if
(
Enable::EGEM
)
EGEMSetup
(g4Reco);
160
if
(
Enable::FGEM
||
Enable::FGEM_ORIG
)
FGEMSetup
(g4Reco);
161
if
(
Enable::FST
)
FSTSetup
(g4Reco);
162
if
(
Enable::BARREL
)
Barrel
(g4Reco, radius);
163
if
(
Enable::MVTX
) radius =
Mvtx
(g4Reco, radius);
164
if
(
Enable::TPC
) radius =
TPC
(g4Reco, radius);
165
if
(
Enable::BBC
)
Bbc
(g4Reco);
166
if
(
Enable::CEMC
) radius =
CEmc
(g4Reco, radius);
167
if
(
Enable::BECAL
)
BECALSetup
(g4Reco);
168
if
(
Enable::HCALIN
) radius =
HCalInner
(g4Reco, radius, 4);
169
if
(
Enable::MAGNET
) radius =
Magnet
(g4Reco, radius);
170
if
(
Enable::HCALOUT
) radius =
HCalOuter
(g4Reco, radius, 4);
171
if
(
Enable::FEMC
)
FEMCSetup
(g4Reco);
172
if
(
Enable::FHCAL
)
FHCALSetup
(g4Reco);
173
if
(
Enable::EEMC
)
EEMCSetup
(g4Reco);
174
175
//----------------------------------------
176
// PID
177
178
if
(
Enable::DIRC
)
DIRCSetup
(g4Reco);
179
if
(
Enable::RICH
)
RICHSetup
(g4Reco);
180
if
(
Enable::AEROGEL
)
AerogelSetup
(g4Reco);
181
182
//----------------------------------------
183
// sPHENIX forward flux return door
184
if
(
Enable::PLUGDOOR
)
PlugDoor
(g4Reco);
185
186
if
(
Enable::USER
)
UserDetector
(g4Reco);
187
188
//----------------------------------------
189
// BLACKHOLE if enabled, needs info from all previous sub detectors for dimensions
190
if
(
Enable::BLACKHOLE
)
BlackHole
(g4Reco, radius);
191
192
PHG4TruthSubsystem
*truth =
new
PHG4TruthSubsystem
();
193
g4Reco->
registerSubsystem
(truth);
194
// finally adjust the world size in case the default is too small
195
WorldSize
(g4Reco, radius);
196
197
se->
registerSubsystem
(g4Reco);
198
return
0;
199
}
200
201
void
ShowerCompress
()
202
{
203
Fun4AllServer
*se =
Fun4AllServer::instance
();
204
205
PHG4DstCompressReco
*
compress
=
new
PHG4DstCompressReco
(
"PHG4DstCompressReco"
);
206
compress->
AddHitContainer
(
"G4HIT_PIPE"
);
207
compress->
AddHitContainer
(
"G4HIT_ZDC"
);
208
compress->
AddHitContainer
(
"G4HIT_RomanPots"
);
209
compress->
AddHitContainer
(
"G4HIT_B0detector"
);
210
compress->
AddHitContainer
(
"G4HIT_FIELDCAGE"
);
211
compress->
AddHitContainer
(
"G4HIT_CEMC_ELECTRONICS"
);
212
compress->
AddHitContainer
(
"G4HIT_CEMC"
);
213
compress->
AddHitContainer
(
"G4HIT_ABSORBER_CEMC"
);
214
compress->
AddHitContainer
(
"G4HIT_CEMC_SPT"
);
215
compress->
AddHitContainer
(
"G4HIT_ABSORBER_HCALIN"
);
216
compress->
AddHitContainer
(
"G4HIT_HCALIN"
);
217
compress->
AddHitContainer
(
"G4HIT_HCALIN_SPT"
);
218
compress->
AddHitContainer
(
"G4HIT_MAGNET"
);
219
compress->
AddHitContainer
(
"G4HIT_ABSORBER_HCALOUT"
);
220
compress->
AddHitContainer
(
"G4HIT_HCALOUT"
);
221
compress->
AddHitContainer
(
"G4HIT_BH_1"
);
222
compress->
AddHitContainer
(
"G4HIT_BH_FORWARD_PLUS"
);
223
compress->
AddHitContainer
(
"G4HIT_BH_FORWARD_NEG"
);
224
compress->
AddCellContainer
(
"G4CELL_CEMC"
);
225
compress->
AddCellContainer
(
"G4CELL_HCALIN"
);
226
compress->
AddCellContainer
(
"G4CELL_HCALOUT"
);
227
compress->
AddTowerContainer
(
"TOWER_SIM_CEMC"
);
228
compress->
AddTowerContainer
(
"TOWER_RAW_CEMC"
);
229
compress->
AddTowerContainer
(
"TOWER_CALIB_CEMC"
);
230
compress->
AddTowerContainer
(
"TOWER_SIM_HCALIN"
);
231
compress->
AddTowerContainer
(
"TOWER_RAW_HCALIN"
);
232
compress->
AddTowerContainer
(
"TOWER_CALIB_HCALIN"
);
233
compress->
AddTowerContainer
(
"TOWER_SIM_HCALOUT"
);
234
compress->
AddTowerContainer
(
"TOWER_RAW_HCALOUT"
);
235
compress->
AddTowerContainer
(
"TOWER_CALIB_HCALOUT"
);
236
237
compress->
AddHitContainer
(
"G4HIT_FEMC"
);
238
compress->
AddHitContainer
(
"G4HIT_ABSORBER_FEMC"
);
239
compress->
AddHitContainer
(
"G4HIT_FHCAL"
);
240
compress->
AddHitContainer
(
"G4HIT_ABSORBER_FHCAL"
);
241
compress->
AddCellContainer
(
"G4CELL_FEMC"
);
242
compress->
AddCellContainer
(
"G4CELL_FHCAL"
);
243
compress->
AddTowerContainer
(
"TOWER_SIM_FEMC"
);
244
compress->
AddTowerContainer
(
"TOWER_RAW_FEMC"
);
245
compress->
AddTowerContainer
(
"TOWER_CALIB_FEMC"
);
246
compress->
AddTowerContainer
(
"TOWER_SIM_FHCAL"
);
247
compress->
AddTowerContainer
(
"TOWER_RAW_FHCAL"
);
248
compress->
AddTowerContainer
(
"TOWER_CALIB_FHCAL"
);
249
250
compress->
AddHitContainer
(
"G4HIT_BECAL"
);
251
compress->
AddHitContainer
(
"G4HIT_ABSORBER_BECAL"
);
252
compress->
AddCellContainer
(
"G4CELL_BECAL"
);
253
compress->
AddTowerContainer
(
"TOWER_SIM_BECAL"
);
254
compress->
AddTowerContainer
(
"TOWER_RAW_BECAL"
);
255
compress->
AddTowerContainer
(
"TOWER_CALIB_BECAL"
);
256
257
compress->
AddHitContainer
(
"G4HIT_EEMC"
);
258
compress->
AddHitContainer
(
"G4HIT_ABSORBER_EEMC"
);
259
compress->
AddCellContainer
(
"G4CELL_EEMC"
);
260
compress->
AddTowerContainer
(
"TOWER_SIM_EEMC"
);
261
compress->
AddTowerContainer
(
"TOWER_RAW_EEMC"
);
262
compress->
AddTowerContainer
(
"TOWER_CALIB_EEMC"
);
263
264
se->
registerSubsystem
(compress);
265
266
return
;
267
}
268
269
void
DstCompress
(
Fun4AllDstOutputManager
*out)
270
{
271
if
(out)
272
{
273
out->
StripNode
(
"G4HIT_PIPE"
);
274
out->
StripNode
(
"G4HIT_ZDC"
);
275
out->
StripNode
(
"G4HIT_RomanPots"
);
276
out->
StripNode
(
"G4HIT_B0detectors"
);
277
out->
StripNode
(
"G4HIT_SVTXSUPPORT"
);
278
out->
StripNode
(
"G4HIT_CEMC_ELECTRONICS"
);
279
out->
StripNode
(
"G4HIT_CEMC"
);
280
out->
StripNode
(
"G4HIT_ABSORBER_CEMC"
);
281
out->
StripNode
(
"G4HIT_CEMC_SPT"
);
282
out->
StripNode
(
"G4HIT_ABSORBER_HCALIN"
);
283
out->
StripNode
(
"G4HIT_HCALIN"
);
284
out->
StripNode
(
"G4HIT_HCALIN_SPT"
);
285
out->
StripNode
(
"G4HIT_MAGNET"
);
286
out->
StripNode
(
"G4HIT_ABSORBER_HCALOUT"
);
287
out->
StripNode
(
"G4HIT_HCALOUT"
);
288
out->
StripNode
(
"G4HIT_BH_1"
);
289
out->
StripNode
(
"G4HIT_BH_FORWARD_PLUS"
);
290
out->
StripNode
(
"G4HIT_BH_FORWARD_NEG"
);
291
out->
StripNode
(
"G4CELL_CEMC"
);
292
out->
StripNode
(
"G4CELL_HCALIN"
);
293
out->
StripNode
(
"G4CELL_HCALOUT"
);
294
295
out->
StripNode
(
"G4HIT_FEMC"
);
296
out->
StripNode
(
"G4HIT_ABSORBER_FEMC"
);
297
out->
StripNode
(
"G4HIT_FHCAL"
);
298
out->
StripNode
(
"G4HIT_ABSORBER_FHCAL"
);
299
out->
StripNode
(
"G4CELL_FEMC"
);
300
out->
StripNode
(
"G4CELL_FHCAL"
);
301
302
out->
StripNode
(
"G4HIT_BECAL"
);
303
out->
StripNode
(
"G4HIT_ABSORBER_BEEMC"
);
304
out->
StripNode
(
"G4CELL_BECAL"
);
305
306
out->
StripNode
(
"G4HIT_EEMC"
);
307
out->
StripNode
(
"G4HIT_ABSORBER_EEMC"
);
308
out->
StripNode
(
"G4CELL_EEMC"
);
309
}
310
}
311
#endif
fun4all_eicmacros
blob
master
detectors
EICDetector
G4Setup_EICDetector.C
Built by
Jin Huang
. updated:
Mon Jan 22 2024 12:43:53
using
1.8.2 with
EIC GitHub integration