method to perform the correction.
The correction type is defined by the tool which also uses this interface. In some cases, the tool needs more than the cluster to perform the calibration. This can be passed via the void pointer
44 {
45
50
51 float the_aeta = (clus->
eta());
52
53 the_aeta = (the_aeta>0)?(the_aeta):(- the_aeta);
54
55 if (the_aeta >= etamax) return;
56
57#ifndef NDEBUG
58 ATH_MSG_DEBUG(
"************************************************************************************************" );
60 ATH_MSG_DEBUG(
"************************************************************************************************" );
61#endif
62 int si;
63 if (the_aeta < eta_start_crack)
64 si = 0;
65 else if (the_aeta > eta_end_crack)
66 si = 1;
67 else {
68
69 return;
70 }
71
72
73 int ibin = (static_cast<int> (the_aeta / etamax * 100));
74 int ibin_frontCorr = ibin;
76 if ( the_aeta>2.35)
77 ibin_frontCorr = (static_cast<int> (235. / etamax ));
78 }
79
80#ifndef NDEBUG
81 ATH_MSG_DEBUG(
"Check etas -------------------------------------------------------------------" );
82 ATH_MSG_DEBUG(
"Eta --> " << the_aeta <<
" Bin --> " << ibin <<
" Cluster eta = " << clus->
eta() );
83
84 ATH_MSG_DEBUG(
"Check calibration coefficients -----------------------------------------------" );
85 ATH_MSG_DEBUG(
"Accordion : " << correction[0][ibin][0] <<
" " << correction[0][ibin][1] <<
" " << correction[0][ibin][2] <<
" " << correction[0][ibin][3] );
86 ATH_MSG_DEBUG(
"OutOfCOne : " << correction[1][ibin][0] <<
" " << correction[1][ibin][1] <<
" " << correction[1][ibin][2] <<
" " << correction[1][ibin][3] );
87 ATH_MSG_DEBUG(
"Leakage : " << correction[2][ibin][0] <<
" " << correction[2][ibin][1] <<
" " << correction[2][ibin][2] <<
" " << correction[2][ibin][3] );
88 ATH_MSG_DEBUG(
"Front offset: " << correction[3][ibin_frontCorr][0] <<
" " <<correction[3][ibin_frontCorr][1] <<
" " << correction[3][ibin_frontCorr][2] <<
" " << correction[3][ibin_frontCorr][3] );
89 ATH_MSG_DEBUG(
"Front Slope : " << correction[4][ibin_frontCorr][0] <<
" " << correction[4][ibin_frontCorr][1] <<
" " << correction[4][ibin_frontCorr][2] <<
" " << correction[4][ibin_frontCorr][3] );
90 ATH_MSG_DEBUG(
"Second order: " << correction[5][ibin_frontCorr][0] <<
" " << correction[5][ibin_frontCorr][1] <<
" " << correction[5][ibin_frontCorr][2] <<
" " << correction[5][ibin_frontCorr][3] );
91#endif
92
93 EgammaHitsShowerDepth showerDepth;
94 float shower_lbary = showerDepth.
depth(the_aeta,
95 eta_start_crack,
96 eta_end_crack,
98 etamax,
99 clus);
100 if (!shower_lbary)
101 return;
102
103 if (shower_lbary < 5. || shower_lbary > 25.){
104 shower_lbary = 15.;
105#ifndef NDEBUG
107#endif
108 }
109
110
111
112
113 float eacc_base = 0;
114 for (int sampling=1; sampling<4; sampling++) {
116#ifndef NDEBUG
118#endif
119 }
121
122#ifndef NDEBUG
123 ATH_MSG_DEBUG(
"E accordion base --->>>> " << eacc_base <<
" Eps base " << eps_base );
124#endif
125
126
127
128
129
130
131 float depth_max = 20. + 3. * (eacc_base+eps_base) * 1e-6;
132#ifndef NDEBUG
133 ATH_MSG_DEBUG(
"Raw energy ---->> " << (eacc_base+eps_base) );
134 ATH_MSG_DEBUG(
"Bary max for this event ---->> " << depth_max );
135#endif
136
137 if ( shower_lbary > depth_max ) {
138 shower_lbary = 15.;
139
140#ifndef NDEBUG
142#endif
143 }
144
145
146
147
149
150 float e_out_perc = 0;
151 if (the_aeta < eta_start_crack) {
153 }
154 else {
156 }
157
158 float e_acc_reco=acc_corr*(eacc_base )*(1+(e_out_perc)/100);
159
160
161
162
163
164 float e_leak_perc = 0;
166
167 if (e_leak_perc < 0 ) e_leak_perc = 0.;
168 if (e_leak_perc > 100.) e_leak_perc = 100.;
169 float e_leak_reco = e_leak_perc * (e_acc_reco)/100;
170
171
172
173
174
175 float raw_energy=e_acc_reco*.001;
176 float e_front_reco = eps_base;
177
178 if (raw_energy <= 1) {
179
180
181 }
182 else if (the_aeta < 1.8) {
183
184 if (the_aeta < eta_start_crack) {
185 float WpsOff =
correction[3][ibin_frontCorr][1] +
correction[3][ibin_frontCorr][2] * raw_energy +
correction[3][ibin_frontCorr][3] * raw_energy * raw_energy;
186 float WpsSlo =
correction[4][ibin_frontCorr][1] *
pow(
log(raw_energy),correction[4][ibin_frontCorr][2]) +
correction[4][ibin_frontCorr][3] *sqrt( raw_energy );
187 e_front_reco=WpsOff + WpsSlo*(eps_base);
188
189#ifndef NDEBUG
191 ATH_MSG_DEBUG(
" froffset coeff " << correction[3][ibin_frontCorr][1] <<
" " << correction[3][ibin_frontCorr][2] <<
" " << correction[3][ibin_frontCorr][3] );
192 ATH_MSG_DEBUG(
" frslope coeff " << correction[4][ibin_frontCorr][1] <<
" " << correction[4][ibin_frontCorr][2] <<
" " << correction[4][ibin_frontCorr][3] );
193 ATH_MSG_DEBUG(
" WpsOff,WpsSlo " << WpsOff <<
" " << WpsSlo );
194 ATH_MSG_DEBUG(
" eps_base, efront_reco " << eps_base <<
" " << e_front_reco );
195#endif
196 }
197 else{
198
199
200 if (raw_energy<20.) raw_energy=20.;
201
202 float WpsOff =
correction[3][ibin_frontCorr][1] +
correction[3][ibin_frontCorr][2] * raw_energy +
correction[3][ibin_frontCorr][3] * sqrt(raw_energy);
204 float WpsSlo2 =
correction[5][ibin_frontCorr][1] +
correction[5][ibin_frontCorr][2] * raw_energy -
correction[5][ibin_frontCorr][3] / (raw_energy * raw_energy) ;
205 e_front_reco=WpsOff + WpsSlo*(eps_base) + WpsSlo2*(eps_base)*(eps_base);
206 if (e_front_reco<0.) e_front_reco= eps_base;
207#ifndef NDEBUG
209 ATH_MSG_DEBUG(
"p1 " << correction[3][ibin_frontCorr][1] <<
" " << correction[3][ibin_frontCorr][2] <<
" " << correction[3][ibin_frontCorr][3] <<
" " << WpsOff );
210 ATH_MSG_DEBUG(
"p2 " << correction[4][ibin_frontCorr][1] <<
" " << correction[4][ibin_frontCorr][2] <<
" " << correction[4][ibin_frontCorr][3] <<
" " << WpsSlo );
211 ATH_MSG_DEBUG(
"p3 " << correction[5][ibin_frontCorr][1] <<
" " << correction[5][ibin_frontCorr][2] <<
" " << correction[5][ibin_frontCorr][3] <<
" " << WpsSlo2 );
212 ATH_MSG_DEBUG(
" WpsOff, WpsSlo, WpsSlo2 " << WpsOff <<
" " << WpsSlo <<
" " << WpsSlo2 );
213 ATH_MSG_DEBUG(
" eps_base, efront_reco " << eps_base <<
" " << e_front_reco );
214#endif
215
216 }
217
218 }
219 else {
223
224#ifndef NDEBUG
225 ATH_MSG_DEBUG(
"p1 " << correction[3][ibin_frontCorr][1] <<
" " << correction[3][ibin_frontCorr][2] <<
" " << correction[3][ibin_frontCorr][3] );
226 ATH_MSG_DEBUG(
"p2 " << correction[4][ibin_frontCorr][1] <<
" " << correction[4][ibin_frontCorr][2] <<
" " << correction[4][ibin_frontCorr][3] );
227 ATH_MSG_DEBUG(
"p3 " << correction[5][ibin_frontCorr][1] <<
" " << correction[5][ibin_frontCorr][2] <<
" " << correction[5][ibin_frontCorr][3] );
228#endif
229
230 e_front_reco= (
p1 +
p2 * shower_lbary +
p3 * shower_lbary * shower_lbary);
231 if (e_front_reco<0.) e_front_reco=eps_base;
232 }
233
234
235
236
237
238 float e_calo_reco =e_front_reco + e_leak_reco + e_acc_reco;
239
240#ifndef NDEBUG
241 ATH_MSG_DEBUG(
"CaloSwCalibrationHits::Final reco energy ---------------------- " << e_calo_reco );
242 ATH_MSG_DEBUG(
"CaloSwCalibrationHits::Front ---------------------- " << e_front_reco );
243 ATH_MSG_DEBUG(
"CaloSwCalibrationHits::Accordion ------------------ " << e_acc_reco );
244 ATH_MSG_DEBUG(
"CaloSwCalibrationHits::out of cone ---------------- " << acc_corr*(eacc_base )*(e_out_perc)/100 );
245 ATH_MSG_DEBUG(
"CaloSwCalibrationHits::Leakage -------------------- " << e_leak_reco );
246#endif
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
266
267
268 for (int sampling=1; sampling<=2; sampling++){
270 }
271
272
274
275#ifndef NDEBUG
276
277 float e_temp = 0;
279 ATH_MSG_DEBUG(
"---------- Sum of the sampling energy --- >> " << e_temp <<
" EcaloReco = " << e_calo_reco );
280 ATH_MSG_DEBUG(
"CaloSwCalibHitsCalibration Energy after correction --> " << clus->
energy() );
281#endif
282
284
286
287}
constexpr int pow(int base, int exp) noexcept
Constant< float > m_eta_end_crack
Constant< float > m_etamax
Constant< CxxUtils::Array< 3 > > m_correction
Constant< bool > m_fix_v6_pathologies
Constant< float > m_eta_start_crack
Constant< CxxUtils::Array< 2 > > m_sampling_depth
static const CaloSampling::CaloSample m_samps[2][4]
float depth(const float &aeta, const float start_crack, const float end_crack, const CxxUtils::Array< 2 > &sampling_depth, const float etamax, const xAOD::TrigEMCluster *cluster) const
Calculate the depth of the cluster.
void setEt(float)
set Et (calibrated)
float eta() const
get Eta (calibrated)
void setEnergy(float energy)
set Energy (calibrated)
float energy() const
get Energy (calibrated)