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_ModularDetectorBeast.C
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file G4Setup_ModularDetectorBeast.C
1
#ifndef MACRO_G4SETUPMODULARDETECTORBEAST_C
2
#define MACRO_G4SETUPMODULARDETECTORBEAST_C
3
4
#include <GlobalVariables.C>
5
6
#include <
G4_Aerogel.C
>
7
#include <
G4_Barrel_EIC.C
>
8
#include <
G4_AllSilicon.C
>
9
#include <
G4_FST_EIC.C
>
10
#include <
G4_TTL_EIC.C
>
11
#include <
G4_GEM_EIC.C
>
12
#include <G4_Bbc.C>
13
#include <G4_CEmc_EIC.C>
14
#include <G4_DIRC.C>
15
#include <G4_EEMC.C>
16
#include <G4_FEMC_EIC.C>
17
#include <G4_FHCAL.C>
18
#include <
G4_EHCAL.C
>
19
#include <G4_HcalIn_ref.C>
20
#include <G4_HcalOut_ref.C>
21
#include <
G4_Mvtx_EIC.C
>
22
#include <
G4_RICH.C
>
23
#include <
G4_TPC_EIC.C
>
24
25
#include <
G4_Tracking_Modular.C
>
26
27
#include <G4_BlackHole.C>
28
#include <
G4_Magnet_Beast.C
>
29
#include <G4_Pipe_EIC.C>
30
#include <
G4_PlugDoor_EIC.C
>
31
#include <
G4_User.C
>
32
#include <
G4_World.C
>
33
#include <
G4_Input.C
>
34
35
#include <
g4detectors/PHG4CylinderSubsystem.h
>
36
37
#include <
g4decayer/EDecayType.hh
>
38
39
#include <
g4eval/PHG4DstCompressReco.h
>
40
#include <
g4main/PHG4Reco.h
>
41
#include <
g4main/PHG4TruthSubsystem.h
>
42
43
#include <phfield/PHFieldConfig.h>
44
45
#include <
fun4all/Fun4AllDstOutputManager.h
>
46
#include <
fun4all/Fun4AllServer.h
>
47
48
R__LOAD_LIBRARY
(libg4decayer.so)
49
R__LOAD_LIBRARY
(libg4detectors.so)
50
51
void
G4Init
()
52
{
53
// First some check for subsystems which do not go together
54
if
(
Enable::TPC
&&
Enable::FST
&& !
G4FST::SETTING::FST_TPC
){
55
cout <<
"TPC and FST cannot be enabled together"
<< endl;
56
gSystem->Exit(1);
57
}
else
if
((
Enable::TPC
||
Enable::MVTX
) &&
Enable::BARREL
){
58
cout <<
"TPC/MVTX and BARREL cannot be enabled together"
<< endl;
59
gSystem->Exit(1);
60
}
else
if
( (
Enable::FST
&&
Enable::ALLSILICON
) ||
61
(
Enable::BARREL
&&
Enable::ALLSILICON
) ){
62
cout <<
"FST and ALLSILICON or BARREL and ALLSILICON cannot be enabled together"
<< endl;
63
gSystem->Exit(1);
64
}
else
if
( (
Enable::EGEM
&&
Enable::ALLSILICON
&&
Enable::EGEM_FULL
) ){
65
66
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;
67
gSystem->Exit(1);
68
}
else
if
( (
Enable::FGEM
&&
Enable::ALLSILICON
) ) {
69
cout <<
"FGEM and ALLSILICON cannot be enabled together"
<< endl;
70
gSystem->Exit(1);
71
}
else
if
( (
Enable::FGEM
&&
Enable::FTTL
) ) {
72
cout <<
"FGEM and FTTL cannot be enabled together"
<< endl;
73
gSystem->Exit(1);
74
}
75
76
// load detector/material macros and execute Init() function
77
if
(
Enable::PLUGDOOR
)
PlugDoorInit
();
78
if
(
Enable::MAGNET
)
MagnetInit
();
79
MagnetFieldInit
();
// We want the field - even if the magnet volume is disabled
80
if
(
Enable::PIPE
)
PipeInit
();
81
82
// trackers
83
if
(
Enable::EGEM
)
EGEM_Init
();
84
if
(
Enable::FGEM
)
FGEM_Init
();
85
if
(
Enable::FST
)
FST_Init
();
86
if
(
Enable::ALLSILICON
)
AllSiliconInit
();
87
if
(
Enable::FTTL
||
Enable::ETTL
||
Enable::CTTL
)
TTL_Init
();
88
if
(
Enable::BARREL
)
BarrelInit
();
89
if
(
Enable::MVTX
)
MvtxInit
();
90
if
(
Enable::TPC
)
TPCInit
();
91
// PID
92
if
(
Enable::DIRC
)
DIRCInit
();
93
if
(
Enable::RICH
)
RICHInit
();
94
if
(
Enable::AEROGEL
)
AerogelInit
();
95
96
// calorimeters
97
if
(
Enable::CEMC
)
CEmcInit
(72);
// make it 2*2*2*3*3 so we can try other combinations
98
if
(
Enable::HCALIN
)
HCalInnerInit
(1);
99
if
(
Enable::HCALOUT
)
HCalOuterInit
();
100
if
(
Enable::FEMC
)
FEMCInit
();
101
if
(
Enable::FHCAL
)
FHCALInit
();
102
if
(
Enable::EHCAL
)
EHCALInit
();
103
if
(
Enable::EEMC
)
EEMCInit
();
104
105
// very forward detectors
106
if
(
Enable::BBC
)
BbcInit
();
107
108
// tracking
109
if
(
Enable::TRACKING
)
TrackingInit
();
110
111
// others
112
if
(
Enable::USER
)
UserInit
();
113
if
(
Enable::BLACKHOLE
)
BlackHoleInit
();
114
115
}
116
117
void
G4Setup
(TString specialSetting =
""
)
118
{
119
//---------------
120
// Fun4All server
121
//---------------
122
123
Fun4AllServer
*se =
Fun4AllServer::instance
();
124
125
PHG4Reco
*g4Reco =
new
PHG4Reco
();
126
127
WorldInit
(g4Reco);
128
129
// global coverage used for length of cylinders if lengthviarapidity is set
130
// probably needs to be adjusted for JLeic
131
g4Reco->
set_rapidity_coverage
(1.1);
// according to drawings
132
// uncomment to set QGSP_BERT_HP physics list for productions
133
// (default is QGSP_BERT for speed)
134
// g4Reco->SetPhysicsList("QGSP_BERT_HP");
135
136
137
if
(
G4P6DECAYER::decayType
!=
EDecayType::kAll
){
138
g4Reco->
set_force_decay
(
G4P6DECAYER::decayType
);
139
}
140
141
double
fieldstrength;
142
istringstream stringline(
G4MAGNET::magfield
);
143
stringline >> fieldstrength;
144
if
(stringline.fail()){
// conversion to double fails -> we have a string
145
g4Reco->
set_field_map
(
G4MAGNET::magfield
,
PHFieldConfig::kFieldBeast
);
146
}
else
{
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
//----------------------------------------
157
// trackers
158
if
(
Enable::EGEM
)
EGEMSetup
(g4Reco);
159
if
(
Enable::FGEM
)
FGEMSetup
(g4Reco);
160
if
(
Enable::FST
)
FSTSetup
(g4Reco, 1.2);
161
if
(
Enable::ALLSILICON
)
AllSiliconSetup
(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::FTTL
)
FTTLSetup
(g4Reco,specialSetting);
166
if
(
Enable::ETTL
)
ETTLSetup
(g4Reco,specialSetting);
167
if
(
Enable::CTTL
)
CTTLSetup
(g4Reco,specialSetting);
168
169
//----------------------------------------
170
// beam counters
171
if
(
Enable::BBC
)
Bbc
(g4Reco);
172
//----------------------------------------
173
// calos
174
if
(
Enable::CEMC
) radius =
CEmc
(g4Reco, radius);
175
if
(
Enable::HCALIN
) radius =
HCalInner
(g4Reco, radius, 4);
176
if
(
Enable::MAGNET
) radius =
Magnet
(g4Reco, radius);
177
if
(
Enable::HCALOUT
) radius =
HCalOuter
(g4Reco, radius, 4);
178
if
(
Enable::FEMC
)
FEMCSetup
(g4Reco);
179
if
(
Enable::FHCAL
)
FHCALSetup
(g4Reco);
180
if
(
Enable::EHCAL
)
EHCALSetup
(g4Reco);
181
if
(
Enable::EEMC
)
EEMCSetup
(g4Reco);
182
183
//----------------------------------------
184
// PID
185
if
(
Enable::DIRC
)
DIRCSetup
(g4Reco);
186
if
(
Enable::RICH
)
RICHSetup
(g4Reco);
187
if
(
Enable::AEROGEL
)
AerogelSetup
(g4Reco);
188
189
//----------------------------------------
190
// sPHENIX forward flux return door
191
if
(
Enable::PLUGDOOR
)
PlugDoor
(g4Reco);
192
if
(
Enable::USER
)
UserDetector
(g4Reco);
193
194
//----------------------------------------
195
// BLACKHOLE needs to be last
196
197
if
(
Enable::BLACKHOLE
)
BlackHole
(g4Reco, radius);
198
199
PHG4TruthSubsystem
*truth =
new
PHG4TruthSubsystem
();
200
g4Reco->
registerSubsystem
(truth);
201
// finally adjust the world size in case the default is too small
202
WorldSize
(g4Reco, radius);
203
204
se->
registerSubsystem
(g4Reco);
205
return
0;
206
}
207
208
void
ShowerCompress
()
209
{
210
Fun4AllServer
*se =
Fun4AllServer::instance
();
211
212
PHG4DstCompressReco
*
compress
=
new
PHG4DstCompressReco
(
"PHG4DstCompressReco"
);
213
compress->
AddHitContainer
(
"G4HIT_PIPE"
);
214
compress->
AddHitContainer
(
"G4HIT_FIELDCAGE"
);
215
compress->
AddHitContainer
(
"G4HIT_CEMC_ELECTRONICS"
);
216
compress->
AddHitContainer
(
"G4HIT_CEMC"
);
217
compress->
AddHitContainer
(
"G4HIT_ABSORBER_CEMC"
);
218
compress->
AddHitContainer
(
"G4HIT_CEMC_SPT"
);
219
compress->
AddHitContainer
(
"G4HIT_ABSORBER_HCALIN"
);
220
compress->
AddHitContainer
(
"G4HIT_HCALIN"
);
221
compress->
AddHitContainer
(
"G4HIT_HCALIN_SPT"
);
222
compress->
AddHitContainer
(
"G4HIT_MAGNET"
);
223
compress->
AddHitContainer
(
"G4HIT_ABSORBER_HCALOUT"
);
224
compress->
AddHitContainer
(
"G4HIT_HCALOUT"
);
225
compress->
AddHitContainer
(
"G4HIT_BH_1"
);
226
compress->
AddHitContainer
(
"G4HIT_BH_FORWARD_PLUS"
);
227
compress->
AddHitContainer
(
"G4HIT_BH_FORWARD_NEG"
);
228
compress->
AddCellContainer
(
"G4CELL_CEMC"
);
229
compress->
AddCellContainer
(
"G4CELL_HCALIN"
);
230
compress->
AddCellContainer
(
"G4CELL_HCALOUT"
);
231
compress->
AddTowerContainer
(
"TOWER_SIM_CEMC"
);
232
compress->
AddTowerContainer
(
"TOWER_RAW_CEMC"
);
233
compress->
AddTowerContainer
(
"TOWER_CALIB_CEMC"
);
234
compress->
AddTowerContainer
(
"TOWER_SIM_HCALIN"
);
235
compress->
AddTowerContainer
(
"TOWER_RAW_HCALIN"
);
236
compress->
AddTowerContainer
(
"TOWER_CALIB_HCALIN"
);
237
compress->
AddTowerContainer
(
"TOWER_SIM_HCALOUT"
);
238
compress->
AddTowerContainer
(
"TOWER_RAW_HCALOUT"
);
239
compress->
AddTowerContainer
(
"TOWER_CALIB_HCALOUT"
);
240
241
compress->
AddHitContainer
(
"G4HIT_FEMC"
);
242
compress->
AddHitContainer
(
"G4HIT_ABSORBER_FEMC"
);
243
compress->
AddHitContainer
(
"G4HIT_FHCAL"
);
244
compress->
AddHitContainer
(
"G4HIT_ABSORBER_FHCAL"
);
245
compress->
AddHitContainer
(
"G4HIT_EHCAL"
);
246
compress->
AddHitContainer
(
"G4HIT_ABSORBER_EHCAL"
);
247
compress->
AddCellContainer
(
"G4CELL_FEMC"
);
248
compress->
AddCellContainer
(
"G4CELL_FHCAL"
);
249
compress->
AddCellContainer
(
"G4CELL_EHCAL"
);
250
compress->
AddTowerContainer
(
"TOWER_SIM_FEMC"
);
251
compress->
AddTowerContainer
(
"TOWER_RAW_FEMC"
);
252
compress->
AddTowerContainer
(
"TOWER_CALIB_FEMC"
);
253
compress->
AddTowerContainer
(
"TOWER_SIM_FHCAL"
);
254
compress->
AddTowerContainer
(
"TOWER_RAW_FHCAL"
);
255
compress->
AddTowerContainer
(
"TOWER_CALIB_FHCAL"
);
256
compress->
AddTowerContainer
(
"TOWER_SIM_EHCAL"
);
257
compress->
AddTowerContainer
(
"TOWER_RAW_EHCAL"
);
258
compress->
AddTowerContainer
(
"TOWER_CALIB_EHCAL"
);
259
260
compress->
AddHitContainer
(
"G4HIT_EEMC"
);
261
compress->
AddHitContainer
(
"G4HIT_ABSORBER_EEMC"
);
262
compress->
AddCellContainer
(
"G4CELL_EEMC"
);
263
compress->
AddTowerContainer
(
"TOWER_SIM_EEMC"
);
264
compress->
AddTowerContainer
(
"TOWER_RAW_EEMC"
);
265
compress->
AddTowerContainer
(
"TOWER_CALIB_EEMC"
);
266
267
se->
registerSubsystem
(compress);
268
269
return
;
270
}
271
272
void
DstCompress
(
Fun4AllDstOutputManager
*out)
273
{
274
if
(out)
275
{
276
out->
StripNode
(
"G4HIT_PIPE"
);
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
(
"G4HIT_EHCAL"
);
300
out->
StripNode
(
"G4HIT_ABSORBER_EHCAL"
);
301
302
out->
StripNode
(
"G4CELL_FEMC"
);
303
out->
StripNode
(
"G4CELL_FHCAL"
);
304
out->
StripNode
(
"G4CELL_EHCAL"
);
305
306
out->
StripNode
(
"G4HIT_EEMC"
);
307
out->
StripNode
(
"G4HIT_ABSORBER_EEMC"
);
308
out->
StripNode
(
"G4CELL_EEMC"
);
309
}
310
}
311
312
#endif // MACRO_G4SETUPBEAST_C
fun4all_eicmacros
blob
master
detectors
ModularBeast
G4Setup_ModularDetectorBeast.C
Built by
Jin Huang
. updated:
Mon Jan 22 2024 12:43:53
using
1.8.2 with
EIC GitHub integration