ATLAS Offline Software
Loading...
Searching...
No Matches
egammaMVAFunctions.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
4
5
7
8#ifndef XAOD_STANDALONE
9#include "GaudiKernel/SystemOfUnits.h"
10using Gaudi::Units::GeV;
11#else
12#define GeV 1000
13#endif
14
15#include <numbers>
16
20
21namespace egammaMVAFunctions
22{
23
24 // forward declarations
25 void initializeClusterFuncs(funcMap_t& funcLibrary,
26 const std::string& prefix,
27 bool useLayerCorrected);
28
29 void initializeEgammaFuncs(funcMap_t& funcLibrary,
30 const std::string& prefix,
31 bool useLayerCorrected);
32
34 std::unique_ptr<funcMap_t> initializeElectronFuncs(bool useLayerCorrected)
35 {
36 // rel21 uses a naming version of some variables without prefix, keep both for compatibility
37 auto funcLibraryPtr = std::make_unique<funcMap_t>();
38 funcMap_t& funcLibrary = *funcLibraryPtr;
39
40 initializeClusterFuncs(funcLibrary, "el", useLayerCorrected);
41 initializeEgammaFuncs(funcLibrary, "el", useLayerCorrected);
42
43 // specific functions only for electrons
44 funcLibrary["el_charge"] = [](const xAOD::Egamma* eg, const xAOD::CaloCluster*)
45 { return compute_el_charge(*(static_cast<const xAOD::Electron*>(eg))); };
46 funcLibrary["el_tracketa"] = [](const xAOD::Egamma* eg, const xAOD::CaloCluster*)
47 { return compute_el_tracketa(*(static_cast<const xAOD::Electron*>(eg))); };
48 funcLibrary["el_trackpt"] = [](const xAOD::Egamma* eg, const xAOD::CaloCluster*)
49 { return compute_el_trackpt(*(static_cast<const xAOD::Electron*>(eg))); };
50 funcLibrary["el_trackz0"] = [](const xAOD::Egamma* eg, const xAOD::CaloCluster*)
51 { return compute_el_trackz0(*(static_cast<const xAOD::Electron*>(eg))); };
52 funcLibrary["el_refittedTrack_qoverp"] = [](const xAOD::Egamma* eg, const xAOD::CaloCluster*)
53 { return compute_el_refittedTrack_qoverp(*(static_cast<const xAOD::Electron*>(eg))); };
54
55 return funcLibraryPtr;
56 }
57
59 std::unique_ptr<funcMap_t> initializeUnconvertedPhotonFuncs(bool useLayerCorrected)
60 {
61 auto funcLibraryPtr = std::make_unique<funcMap_t>();
62 funcMap_t& funcLibrary = *funcLibraryPtr;
63
64 initializeClusterFuncs(funcLibrary, "ph", useLayerCorrected);
65 initializeEgammaFuncs(funcLibrary, "ph", useLayerCorrected);
66
67 return funcLibraryPtr;
68 }
69
70
72 std::unique_ptr<funcMap_t> initializeConvertedPhotonFuncs(bool useLayerCorrected)
73 {
74 auto funcLibraryPtr = std::make_unique<funcMap_t>();
75 funcMap_t& funcLibrary = *funcLibraryPtr;
76
77 initializeClusterFuncs(funcLibrary, "ph", useLayerCorrected);
78 initializeEgammaFuncs(funcLibrary, "ph", useLayerCorrected);
79
80
81 funcLibrary["ph_Rconv"] = [](const xAOD::Egamma* eg, const xAOD::CaloCluster*)->float
82 { return xAOD::EgammaHelpers::conversionRadius(static_cast<const xAOD::Photon*>(eg)); };
83
84 funcLibrary["ph_convR"] = funcLibrary["convR"] = [](const xAOD::Egamma* eg, const xAOD::CaloCluster*)->float
85 {
86 const auto *ph = static_cast<const xAOD::Photon*>(eg);
87 if (compute_ptconv(ph) > 3*GeV) {
89 }
90 return 799.0;
91
92 };
93 funcLibrary["ph_zconv"] = [](const xAOD::Egamma* eg, const xAOD::CaloCluster*)
94 {
95 const auto *vertex = static_cast<const xAOD::Photon*>(eg)->vertex();
96 return vertex ? vertex->position().z() : 9999;
97 };
98 funcLibrary["ph_pt1conv"] = [](const xAOD::Egamma* eg, const xAOD::CaloCluster*)->float
99 { return compute_pt1conv(static_cast<const xAOD::Photon*>(eg)); };
100 funcLibrary["ph_pt2conv"] = [](const xAOD::Egamma* eg, const xAOD::CaloCluster*)->float
101 { return compute_pt2conv(static_cast<const xAOD::Photon*>(eg)); };
102 funcLibrary["ph_ptconv"] = [](const xAOD::Egamma* eg, const xAOD::CaloCluster*)
103 { return compute_ptconv(static_cast<const xAOD::Photon*>(eg)); };
104
105 funcLibrary["ph_convPtRatio"] = funcLibrary["convPtRatio"] = [](const xAOD::Egamma* eg, const xAOD::CaloCluster*)->float
106 {
107 const auto *ph = static_cast<const xAOD::Photon*>(eg);
109 auto pt1 = compute_pt1conv(ph);
110 auto pt2 = compute_pt2conv(ph);
111 return std::max(pt1, pt2)/(pt1+pt2);
112 }
113 return 1.0f;
114 };
115
116 if (useLayerCorrected) {
117 funcLibrary["ph_convEtOverPt"] = funcLibrary["convEtOverPt"] = [](const xAOD::Egamma* eg, const xAOD::CaloCluster*cl)->float
118 {
119 const auto *ph = static_cast<const xAOD::Photon*>(eg);
120
121 float rv = 0.0;
123 rv = std::max(0.0f, compute_correctedcl_Eacc(*cl)/(std::cosh(compute_cl_eta(*cl))*compute_ptconv(ph)));
124 }
125 return std::min(rv, 2.0f);
126 };
127 } else {
128 funcLibrary["ph_convEtOverPt"] = funcLibrary["convEtOverPt"] = [](const xAOD::Egamma* eg, const xAOD::CaloCluster*cl)->float
129 {
130 const auto *ph = static_cast<const xAOD::Photon*>(eg);
131
132 float rv = 0.0;
134 rv = std::max(0.0f, compute_rawcl_Eacc(*cl)/(std::cosh(compute_cl_eta(*cl))*compute_ptconv(ph)));
135 }
136 return std::min(rv, 2.0f);
137 };
138 }
139
140 return funcLibraryPtr;
141 }
142
143 std::unique_ptr<funcMap_t> initializeForwardElectronFuncs(bool useLayerCorrected) {
144 auto funcLibraryPtr = std::make_unique<funcMap_t>();
145 funcMap_t& funcLibrary = *funcLibraryPtr;
146
147 funcLibrary["el_cl_e"] = [](const xAOD::Egamma*, const xAOD::CaloCluster* cl)
148 { return compute_cl_e(*cl); };
149 funcLibrary["abs_el_cl_eta"] = [](const xAOD::Egamma*, const xAOD::CaloCluster* cl)
150 { return std::abs(compute_cl_eta(*cl)); };
151 funcLibrary["etaModCalo"] = [](const xAOD::Egamma*, const xAOD::CaloCluster* cl)
152 { return (std::abs(cl->eta()) < 3.15 ? compute_etaMod_EMEC(*cl) : compute_etaMod_FCAL(*cl)); };
153 funcLibrary["cellIndex"] = [](const xAOD::Egamma*, const xAOD::CaloCluster* cl)
154 { return (std::abs(cl->eta()) < 3.15 ? compute_cellIndex_EMEC(*cl) : compute_cellIndex_FCAL(*cl)); };
155 funcLibrary["el_cl_phi"] = [](const xAOD::Egamma*, const xAOD::CaloCluster* cl)
156 { return compute_cl_phi(*cl); };
157 funcLibrary["phiMod2pi32"] = [](const xAOD::Egamma*, const xAOD::CaloCluster* cl)
158 { return compute_phiMod_EMEC(*cl); };
159 if (useLayerCorrected) {
160 funcLibrary["el_cl_secondR"] = [](const xAOD::Egamma* eg, const xAOD::CaloCluster*)
161 { return compute_cl_secondR_fudge(*eg); };
162 } else {
163 funcLibrary["el_cl_secondR"] = [](const xAOD::Egamma*, const xAOD::CaloCluster* cl)
164 { return compute_cl_secondR(*cl); };
165 }
166 funcLibrary["Es1Es2Ratio"] = [](const xAOD::Egamma*, const xAOD::CaloCluster* cl)
167 { return compute_R12_EMEC(*cl); };
168 funcLibrary["el_cl_centerX"] = [](const xAOD::Egamma*, const xAOD::CaloCluster* cl)
169 { return compute_cl_x(*cl); };
170 funcLibrary["el_cl_centerY"] = [](const xAOD::Egamma*, const xAOD::CaloCluster* cl)
171 { return compute_cl_y(*cl); };
172 funcLibrary["abs_el_cl_centerZ"] = [](const xAOD::Egamma*, const xAOD::CaloCluster* cl)
173 { return std::abs(compute_cl_z(*cl)); };
174 funcLibrary["el_cl_centerLambda"] = [](const xAOD::Egamma*, const xAOD::CaloCluster* cl)
175 { return compute_cl_centerLambda(*cl); };
176 funcLibrary["el_cl_secondMoment"] = [](const xAOD::Egamma*, const xAOD::CaloCluster* cl)
177 { return compute_cl_secondDensity(*cl); };
178
179 return funcLibraryPtr;
180 }
181
182
183 // Initialize the functions that just depend on the cluster.
184 // This helper function is not meant for external use.
186 const std::string& prefix,
187 bool useLayerCorrected)
188 {
189
190 funcLibrary[prefix + "_cl_eta"] = [](const xAOD::Egamma*, const xAOD::CaloCluster* cl)
191 { return compute_cl_eta(*cl); };
192 funcLibrary[prefix + "_cl_phi"] = [](const xAOD::Egamma*, const xAOD::CaloCluster* cl)
193 { return compute_cl_phi(*cl); };
194 funcLibrary[prefix + "_cl_E"] = [](const xAOD::Egamma*, const xAOD::CaloCluster* cl)
195 { return compute_cl_e(*cl); };
196 funcLibrary[prefix + "_cl_etaCalo"] = [](const xAOD::Egamma*, const xAOD::CaloCluster* cl)
197 { return compute_cl_etaCalo(*cl); };
198 funcLibrary[prefix + "_cl_phiCalo"] = [](const xAOD::Egamma*, const xAOD::CaloCluster* cl)
199 { return compute_cl_phiCalo(*cl); };
200 funcLibrary[prefix + "_cl_E_TileGap3"] = [](const xAOD::Egamma*, const xAOD::CaloCluster* cl)
201 { return cl->eSample(CaloSampling::TileGap3); };
202
203 funcLibrary[prefix + "_cellIndexCalo"] = funcLibrary["cellIndexCalo"] = [](const xAOD::Egamma*, const xAOD::CaloCluster* cl)
204 { return std::floor(std::abs(compute_cl_etaCalo(*cl))/0.025); };
205 funcLibrary[prefix + "_phiModCalo"] = funcLibrary["phiModCalo"] = [](const xAOD::Egamma*, const xAOD::CaloCluster* cl)
206 { return ((abs(compute_cl_eta(*cl)) < 1.425) ?
207 std::fmod(compute_cl_phiCalo(*cl), TMath::Pi() / 512) :
208 std::fmod(compute_cl_phiCalo(*cl), TMath::Pi() / 384));
209 };
210
211 // improved version of phiModCalo, proposed by G. Unal, studied by L. Nasella
212 // see https://its.cern.ch/jira/browse/ATLASEG-325
213 // see https://indico.cern.ch/event/1364593/contributions/5843081/
214 funcLibrary[prefix + "_phiModCalo1"] = funcLibrary["phiModCalo1"] =
215 [](const xAOD::Egamma*, const xAOD::CaloCluster* cl) {
216 using std::numbers::pi;
217 const double eta = compute_cl_eta(*cl);
218 const double phi = compute_cl_phiCalo(*cl);
219 const double pi_divisor = std::abs(eta) < 1.425 ? 512. : 384.;
220
221 if (eta > 0.) {
222 if (phi > 0.) return std::fmod(phi, pi / pi_divisor);
223 else return std::fmod((2 * pi + phi), pi / pi_divisor);
224 }
225 else return std::fmod((pi - phi), pi / pi_divisor);
226 };
227
228 funcLibrary[prefix + "_phiModCell"] = funcLibrary["phiModCell"] = [](const xAOD::Egamma*, const xAOD::CaloCluster* cl)
229 { return std::fmod(std::abs(compute_cl_phiCalo(*cl)), TMath::Pi() / 128); };
230 funcLibrary[prefix + "_etaModCalo"] = funcLibrary["etaModCalo"] = [](const xAOD::Egamma*, const xAOD::CaloCluster* cl)
231 { return std::fmod(std::abs(compute_cl_etaCalo(*cl)), 0.025); };
232 funcLibrary["abs(" + prefix + "_cl_eta)"] = [](const xAOD::Egamma*, const xAOD::CaloCluster* cl)
233 { return std::abs(compute_cl_eta(*cl)); };
234 funcLibrary[prefix + "_dPhiTG3"] = funcLibrary["dPhiTG3"] = [](const xAOD::Egamma*, const xAOD::CaloCluster* cl)
235 { return std::fmod(2.*TMath::Pi()+compute_cl_phi(*cl),TMath::Pi()/32.)-TMath::Pi()/64.0; };
236
237 if (useLayerCorrected) {
238 funcLibrary[prefix + "_rawcl_Es0"] = [](const xAOD::Egamma*, const xAOD::CaloCluster* cl)
239 { return compute_correctedcl_Es0(*cl); };
240 funcLibrary[prefix + "_rawcl_Es1"] = [](const xAOD::Egamma*, const xAOD::CaloCluster* cl)
241 { return compute_correctedcl_Es1(*cl); };
242 funcLibrary[prefix + "_rawcl_Es2"] = [](const xAOD::Egamma*, const xAOD::CaloCluster* cl)
243 { return compute_correctedcl_Es2(*cl); };
244 funcLibrary[prefix + "_rawcl_Es3"] = [](const xAOD::Egamma*, const xAOD::CaloCluster* cl)
245 { return compute_correctedcl_Es3(*cl); };
246 funcLibrary[prefix + "_rawcl_Eacc"] = [](const xAOD::Egamma*, const xAOD::CaloCluster* cl)
247 { return compute_correctedcl_Eacc(*cl); };
248 funcLibrary[prefix + "_rawcl_f0"] = [](const xAOD::Egamma*, const xAOD::CaloCluster* cl)
249 { return compute_correctedcl_f0(*cl); };
250 funcLibrary[prefix + "_rawcl_calibHitsShowerDepth"] = [](const xAOD::Egamma*, const xAOD::CaloCluster* cl)
252 funcLibrary[prefix + "_R12"] = funcLibrary["R12"] = [](const xAOD::Egamma*, const xAOD::CaloCluster* cl)
254 funcLibrary[prefix + "_fTG3"] = funcLibrary["fTG3"] = [](const xAOD::Egamma*, const xAOD::CaloCluster* cl)
255 { return cl->eSample(CaloSampling::TileGap3)/compute_correctedcl_Eacc(*cl); };
256 } else {
257 funcLibrary[prefix + "_rawcl_Es0"] = [](const xAOD::Egamma*, const xAOD::CaloCluster* cl)
258 { return compute_rawcl_Es0(*cl); };
259 funcLibrary[prefix + "_rawcl_Es1"] = [](const xAOD::Egamma*, const xAOD::CaloCluster* cl)
260 { return compute_rawcl_Es1(*cl); };
261 funcLibrary[prefix + "_rawcl_Es2"] = [](const xAOD::Egamma*, const xAOD::CaloCluster* cl)
262 { return compute_rawcl_Es2(*cl); };
263 funcLibrary[prefix + "_rawcl_Es3"] = [](const xAOD::Egamma*, const xAOD::CaloCluster* cl)
264 { return compute_rawcl_Es3(*cl); };
265 funcLibrary[prefix + "_rawcl_Eacc"] = [](const xAOD::Egamma*, const xAOD::CaloCluster* cl)
266 { return compute_rawcl_Eacc(*cl); };
267 funcLibrary[prefix + "_rawcl_f0"] = [](const xAOD::Egamma*, const xAOD::CaloCluster* cl)
268 { return compute_rawcl_f0(*cl); };
269 funcLibrary[prefix + "_rawcl_calibHitsShowerDepth"] = [](const xAOD::Egamma*, const xAOD::CaloCluster* cl)
270 { return compute_rawcl_calibHitsShowerDepth(*cl); };
271 funcLibrary[prefix + "_R12"] = funcLibrary["R12"] = [](const xAOD::Egamma*, const xAOD::CaloCluster* cl)
272 { return compute_rawcl_Es1(*cl)/compute_rawcl_Es2(*cl); };
273 funcLibrary[prefix + "_fTG3"] = funcLibrary["fTG3"] = [](const xAOD::Egamma*, const xAOD::CaloCluster* cl)
274 { return cl->eSample(CaloSampling::TileGap3)/compute_rawcl_Eacc(*cl); };
275 }
276 }
277
278 // Initialize the variables that just depend on egamma.
279 // This helper function is not meant for external use.
281 const std::string& prefix,
282 bool /* useLayerCorrected */)
283 {
284 funcLibrary[prefix + "_e011"] = [](const xAOD::Egamma* eg, const xAOD::CaloCluster*)
285 { return eg->showerShapeValue(xAOD::EgammaParameters::e011); };
286 funcLibrary[prefix + "_e033"] = [](const xAOD::Egamma* eg, const xAOD::CaloCluster*)
287 { return eg->showerShapeValue(xAOD::EgammaParameters::e033); };
288 funcLibrary[prefix + "_e132"] = [](const xAOD::Egamma* eg, const xAOD::CaloCluster*)
289 { return eg->showerShapeValue(xAOD::EgammaParameters::e132); };
290 funcLibrary[prefix + "_e1152"] = [](const xAOD::Egamma* eg, const xAOD::CaloCluster*)
291 { return eg->showerShapeValue(xAOD::EgammaParameters::e1152); };
292 funcLibrary[prefix + "_ethad1"] = [](const xAOD::Egamma* eg, const xAOD::CaloCluster*)
293 { return eg->showerShapeValue(xAOD::EgammaParameters::ethad1); };
294 funcLibrary[prefix + "_ethad"] = [](const xAOD::Egamma* eg, const xAOD::CaloCluster*)
295 { return eg->showerShapeValue(xAOD::EgammaParameters::ethad); };
296 funcLibrary[prefix + "_f1"] = [](const xAOD::Egamma* eg, const xAOD::CaloCluster*)
297 { return eg->showerShapeValue(xAOD::EgammaParameters::f1); };
298 funcLibrary[prefix + "_f3"] = [](const xAOD::Egamma* eg, const xAOD::CaloCluster*)
299 { return eg->showerShapeValue(xAOD::EgammaParameters::f3); };
300 funcLibrary[prefix + "_f1core"] = [](const xAOD::Egamma* eg, const xAOD::CaloCluster*)
301 { return eg->showerShapeValue(xAOD::EgammaParameters::f1core); };
302 funcLibrary[prefix + "_f3core"] = [](const xAOD::Egamma* eg, const xAOD::CaloCluster*)
303 { return eg->showerShapeValue(xAOD::EgammaParameters::f3core); };
304 funcLibrary[prefix + "_e233"] = [](const xAOD::Egamma* eg, const xAOD::CaloCluster*)
305 { return eg->showerShapeValue(xAOD::EgammaParameters::e233); };
306 funcLibrary[prefix + "_e235"] = [](const xAOD::Egamma* eg, const xAOD::CaloCluster*)
307 { return eg->showerShapeValue(xAOD::EgammaParameters::e235); };
308 funcLibrary[prefix + "_e255"] = [](const xAOD::Egamma* eg, const xAOD::CaloCluster*)
309 { return eg->showerShapeValue(xAOD::EgammaParameters::e255); };
310 funcLibrary[prefix + "_e237"] = [](const xAOD::Egamma* eg, const xAOD::CaloCluster*)
311 { return eg->showerShapeValue(xAOD::EgammaParameters::e237); };
312 funcLibrary[prefix + "_e277"] = [](const xAOD::Egamma* eg, const xAOD::CaloCluster*)
313 { return eg->showerShapeValue(xAOD::EgammaParameters::e277); };
314 funcLibrary[prefix + "_e333"] = [](const xAOD::Egamma* eg, const xAOD::CaloCluster*)
315 { return eg->showerShapeValue(xAOD::EgammaParameters::e333); };
316 funcLibrary[prefix + "_e335"] = [](const xAOD::Egamma* eg, const xAOD::CaloCluster*)
317 { return eg->showerShapeValue(xAOD::EgammaParameters::e335); };
318 funcLibrary[prefix + "_e337"] = [](const xAOD::Egamma* eg, const xAOD::CaloCluster*)
319 { return eg->showerShapeValue(xAOD::EgammaParameters::e337); };
320 funcLibrary[prefix + "_e377"] = [](const xAOD::Egamma* eg, const xAOD::CaloCluster*)
321 { return eg->showerShapeValue(xAOD::EgammaParameters::e377); };
322 funcLibrary[prefix + "_weta1"] = [](const xAOD::Egamma* eg, const xAOD::CaloCluster*)
323 { return eg->showerShapeValue(xAOD::EgammaParameters::weta1); };
324 funcLibrary[prefix + "_weta2"] = [](const xAOD::Egamma* eg, const xAOD::CaloCluster*)
325 { return eg->showerShapeValue(xAOD::EgammaParameters::weta2); };
326 funcLibrary[prefix + "_e2ts1"] = [](const xAOD::Egamma* eg, const xAOD::CaloCluster*)
327 { return eg->showerShapeValue(xAOD::EgammaParameters::e2ts1); };
328 funcLibrary[prefix + "_e2tsts1"] = [](const xAOD::Egamma* eg, const xAOD::CaloCluster*)
329 { return eg->showerShapeValue(xAOD::EgammaParameters::e2tsts1); };
330 funcLibrary[prefix + "_fracs1"] = [](const xAOD::Egamma* eg, const xAOD::CaloCluster*)
331 { return eg->showerShapeValue(xAOD::EgammaParameters::fracs1); };
332 funcLibrary[prefix + "_widths1"] = [](const xAOD::Egamma* eg, const xAOD::CaloCluster*)
333 { return eg->showerShapeValue(xAOD::EgammaParameters::widths1); };
334 funcLibrary[prefix + "_widths2"] = [](const xAOD::Egamma* eg, const xAOD::CaloCluster*)
335 { return eg->showerShapeValue(xAOD::EgammaParameters::widths2); };
336 funcLibrary[prefix + "_poscs1"] = [](const xAOD::Egamma* eg, const xAOD::CaloCluster*)
337 { return eg->showerShapeValue(xAOD::EgammaParameters::poscs1); };
338 funcLibrary[prefix + "_poscs2"] = [](const xAOD::Egamma* eg, const xAOD::CaloCluster*)
339 { return eg->showerShapeValue(xAOD::EgammaParameters::poscs2); };
340 funcLibrary[prefix + "_asy1"] = [](const xAOD::Egamma* eg, const xAOD::CaloCluster*)
341 { return eg->showerShapeValue(xAOD::EgammaParameters::asy1); };
342 funcLibrary[prefix + "_pos"] = [](const xAOD::Egamma* eg, const xAOD::CaloCluster*)
343 { return eg->showerShapeValue(xAOD::EgammaParameters::pos); };
344 funcLibrary[prefix + "_pos7"] = [](const xAOD::Egamma* eg, const xAOD::CaloCluster*)
345 { return eg->showerShapeValue(xAOD::EgammaParameters::pos7); };
346 funcLibrary[prefix + "_barys1"] = [](const xAOD::Egamma* eg, const xAOD::CaloCluster*)
347 { return eg->showerShapeValue(xAOD::EgammaParameters::barys1); };
348 funcLibrary[prefix + "_wtots1"] = [](const xAOD::Egamma* eg, const xAOD::CaloCluster*)
349 { return eg->showerShapeValue(xAOD::EgammaParameters::wtots1); };
350 funcLibrary[prefix + "_emins1"] = [](const xAOD::Egamma* eg, const xAOD::CaloCluster*)
351 { return eg->showerShapeValue(xAOD::EgammaParameters::emins1); };
352 funcLibrary[prefix + "_emaxs1"] = [](const xAOD::Egamma* eg, const xAOD::CaloCluster*)
353 { return eg->showerShapeValue(xAOD::EgammaParameters::emaxs1); };
354 funcLibrary[prefix + "_r33over37allcalo"] = [](const xAOD::Egamma* eg, const xAOD::CaloCluster*)
355 { return eg->showerShapeValue(xAOD::EgammaParameters::r33over37allcalo); };
356 funcLibrary[prefix + "_ecore"] = [](const xAOD::Egamma* eg, const xAOD::CaloCluster*)
357 { return eg->showerShapeValue(xAOD::EgammaParameters::ecore); };
358 funcLibrary[prefix + "_Reta"] = [](const xAOD::Egamma* eg, const xAOD::CaloCluster*)
359 { return eg->showerShapeValue(xAOD::EgammaParameters::Reta); };
360 funcLibrary[prefix + "_Rphi"] = [](const xAOD::Egamma* eg, const xAOD::CaloCluster*)
361 { return eg->showerShapeValue(xAOD::EgammaParameters::Rphi); };
362 funcLibrary[prefix + "_Eratio"] = [](const xAOD::Egamma* eg, const xAOD::CaloCluster*)
363 { return eg->showerShapeValue(xAOD::EgammaParameters::Eratio); };
364 funcLibrary[prefix + "_Rhad"] = [](const xAOD::Egamma* eg, const xAOD::CaloCluster*)
365 { return eg->showerShapeValue(xAOD::EgammaParameters::Rhad); };
366 funcLibrary[prefix + "_Rhad1"] = [](const xAOD::Egamma* eg, const xAOD::CaloCluster*)
367 { return eg->showerShapeValue(xAOD::EgammaParameters::Rhad1); };
368 funcLibrary[prefix + "_DeltaE"] = [](const xAOD::Egamma* eg, const xAOD::CaloCluster*)
369 { return eg->showerShapeValue(xAOD::EgammaParameters::DeltaE); };
370
371 }
372}
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
#define pi
These functions are for calculating variables used by the MVA calibration.
float compute_rawcl_calibHitsShowerDepth(const xAOD::CaloCluster &cl)
float compute_correctedcl_f0(const xAOD::CaloCluster &cl)
float compute_cl_phiCalo(const xAOD::CaloCluster &cluster)
float compute_ptconv(const xAOD::Photon *ph)
This ptconv is the old one used by MVACalib.
std::unique_ptr< funcMap_t > initializeUnconvertedPhotonFuncs(bool useLayerCorrected)
A function to build the map for uncoverted photons.
float compute_cl_y(const xAOD::CaloCluster &cl)
float compute_correctedcl_Eacc(const xAOD::CaloCluster &cl)
float compute_cl_phi(const xAOD::CaloCluster &cluster)
float compute_el_charge(const xAOD::Electron &el)
float compute_rawcl_Es1(const xAOD::CaloCluster &cl)
float compute_etaMod_FCAL(const xAOD::CaloCluster &cl)
float compute_cl_z(const xAOD::CaloCluster &cl)
std::unique_ptr< funcMap_t > initializeElectronFuncs(bool useLayerCorrected)
A function to build the map for electrons.
float compute_correctedcl_Es3(const xAOD::CaloCluster &cl)
float compute_cellIndex_EMEC(const xAOD::CaloCluster &cl)
float compute_cl_secondR(const xAOD::CaloCluster &cl)
float compute_cl_centerLambda(const xAOD::CaloCluster &cl)
float compute_rawcl_Eacc(const xAOD::CaloCluster &cl)
float compute_el_trackpt(const xAOD::Electron &el)
std::unique_ptr< funcMap_t > initializeForwardElectronFuncs(bool useLayerCorrected)
NEW: A function to build the map for forward electrons.
float compute_cl_etaCalo(const xAOD::CaloCluster &cluster)
float compute_cl_e(const xAOD::CaloCluster &cluster)
float compute_rawcl_Es2(const xAOD::CaloCluster &cl)
float compute_correctedcl_Es1(const xAOD::CaloCluster &cl)
float compute_pt2conv(const xAOD::Photon *ph)
float compute_rawcl_Es0(const xAOD::CaloCluster &cl)
float compute_cl_secondR_fudge(const xAOD::Egamma &eg)
float compute_rawcl_Es3(const xAOD::CaloCluster &cl)
float compute_el_tracketa(const xAOD::Electron &el)
float compute_cellIndex_FCAL(const xAOD::CaloCluster &cl)
float compute_correctedcl_Es2(const xAOD::CaloCluster &cl)
float compute_cl_eta(const xAOD::CaloCluster &cluster)
float compute_el_refittedTrack_qoverp(const xAOD::Electron &el)
float compute_R12_EMEC(const xAOD::CaloCluster &cl)
float compute_etaMod_EMEC(const xAOD::CaloCluster &cl)
std::unique_ptr< funcMap_t > initializeConvertedPhotonFuncs(bool useLayerCorrected)
A function to build the map for converted photons.
void initializeEgammaFuncs(funcMap_t &funcLibrary, const std::string &prefix, bool useLayerCorrected)
float compute_correctedcl_Es0(const xAOD::CaloCluster &cl)
float compute_el_trackz0(const xAOD::Electron &el)
float compute_cl_x(const xAOD::CaloCluster &cl)
float compute_cl_secondDensity(const xAOD::CaloCluster &cl)
float compute_correctedcl_calibHitsShowerDepth(const xAOD::CaloCluster &cl)
float compute_phiMod_EMEC(const xAOD::CaloCluster &cl)
float compute_rawcl_f0(const xAOD::CaloCluster &cl)
std::unordered_map< std::string, std::function< float(const xAOD::Egamma *, const xAOD::CaloCluster *)> > funcMap_t
Define the map type since it's long.
float compute_pt1conv(const xAOD::Photon *ph)
void initializeClusterFuncs(funcMap_t &funcLibrary, const std::string &prefix, bool useLayerCorrected)
std::size_t numberOfSiTracks(const xAOD::Photon *eg)
return the number of Si tracks in the conversion
float conversionRadius(const xAOD::Vertex *vx)
return the conversion radius or 9999.
@ e235
uncalibrated energy (sum of cells) of the middle sampling in a rectangle of size 3x5
Definition EgammaEnums.h:72
@ e337
uncalibrated energy (sum of cells) of the third sampling in a rectangle of size 3x7
Definition EgammaEnums.h:90
@ wtots1
shower width is determined in a window detaxdphi = 0,0625 ×~0,2, corresponding typically to 20 strips...
@ pos7
Difference between the track and the shower positions: sum_{i=i_m-7}^{i=i_m+7}E_i x (i-i_m) / sum_{i=...
@ f3core
E3(3x3)/E fraction of the energy reconstructed in the third compartment of the electromagnetic calori...
Definition EgammaEnums.h:66
@ ethad1
transverse energy in the first sampling of the hadronic calorimeters behind the cluster calculated fr...
Definition EgammaEnums.h:43
@ e277
uncalibrated energy (sum of cells) of the middle sampling in a rectangle of size 7x7
Definition EgammaEnums.h:81
@ e237
uncalibrated energy (sum of cells) of the middle sampling in a rectangle of size 3x7
Definition EgammaEnums.h:78
@ ethad
ET leakage into hadronic calorimeter with exclusion of energy in CaloSampling::TileGap3.
Definition EgammaEnums.h:46
@ e1152
uncalibrated energy (sum of cells) in strips in a 15x2 window in cells in eta X phi
Definition EgammaEnums.h:40
@ f3
fraction of energy reconstructed in 3rd sampling
Definition EgammaEnums.h:55
@ poscs2
relative position in eta within cell in 2nd sampling
@ ecore
core energy in em calo E(core) = E0(3x3) + E1(15x2) + E2(5x5) + E3(3x5)
@ f1
E1/E = fraction of energy reconstructed in the first sampling, where E1 is energy in all strips belon...
Definition EgammaEnums.h:53
@ pos
difference between shower cell and predicted track in +/- 1 cells
@ widths2
same as egammaParameters::weta2 but without corrections on particle impact point inside the cell
@ e2ts1
2nd max in strips calc by summing 3 strips
@ poscs1
relative position in eta within cell in 1st sampling
@ Eratio
(emaxs1-e2tsts1)/(emaxs1+e2tsts1)
@ e335
uncalibrated energy (sum of cells) of the third sampling in a rectangle of size 3x5
Definition EgammaEnums.h:87
@ e377
uncalibrated energy (sum of cells) of the middle sampling in a rectangle of size 7x7
Definition EgammaEnums.h:93
@ e333
uncalibrated energy (sum of cells) of the third sampling in a rectangle of size 3x3
Definition EgammaEnums.h:84
@ emaxs1
energy of strip with maximal energy deposit
@ e255
uncalibrated energy (sum of cells) of the middle sampling in a rectangle of size 5x5
Definition EgammaEnums.h:75
@ DeltaE
e2tsts1-emins1
@ barys1
barycentre in sampling 1 calculated in 3 strips
@ e233
uncalibrated energy (sum of cells) of the middle sampling in a rectangle of size 3x3 (in cell units e...
Definition EgammaEnums.h:69
@ asy1
uncorr asymmetry in 3 strips in the 1st sampling
@ e033
uncalibrated energy (sum of cells) in presampler in a 3x3 window in cells in eta X phi
Definition EgammaEnums.h:34
@ e132
uncalibrated energy (sum of cells) in strips in a 3x2 window in cells in eta X phi
Definition EgammaEnums.h:37
@ fracs1
shower shape in the shower core : [E(+/-3)-E(+/-1)]/E(+/-1), where E(+/-n) is the energy in ± n strip...
@ r33over37allcalo
1-ratio of energy in 3x3 over 3x7 cells; E(3x3) = E0(1x1) + E1(3x1) + E2(3x3) + E3(3x3); E(3x7) = E0(...
@ weta2
the lateral width is calculated with a window of 3x5 cells using the energy weighted sum over all cel...
@ e011
uncalibrated energy (sum of cells) in presampler in a 1x1 window in cells in eta X phi
Definition EgammaEnums.h:31
@ weta1
shower width using +/-3 strips around the one with the maximal energy deposit: w3 strips = sqrt{sum(E...
Definition EgammaEnums.h:98
@ e2tsts1
energy of the cell corresponding to second energy maximum in the first sampling
@ emins1
energy reconstructed in the strip with the minimal value between the first and second maximum
@ widths1
same as egammaParameters::weta1 but without corrections on particle impact point inside the cell
@ f1core
E1(3x1)/E = fraction of the energy reconstructed in the first longitudinal compartment of the electro...
Definition EgammaEnums.h:61
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.
Egamma_v1 Egamma
Definition of the current "egamma version".
Definition Egamma.h:17
Photon_v1 Photon
Definition of the current "egamma version".
Electron_v1 Electron
Definition of the current "egamma version".