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