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