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