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_sPHENIX.C
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file G4Setup_sPHENIX.C
1
#ifndef MACRO_G4SETUPSPHENIX_C
2
#define MACRO_G4SETUPSPHENIX_C
3
4
#include <
GlobalVariables.C
>
5
6
#include <
G4_Bbc.C
>
7
#include <
G4_BlackHole.C
>
8
#include <
G4_CEmc_Albedo.C
>
9
#include <
G4_CEmc_Spacal.C
>
10
#include <G4_EPD.C>
11
#include <
G4_FEMC.C
>
12
#include <
G4_HcalIn_ref.C
>
13
#include <
G4_HcalOut_ref.C
>
14
#include <G4_Intt.C>
15
#include <
G4_Magnet.C
>
16
#include <
G4_Micromegas.C
>
17
#include <G4_Mvtx.C>
18
#include <
G4_PSTOF.C
>
19
#include <
G4_Pipe.C
>
20
#include <
G4_PlugDoor.C
>
21
#include <G4_TPC.C>
22
#include <
G4_User.C
>
23
#include <
G4_World.C
>
24
25
#include <
g4detectors/PHG4CylinderSubsystem.h
>
26
27
#include <
g4eval/PHG4DstCompressReco.h
>
28
29
#include <
g4main/PHG4Reco.h
>
30
#include <
g4main/PHG4TruthSubsystem.h
>
31
32
#include <phfield/PHFieldConfig.h>
33
34
#include <
g4decayer/EDecayType.hh
>
35
36
#include <
fun4all/Fun4AllDstOutputManager.h
>
37
#include <
fun4all/Fun4AllServer.h
>
38
39
R__LOAD_LIBRARY
(libg4decayer.so)
40
R__LOAD_LIBRARY
(libg4detectors.so)
41
42
void
G4Init
()
43
{
44
// Check on invalid combinations
45
if
(
Enable::CEMC
&&
Enable::CEMCALBEDO
)
46
{
47
cout <<
"Enable::CEMCALBEDO and Enable::CEMC cannot be set simultanously"
<< endl;
48
gSystem->Exit(1);
49
}
50
// load detector/material macros and execute Init() function
51
52
if
(
Enable::PIPE
)
PipeInit
();
53
if
(
Enable::MVTX
)
MvtxInit
();
54
if
(Enable::INTT) InttInit();
55
if
(
Enable::TPC
)
TPCInit
();
56
if
(
Enable::MICROMEGAS
)
MicromegasInit
();
57
if
(
Enable::BBC
)
BbcInit
();
58
if
(
Enable::CEMCALBEDO
)
CEmcAlbedoInit
();
59
if
(
Enable::CEMC
)
CEmcInit
();
60
if
(
Enable::HCALIN
)
HCalInnerInit
();
61
if
(
Enable::MAGNET
)
MagnetInit
();
62
MagnetFieldInit
();
// We want the field - even if the magnet volume is disabled
63
if
(
Enable::HCALOUT
)
HCalOuterInit
();
64
if
(
Enable::PLUGDOOR
)
PlugDoorInit
();
65
if
(
Enable::FEMC
)
FEMCInit
();
66
if
(Enable::EPD) EPDInit();
67
if
(
Enable::USER
)
UserInit
();
68
if
(
Enable::BLACKHOLE
)
BlackHoleInit
();
69
}
70
71
int
G4Setup
()
72
{
73
//---------------
74
// Fun4All server
75
//---------------
76
77
Fun4AllServer
*se =
Fun4AllServer::instance
();
78
79
PHG4Reco
*g4Reco =
new
PHG4Reco
();
80
g4Reco->
set_rapidity_coverage
(1.1);
// according to drawings
81
WorldInit
(g4Reco);
82
if
(
G4P6DECAYER::decayType
!=
EDecayType::kAll
)
83
{
84
g4Reco->
set_force_decay
(
G4P6DECAYER::decayType
);
85
}
86
87
double
fieldstrength;
88
istringstream stringline(
G4MAGNET::magfield
);
89
stringline >> fieldstrength;
90
if
(stringline.fail())
91
{
// conversion to double fails -> we have a string
92
93
if
(
G4MAGNET::magfield
.find(
"sPHENIX.root"
) != string::npos)
94
{
95
g4Reco->
set_field_map
(
G4MAGNET::magfield
,
PHFieldConfig::Field3DCartesian
);
96
}
97
else
98
{
99
g4Reco->
set_field_map
(
G4MAGNET::magfield
,
PHFieldConfig::kField2D
);
100
}
101
}
102
else
103
{
104
g4Reco->
set_field
(fieldstrength);
// use const soleniodal field
105
}
106
g4Reco->
set_field_rescale
(
G4MAGNET::magfield_rescale
);
107
108
// the radius is an older protection against overlaps, it is not
109
// clear how well this works nowadays but it doesn't hurt either
110
double
radius
= 0.;
111
112
if
(
Enable::PIPE
) radius =
Pipe
(g4Reco, radius);
113
if
(
Enable::MVTX
) radius =
Mvtx
(g4Reco, radius);
114
if
(Enable::INTT) radius = Intt(g4Reco, radius);
115
if
(
Enable::TPC
) radius =
TPC
(g4Reco, radius);
116
if
(
Enable::MICROMEGAS
)
Micromegas
(g4Reco);
117
if
(
Enable::BBC
)
Bbc
(g4Reco);
118
if
(
Enable::CEMCALBEDO
)
CEmcAlbedo
(g4Reco);
119
if
(
Enable::CEMC
) radius =
CEmc
(g4Reco, radius, 8);
120
if
(
Enable::HCALIN
) radius =
HCalInner
(g4Reco, radius, 4);
121
if
(
Enable::MAGNET
) radius =
Magnet
(g4Reco, radius);
122
if
(
Enable::HCALOUT
) radius =
HCalOuter
(g4Reco, radius, 4);
123
if
(
Enable::PLUGDOOR
)
PlugDoor
(g4Reco);
124
if
(
Enable::FEMC
)
FEMCSetup
(g4Reco);
125
if
(Enable::EPD) EPD(g4Reco);
126
if
(
Enable::USER
)
UserDetector
(g4Reco);
127
128
129
//----------------------------------------
130
// BLACKHOLE
131
132
if
(
Enable::BLACKHOLE
)
BlackHole
(g4Reco, radius);
133
134
PHG4TruthSubsystem
*truth =
new
PHG4TruthSubsystem
();
135
g4Reco->
registerSubsystem
(truth);
136
137
// finally adjust the world size in case the default is too small
138
WorldSize
(g4Reco, radius);
139
140
se->
registerSubsystem
(g4Reco);
141
return
0;
142
}
143
144
void
ShowerCompress
(
int
verbosity = 0)
145
{
146
Fun4AllServer
*se =
Fun4AllServer::instance
();
147
148
PHG4DstCompressReco
*
compress
=
new
PHG4DstCompressReco
(
"PHG4DstCompressReco"
);
149
compress->
AddHitContainer
(
"G4HIT_PIPE"
);
150
compress->
AddHitContainer
(
"G4HIT_SVTXSUPPORT"
);
151
compress->
AddHitContainer
(
"G4HIT_CEMC_ELECTRONICS"
);
152
compress->
AddHitContainer
(
"G4HIT_CEMC"
);
153
compress->
AddHitContainer
(
"G4HIT_ABSORBER_CEMC"
);
154
compress->
AddHitContainer
(
"G4HIT_CEMC_SPT"
);
155
compress->
AddHitContainer
(
"G4HIT_ABSORBER_HCALIN"
);
156
compress->
AddHitContainer
(
"G4HIT_HCALIN"
);
157
compress->
AddHitContainer
(
"G4HIT_HCALIN_SPT"
);
158
compress->
AddHitContainer
(
"G4HIT_MAGNET"
);
159
compress->
AddHitContainer
(
"G4HIT_ABSORBER_HCALOUT"
);
160
compress->
AddHitContainer
(
"G4HIT_HCALOUT"
);
161
compress->
AddHitContainer
(
"G4HIT_BH_1"
);
162
compress->
AddHitContainer
(
"G4HIT_BH_FORWARD_PLUS"
);
163
compress->
AddHitContainer
(
"G4HIT_BH_FORWARD_NEG"
);
164
compress->
AddHitContainer
(
"G4HIT_BBC"
);
165
compress->
AddCellContainer
(
"G4CELL_CEMC"
);
166
compress->
AddCellContainer
(
"G4CELL_HCALIN"
);
167
compress->
AddCellContainer
(
"G4CELL_HCALOUT"
);
168
compress->
AddTowerContainer
(
"TOWER_SIM_CEMC"
);
169
compress->
AddTowerContainer
(
"TOWER_RAW_CEMC"
);
170
compress->
AddTowerContainer
(
"TOWER_CALIB_CEMC"
);
171
compress->
AddTowerContainer
(
"TOWER_SIM_HCALIN"
);
172
compress->
AddTowerContainer
(
"TOWER_RAW_HCALIN"
);
173
compress->
AddTowerContainer
(
"TOWER_CALIB_HCALIN"
);
174
compress->
AddTowerContainer
(
"TOWER_SIM_HCALOUT"
);
175
compress->
AddTowerContainer
(
"TOWER_RAW_HCALOUT"
);
176
compress->
AddTowerContainer
(
"TOWER_CALIB_HCALOUT"
);
177
compress->
AddHitContainer
(
"G4HIT_FEMC"
);
178
compress->
AddHitContainer
(
"G4HIT_ABSORBER_FEMC"
);
179
compress->
AddCellContainer
(
"G4CELL_FEMC"
);
180
compress->
AddTowerContainer
(
"TOWER_SIM_FEMC"
);
181
compress->
AddTowerContainer
(
"TOWER_RAW_FEMC"
);
182
compress->
AddTowerContainer
(
"TOWER_CALIB_FEMC"
);
183
se->
registerSubsystem
(compress);
184
185
return
;
186
}
187
188
void
DstCompress
(
Fun4AllDstOutputManager
*out)
189
{
190
if
(out)
191
{
192
out->
StripNode
(
"G4HIT_PIPE"
);
193
out->
StripNode
(
"G4HIT_SVTXSUPPORT"
);
194
out->
StripNode
(
"G4HIT_CEMC_ELECTRONICS"
);
195
out->
StripNode
(
"G4HIT_CEMC"
);
196
out->
StripNode
(
"G4HIT_ABSORBER_CEMC"
);
197
out->
StripNode
(
"G4HIT_CEMC_SPT"
);
198
out->
StripNode
(
"G4HIT_ABSORBER_HCALIN"
);
199
out->
StripNode
(
"G4HIT_HCALIN"
);
200
out->
StripNode
(
"G4HIT_HCALIN_SPT"
);
201
out->
StripNode
(
"G4HIT_MAGNET"
);
202
out->
StripNode
(
"G4HIT_ABSORBER_HCALOUT"
);
203
out->
StripNode
(
"G4HIT_HCALOUT"
);
204
out->
StripNode
(
"G4HIT_BH_1"
);
205
out->
StripNode
(
"G4HIT_BH_FORWARD_PLUS"
);
206
out->
StripNode
(
"G4HIT_BH_FORWARD_NEG"
);
207
out->
StripNode
(
"G4HIT_BBC"
);
208
out->
StripNode
(
"G4CELL_CEMC"
);
209
out->
StripNode
(
"G4CELL_HCALIN"
);
210
out->
StripNode
(
"G4CELL_HCALOUT"
);
211
out->
StripNode
(
"G4HIT_FEMC"
);
212
out->
StripNode
(
"G4HIT_ABSORBER_FEMC"
);
213
out->
StripNode
(
"G4CELL_FEMC"
);
214
}
215
}
216
#endif
tutorials
blob
master
materialscan
G4Setup_sPHENIX.C
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:25:59
using
1.8.2 with
ECCE GitHub integration