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