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
G4_HcalOut_ref.C
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file G4_HcalOut_ref.C
1
#ifndef MACRO_G4HCALOUTREF_C
2
#define MACRO_G4HCALOUTREF_C
3
4
#include <GlobalVariables.C>
5
#include <
QA.C
>
6
7
#include <
g4calo/HcalRawTowerBuilder.h
>
8
#include <
g4calo/RawTowerDigitizer.h
>
9
10
#include <
g4detectors/PHG4HcalCellReco.h
>
11
#include <
g4detectors/PHG4OuterHcalSubsystem.h
>
12
13
#include <
g4eval/CaloEvaluator.h
>
14
15
#include <
g4main/PHG4Reco.h
>
16
17
#include <caloreco/RawClusterBuilderGraph.h>
18
#include <caloreco/RawClusterBuilderTemplate.h>
19
#include <caloreco/RawTowerCalibration.h>
20
#include <qa_modules/QAG4SimulationCalorimeter.h>
21
22
#include <
fun4all/Fun4AllServer.h
>
23
24
R__LOAD_LIBRARY
(libcalo_reco.so)
25
R__LOAD_LIBRARY
(libg4calo.so)
26
R__LOAD_LIBRARY
(libg4detectors.so)
27
R__LOAD_LIBRARY
(libg4eval.so)
28
R__LOAD_LIBRARY
(libqa_modules.so)
29
30
namespace Enable
31
{
32
bool
HCALOUT
=
false
;
33
bool
HCALOUT_ABSORBER
=
false
;
34
bool
HCALOUT_OVERLAPCHECK
=
false
;
35
bool
HCALOUT_CELL
=
false
;
36
bool
HCALOUT_TOWER
=
false
;
37
bool
HCALOUT_CLUSTER
=
false
;
38
bool
HCALOUT_EVAL
=
false
;
39
bool
HCALOUT_QA
=
false
;
40
int
HCALOUT_VERBOSITY
= 0;
41
}
// namespace Enable
42
43
namespace
G4HCALOUT
44
{
45
double
outer_radius
= 264.71;
46
double
size_z
= 304.91 * 2;
47
48
// Digitization (default photon digi):
49
RawTowerDigitizer::enu_digi_algorithm
TowerDigi
=
RawTowerDigitizer::kSimple_photon_digitization
;
50
// directly pass the energy of sim tower to digitized tower
51
// kNo_digitization
52
// simple digitization with photon statistics, single amplitude ADC conversion and pedestal
53
// kSimple_photon_digitization
54
// digitization with photon statistics on SiPM with an effective pixel N, ADC conversion and pedestal
55
// kSiPM_photon_digitization
56
57
enum
enu_HCalOut_clusterizer
58
{
59
kHCalOutGraphClusterizer
,
60
kHCalOutTemplateClusterizer
61
};
62
64
enu_HCalOut_clusterizer
HCalOut_clusterizer
=
kHCalOutTemplateClusterizer
;
66
//enu_HCalOut_clusterizer HCalOut_clusterizer = kHCalOutGraphClusterizer;
67
}
// namespace G4HCALOUT
68
69
// Init is called by G4Setup.C
70
void
HCalOuterInit
()
71
{
72
BlackHoleGeometry::max_radius
=
std::max
(
BlackHoleGeometry::max_radius
,
G4HCALOUT::outer_radius
);
73
BlackHoleGeometry::max_z
=
std::max
(
BlackHoleGeometry::max_z
,
G4HCALOUT::size_z
/ 2.);
74
BlackHoleGeometry::min_z
=
std::min
(
BlackHoleGeometry::min_z
, -
G4HCALOUT::size_z
/ 2.);
75
}
76
77
double
HCalOuter
(
PHG4Reco
*g4Reco,
78
double
radius
,
79
const
int
crossings)
80
{
81
bool
AbsorberActive =
Enable::ABSORBER
||
Enable::HCALOUT_ABSORBER
;
82
bool
OverlapCheck =
Enable::OVERLAPCHECK
||
Enable::HCALOUT_OVERLAPCHECK
;
83
int
verbosity =
std::max
(
Enable::VERBOSITY
,
Enable::HCALOUT_VERBOSITY
);
84
85
PHG4OuterHcalSubsystem
*
hcal
=
new
PHG4OuterHcalSubsystem
(
"HCALOUT"
);
86
// hcal->set_double_param("inner_radius", 183.3);
87
//-----------------------------------------
88
// the light correction can be set in a single call
89
// hcal->set_double_param("light_balance_inner_corr", NAN);
90
// hcal->set_double_param("light_balance_inner_radius", NAN);
91
// hcal->set_double_param("light_balance_outer_corr", NAN);
92
// hcal->set_double_param("light_balance_outer_radius", NAN);
93
// hcal->set_double_param("magnet_cutout_radius", 195.31);
94
// hcal->set_double_param("magnet_cutout_scinti_radius", 195.96);
95
// hcal->SetLightCorrection(NAN,NAN,NAN,NAN);
96
//-----------------------------------------
97
// hcal->set_double_param("outer_radius", G4HCALOUT::outer_radius);
98
// hcal->set_double_param("place_x", 0.);
99
// hcal->set_double_param("place_y", 0.);
100
// hcal->set_double_param("place_z", 0.);
101
// hcal->set_double_param("rot_x", 0.);
102
// hcal->set_double_param("rot_y", 0.);
103
// hcal->set_double_param("rot_z", 0.);
104
// hcal->set_double_param("scinti_eta_coverage", 1.1);
105
// hcal->set_double_param("scinti_gap", 0.85);
106
// hcal->set_double_param("scinti_gap_neighbor", 0.1);
107
// hcal->set_double_param("scinti_inner_radius",183.89);
108
// hcal->set_double_param("scinti_outer_radius",263.27);
109
// hcal->set_double_param("scinti_tile_thickness", 0.7);
110
// hcal->set_double_param("size_z", G4HCALOUT::size_z);
111
// hcal->set_double_param("steplimits", NAN);
112
// hcal->set_double_param("tilt_angle", -11.23);
113
114
// hcal->set_int_param("light_scint_model", 1);
115
// hcal->set_int_param("magnet_cutout_first_scinti", 8);
116
// hcal->set_int_param("ncross", 0);
117
// hcal->set_int_param("n_towers", 64);
118
// hcal->set_int_param("n_scinti_plates_per_tower", 5);
119
// hcal->set_int_param("n_scinti_tiles", 12);
120
121
// hcal->set_string_param("material", "Steel_1006");
122
123
hcal->
SetActive
();
124
hcal->
SuperDetector
(
"HCALOUT"
);
125
if
(AbsorberActive)
126
{
127
hcal->
SetAbsorberActive
();
128
}
129
hcal->
OverlapCheck
(OverlapCheck);
130
g4Reco->
registerSubsystem
(hcal);
131
132
radius = hcal->
get_double_param
(
"outer_radius"
);
133
134
radius +=
no_overlapp
;
135
136
return
radius
;
137
}
138
139
void
HCALOuter_Cells
()
140
{
141
int
verbosity =
std::max
(
Enable::VERBOSITY
,
Enable::HCALOUT_VERBOSITY
);
142
143
Fun4AllServer
*se =
Fun4AllServer::instance
();
144
145
PHG4HcalCellReco
*hc =
new
PHG4HcalCellReco
(
"HCALOUT_CELLRECO"
);
146
hc->
Detector
(
"HCALOUT"
);
147
// hc->Verbosity(2);
148
// check for energy conservation - needs modified "infinite" timing cuts
149
// 0-999999999
150
// hc->checkenergy();
151
// timing cuts with their default settings
152
// hc->set_double_param("tmin",0.);
153
// hc->set_double_param("tmax",60.0);
154
// or all at once:
155
// hc->set_timing_window(0.0,60.0);
156
// this sets all cells to a fixed energy for debugging
157
// hc->set_fixed_energy(1.);
158
se->
registerSubsystem
(hc);
159
160
return
;
161
}
162
163
void
HCALOuter_Towers
()
164
{
165
int
verbosity =
std::max
(
Enable::VERBOSITY
,
Enable::HCALOUT_VERBOSITY
);
166
167
Fun4AllServer
*se =
Fun4AllServer::instance
();
168
169
HcalRawTowerBuilder
*TowerBuilder =
new
HcalRawTowerBuilder
(
"HcalOutRawTowerBuilder"
);
170
TowerBuilder->
Detector
(
"HCALOUT"
);
171
TowerBuilder->
set_sim_tower_node_prefix
(
"SIM"
);
172
// this sets specific decalibration factors
173
// for a given cell
174
// TowerBuilder->set_cell_decal_factor(1,10,0.1);
175
// for a whole tower
176
// TowerBuilder->set_tower_decal_factor(0,10,0.2);
177
// TowerBuilder->set_cell_decal_factor(1,10,0.1);
178
// TowerBuilder->set_tower_decal_factor(0,10,0.2);
179
TowerBuilder->
Verbosity
(verbosity);
180
se->
registerSubsystem
(TowerBuilder);
181
182
// From 2016 Test beam sim
183
RawTowerDigitizer
*TowerDigitizer =
new
RawTowerDigitizer
(
"HcalOutRawTowerDigitizer"
);
184
TowerDigitizer->
Detector
(
"HCALOUT"
);
185
// TowerDigitizer->set_raw_tower_node_prefix("RAW_LG");
186
TowerDigitizer->
set_digi_algorithm
(
G4HCALOUT::TowerDigi
);
187
TowerDigitizer->
set_pedstal_central_ADC
(0);
188
TowerDigitizer->
set_pedstal_width_ADC
(1);
// From Jin's guess. No EMCal High Gain data yet! TODO: update
189
TowerDigitizer->
set_photonelec_ADC
(16. / 5.);
190
TowerDigitizer->
set_photonelec_yield_visible_GeV
(16. / 5 / (0.2
e
-3));
191
TowerDigitizer->
set_zero_suppression_ADC
(-0);
// no-zero suppression
192
se->
registerSubsystem
(TowerDigitizer);
193
194
const
double
visible_sample_fraction_HCALOUT = 3.38021e-02;
// /gpfs/mnt/gpfs04/sphenix/user/jinhuang/prod_analysis/hadron_shower_res_nightly/./G4Hits_sPHENIX_pi-_eta0_16GeV.root_qa.rootQA_Draw_HCALOUT_G4Hit.pdf
195
196
RawTowerCalibration
*TowerCalibration =
new
RawTowerCalibration
(
"HcalOutRawTowerCalibration"
);
197
TowerCalibration->
Detector
(
"HCALOUT"
);
198
// TowerCalibration->set_raw_tower_node_prefix("RAW_LG");
199
// TowerCalibration->set_calib_tower_node_prefix("CALIB_LG");
200
TowerCalibration->
set_calib_algorithm
(
RawTowerCalibration::kSimple_linear_calibration
);
201
if
(
G4HCALOUT::TowerDigi
==
RawTowerDigitizer::kNo_digitization
)
202
{
203
// 0.033 extracted from electron sims (edep(scintillator)/edep(total))
204
TowerCalibration->
set_calib_const_GeV_ADC
(1. / 0.033);
205
}
206
else
207
{
208
TowerCalibration->
set_calib_const_GeV_ADC
(0.2
e
-3 / visible_sample_fraction_HCALOUT);
209
}
210
TowerCalibration->
set_pedstal_ADC
(0);
211
se->
registerSubsystem
(TowerCalibration);
212
213
return
;
214
}
215
216
void
HCALOuter_Clusters
()
217
{
218
int
verbosity =
std::max
(
Enable::VERBOSITY
,
Enable::HCALOUT_VERBOSITY
);
219
220
Fun4AllServer
*se =
Fun4AllServer::instance
();
221
222
if
(
G4HCALOUT::HCalOut_clusterizer
==
G4HCALOUT::kHCalOutTemplateClusterizer
)
223
{
224
RawClusterBuilderTemplate
*ClusterBuilder =
new
RawClusterBuilderTemplate
(
"HcalOutRawClusterBuilderTemplate"
);
225
ClusterBuilder->
Detector
(
"HCALOUT"
);
226
ClusterBuilder->
SetCylindricalGeometry
();
// has to be called after Detector()
227
ClusterBuilder->
Verbosity
(verbosity);
228
se->
registerSubsystem
(ClusterBuilder);
229
}
230
else
if
(
G4HCALOUT::HCalOut_clusterizer
==
G4HCALOUT::kHCalOutGraphClusterizer
)
231
{
232
RawClusterBuilderGraph
*ClusterBuilder =
new
RawClusterBuilderGraph
(
"HcalOutRawClusterBuilderGraph"
);
233
ClusterBuilder->
Detector
(
"HCALOUT"
);
234
ClusterBuilder->
Verbosity
(verbosity);
235
se->
registerSubsystem
(ClusterBuilder);
236
}
237
else
238
{
239
cout <<
"HCALOuter_Clusters - unknown clusterizer setting!"
<< endl;
240
exit
(1);
241
}
242
243
return
;
244
}
245
246
void
HCALOuter_Eval
(
const
std::string &
outputfile
)
247
{
248
int
verbosity =
std::max
(
Enable::VERBOSITY
,
Enable::HCALOUT_VERBOSITY
);
249
250
Fun4AllServer
*se =
Fun4AllServer::instance
();
251
252
CaloEvaluator
*eval =
new
CaloEvaluator
(
"HCALOUTEVALUATOR"
,
"HCALOUT"
, outputfile);
253
eval->
Verbosity
(verbosity);
254
se->
registerSubsystem
(eval);
255
256
return
;
257
}
258
259
void
HCALOuter_QA
()
260
{
261
int
verbosity =
std::max
(
Enable::QA_VERBOSITY
,
Enable::HCALOUT_VERBOSITY
);
262
263
Fun4AllServer
*se =
Fun4AllServer::instance
();
264
QAG4SimulationCalorimeter
*qa =
new
QAG4SimulationCalorimeter
(
"HCALOUT"
);
265
qa->
Verbosity
(verbosity);
266
se->
registerSubsystem
(qa);
267
268
return
;
269
}
270
271
#endif
fun4all_eic_qa
blob
master
macros
G4_HcalOut_ref.C
Built by
Jin Huang
. updated:
Mon Jan 22 2024 12:43:51
using
1.8.2 with
EIC GitHub integration