ATLAS Offline Software
egammaEnergyCorrectionTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
9 
10 
11 
18 #include "TF1.h"
19 #include "TFile.h"
20 #include "TGraphErrors.h"
21 #include "TH1.h"
22 #include "TH2.h"
23 #include "TList.h"
24 #include "TSystem.h"
25 #include "TRandom3.h"
27 
28 #include <format>
29 #include <cassert>
30 #include <exception>
31 #include <iomanip>
32 #include <ios>
33 #include <iostream>
34 #include <utility>
35 #include <type_traits> //std::is_pointer
36 #include <cmath> //hypot
37 
38 
39 namespace {
40 double qsum(double x, double y) {
41  return std::hypot(x, y);
42 }
43 
44 template <typename TargetPtr, typename SourcePtr>
45 TargetPtr checked_own_cast(SourcePtr ptr) {
46  // Do we have ptr types
48  "attempt to cast to no ptr object");
50  "attempt to cast from no ptr object");
51 
52  // nullptr input
53  if (!ptr) {
54  throw std::runtime_error(
55  "Attempt to cast from nullptr in egammaEnergyCorrectionTool");
56  }
57 
58  // dynamic_cast and check
59  TargetPtr obj = dynamic_cast<TargetPtr>(ptr);
60  if (not obj) {
61  throw std::runtime_error("failed dynamic cast for " +
62  std::string(ptr->GetName()) +
63  " in egammaEnergyCorrectionTool");
64  }
65 
66  // For most ROOT types we want onwership
67  // TAxis nothing
68  if constexpr (std::is_same_v<TAxis, std::remove_pointer_t<TargetPtr>>) {
69  }
70  // TList SetOwner
71  else if constexpr (std::is_same_v<TList, std::remove_pointer_t<TargetPtr>>) {
72  obj->SetOwner();
73  // mainly TH1,TH2
74  } else {
75  obj->SetDirectory(nullptr);
76  }
77 
78  return obj;
79 }
80 
81 double getValueHistoAt(const TH1& histo, double xvalue,
82  bool use_lastbin_overflow = false,
83  bool use_firstbin_underflow = false,
84  bool use_interpolation = false) {
85  if (use_interpolation) {
86  return histo.Interpolate(xvalue);
87  }
88  else {
89  int bin = histo.FindFixBin(xvalue);
90  if (use_lastbin_overflow and histo.IsBinOverflow(bin)) {
91  bin = histo.GetNbinsX();
92  }
93  if (use_firstbin_underflow and histo.IsBinUnderflow(bin)) {
94  bin = 1;
95  }
96  return histo.GetBinContent(bin);
97  }
98 }
99 
100 double getValueHistAt(const TH2& histo, double xvalue, double yvalue,
101  bool use_lastbin_x_overflow = false,
102  bool use_lastbin_y_overflow = false,
103  bool use_fistbin_x_underflow = false,
104  bool use_firstbin_y_underflow = false,
105  bool use_x_interpolation = false,
106  bool use_y_interpolation = false) {
107  int xbin = histo.GetXaxis()->FindFixBin(xvalue);
108  int nxbins = histo.GetXaxis()->GetNbins();
109  if (use_lastbin_x_overflow and xbin == nxbins + 1) {
110  xbin = nxbins;
111  }
112  if (use_fistbin_x_underflow and xbin == 0) {
113  xbin = 1;
114  }
115  int ybin = histo.GetYaxis()->FindFixBin(yvalue);
116  int nybins = histo.GetYaxis()->GetNbins();
117  if (use_lastbin_y_overflow and ybin == nybins + 1) {
118  ybin = nybins;
119  }
120  if (use_firstbin_y_underflow and ybin == 0) {
121  ybin = 1;
122  }
123 
124  int interpolation = 0b00;
125  if (use_x_interpolation and
126  xvalue > histo.GetXaxis()->GetBinCenter(1) and
127  xvalue < histo.GetXaxis()->GetBinCenter(nxbins)) {
128  interpolation |= 0b01;
129  }
130  if (use_y_interpolation and
131  yvalue > histo.GetYaxis()->GetBinCenter(1) and
132  yvalue < histo.GetYaxis()->GetBinCenter(nybins)) {
133  interpolation |= 0b10;
134  }
135 
136  if (interpolation == 0b00) {
137  return histo.GetBinContent(xbin, ybin);
138  }
139  else if (interpolation == 0b01) {
140  int xbin0, xbin1;
141  if(xvalue<=histo.GetXaxis()->GetBinCenter(xbin)) {
142  xbin0 = xbin - 1;
143  xbin1 = xbin;
144  }
145  else {
146  xbin0 = xbin;
147  xbin1 = xbin + 1;
148  }
149  double x0 = histo.GetXaxis()->GetBinCenter(xbin0);
150  double x1 = histo.GetXaxis()->GetBinCenter(xbin1);
151  double z0 = histo.GetBinContent(xbin0, ybin);
152  double z1 = histo.GetBinContent(xbin1, ybin);
153  return z0 + (xvalue-x0)*((z1-z0)/(x1-x0));
154  }
155  else if (interpolation == 0b10) {
156  int ybin0, ybin1;
157  if(yvalue<=histo.GetYaxis()->GetBinCenter(ybin)) {
158  ybin0 = ybin - 1;
159  ybin1 = ybin;
160  }
161  else {
162  ybin0 = ybin;
163  ybin1 = ybin + 1;
164  }
165  double y0 = histo.GetYaxis()->GetBinCenter(ybin0);
166  double y1 = histo.GetYaxis()->GetBinCenter(ybin1);
167  double z0 = histo.GetBinContent(xbin, ybin0);
168  double z1 = histo.GetBinContent(xbin, ybin1);
169  return z0 + (yvalue-y0)*((z1-z0)/(y1-y0));
170  }
171  else { //0b11
172  return histo.Interpolate(xvalue, yvalue);
173  }
174 }
175 } // end anonymous namespace
176 
177 namespace AtlasRoot {
178 
179 using std::string;
180 
182  : asg::AsgMessaging("egammaEnergyCorrectionTool"),
183  m_rootFileName(
184  PathResolverFindCalibFile("ElectronPhotonFourMomentumCorrection/v38/"
185  "egammaEnergyCorrectionData.root")),
186  m_esmodel(egEnergyCorr::UNDEFINED) {
187 
188  if (m_rootFileName.empty()) {
189  ATH_MSG_FATAL("cannot find configuration file");
190  throw std::runtime_error("cannot find file");
191  }
192 
193  m_begRunNumber = 0;
194  m_endRunNumber = 0;
195 
196  /*
197  * All histogram vectors start empty
198  */
199 
201 
202  // tools
203 
204  m_resolution_tool = nullptr;
205  // m_getMaterialDelta = nullptr;
206  m_e1hg_tool = nullptr;
207 
208  // switches
209 
210  m_use_etaCalo_scales = false;
211 
212  m_applyPSCorrection = true;
213  m_applyS12Correction = true;
214 
215  // special for es2015PRE
218 
219  // special for es2016PRE
221 
222  // espcial for R22 precision
223  m_useL2GainCorrection = false;
224  m_useL2GainInterpolation = false;
225  m_useLeakageCorrection = false;
227 
228  m_use_stat_error_scaling = false;
229  m_initialized = false;
230  m_RunNumber = 0;
231 }
232 
234 
235  // Clean up
236 }
237 
239 
240  ATH_MSG_DEBUG("initialize internal tool");
241 
242  // Load the ROOT filea
243  const std::unique_ptr<char[]> fname(
244  gSystem->ExpandPathName(m_rootFileName.c_str()));
245  std::unique_ptr<TFile> rootFile(TFile::Open(fname.get(), "READ"));
246 
247  if (!rootFile) {
248  ATH_MSG_ERROR("no root file found");
249  return 0;
250  }
251 
252  ATH_MSG_DEBUG("Opening ES model file " << fname.get());
253 
254  // instantiate the resolution parametrization
255  m_getMaterialDelta = std::make_unique<get_MaterialResolutionEffect>();
259  m_getMaterialDelta->setInterpolate(true);
260  }
261 
262  // Energy corrections and systematic uncertainties
264 
265  // Legacy numbers for 2010
268  m_aPSNom.reset(
269  checked_own_cast<TH1*>(rootFile->Get("Scales/es2010/alphaPS_errTot")));
270  m_aS12Nom.reset(
271  checked_own_cast<TH1*>(rootFile->Get("Scales/es2010/alphaS12_errTot")));
272  m_zeeNom.reset(checked_own_cast<TH1*>(
273  rootFile->Get("Scales/es2010/alphaZee_errStat")));
274  m_zeeSyst.reset(checked_own_cast<TH1*>(
275  rootFile->Get("Scales/es2010/alphaZee_errSyst")));
276  m_resNom.reset(checked_own_cast<TH1*>(
277  rootFile->Get("Resolution/es2010/ctZee_errStat")));
278  m_resSyst.reset(checked_own_cast<TH1*>(
279  rootFile->Get("Resolution/es2010/ctZee_errSyst")));
280  m_peakResData.reset(
281  checked_own_cast<TH1*>(rootFile->Get("Resolution/es2010/resZee_Data")));
282  m_peakResMC.reset(
283  checked_own_cast<TH1*>(rootFile->Get("Resolution/es2010/resZee_MC")));
284  m_begRunNumber = 152166;
285  m_endRunNumber = 170482;
286  // mc11c : faulty electron multiple scattering in G4; old geometry
287  // Precise Z scales, systematics otherwise as in 2010
288 
289  } else if (m_esmodel == egEnergyCorr::es2011c) {
291  m_aPSNom.reset(
292  checked_own_cast<TH1*>(rootFile->Get("Scales/es2011c/alphaPS_errTot")));
293  m_aS12Nom.reset(checked_own_cast<TH1*>(
294  rootFile->Get("Scales/es2011c/alphaS12_errTot")));
295  m_zeeNom.reset(checked_own_cast<TH1*>(
296  rootFile->Get("Scales/es2011c/alphaZee_errStat")));
297  m_zeeSyst.reset(checked_own_cast<TH1*>(
298  rootFile->Get("Scales/es2011c/alphaZee_errSyst")));
299  m_resNom.reset(checked_own_cast<TH1*>(
300  rootFile->Get("Resolution/es2011c/ctZee_errStat")));
301  m_resSyst.reset(checked_own_cast<TH1*>(
302  rootFile->Get("Resolution/es2011c/ctZee_errSyst")));
303  m_peakResData.reset(checked_own_cast<TH1*>(
304  rootFile->Get("Resolution/es2011c/resZee_Data")));
305  m_peakResMC.reset(
306  checked_own_cast<TH1*>(rootFile->Get("Resolution/es2011c/resZee_MC")));
307 
308  m_begRunNumber = 177531;
309  m_endRunNumber = 194382;
310 
311  // mc11d : correct MSc in G4; new geometry
312  // Final Run1 calibration scheme
313  } else if (m_esmodel == egEnergyCorr::es2011d ||
317  m_resolution_tool = std::make_unique<eg_resolution>("run1");
318  m_aPSNom.reset(
319  checked_own_cast<TH1*>(rootFile->Get("Scales/es2011d/alphaPS_uncor")));
320  m_daPSCor.reset(
321  checked_own_cast<TH1*>(rootFile->Get("Scales/es2011d/dalphaPS_cor")));
322  m_aS12Nom.reset(
323  checked_own_cast<TH1*>(rootFile->Get("Scales/es2011d/alphaS12_uncor")));
324  m_daS12Cor.reset(
325  checked_own_cast<TH1*>(rootFile->Get("Scales/es2011d/dalphaS12_cor")));
326  m_trkSyst.reset(checked_own_cast<TH1*>(
327  rootFile->Get("Scales/es2011d/momentum_errSyst")));
328 
330 
331  m_zeeNom.reset(checked_own_cast<TH1*>(
332  rootFile->Get("Scales/es2011d/alphaZee_errStat")));
333  m_zeeSyst.reset(checked_own_cast<TH1*>(
334  rootFile->Get("Scales/es2011d/alphaZee_errSyst")));
335  m_resNom.reset(checked_own_cast<TH1*>(
336  rootFile->Get("Resolution/es2011d/ctZee_errStat")));
337  m_resSyst.reset(checked_own_cast<TH1*>(
338  rootFile->Get("Resolution/es2011d/ctZee_errSyst")));
339 
340  } else if (m_esmodel == egEnergyCorr::es2011dMedium) {
341 
342  m_zeeNom.reset(checked_own_cast<TH1*>(
343  rootFile->Get("Scales/es2011dMedium/alphaZee_errStat")));
344  m_zeeSyst.reset(checked_own_cast<TH1*>(
345  rootFile->Get("Scales/es2011dMedium/alphaZee_errSyst")));
346  m_zeePhys.reset(checked_own_cast<TH1*>(
347  rootFile->Get("Scales/es2011dMedium/alphaZee_errPhys")));
348  m_resNom.reset(checked_own_cast<TH1*>(
349  rootFile->Get("Resolution/es2011dMedium/ctZee_errStat")));
350  m_resSyst.reset(checked_own_cast<TH1*>(
351  rootFile->Get("Resolution/es2011dMedium/ctZee_errSyst")));
352 
353  } else if (m_esmodel == egEnergyCorr::es2011dTight) {
354 
355  m_zeeNom.reset(checked_own_cast<TH1*>(
356  rootFile->Get("Scales/es2011dTight/alphaZee_errStat")));
357  m_zeeSyst.reset(checked_own_cast<TH1*>(
358  rootFile->Get("Scales/es2011dTight/alphaZee_errSyst")));
359  m_zeePhys.reset(checked_own_cast<TH1*>(
360  rootFile->Get("Scales/es2011dTight/alphaZee_errPhys")));
361  m_resNom.reset(checked_own_cast<TH1*>(
362  rootFile->Get("Resolution/es2011dTight/ctZee_errStat")));
363  m_resSyst.reset(checked_own_cast<TH1*>(
364  rootFile->Get("Resolution/es2011dTight/ctZee_errSyst")));
365  }
366 
367  m_pedestalL0.reset(checked_own_cast<TH1*>(
368  rootFile->Get("Pedestals/es2011d/pedestals_l0")));
369  m_pedestalL1.reset(checked_own_cast<TH1*>(
370  rootFile->Get("Pedestals/es2011d/pedestals_l1")));
371  m_pedestalL2.reset(checked_own_cast<TH1*>(
372  rootFile->Get("Pedestals/es2011d/pedestals_l2")));
373  m_pedestalL3.reset(checked_own_cast<TH1*>(
374  rootFile->Get("Pedestals/es2011d/pedestals_l3")));
375 
376  m_dX_ID_Nom.reset(
377  checked_own_cast<TH1*>(rootFile->Get("Material/DX0_ConfigA")));
378 
379  m_dX_IPPS_Nom.reset(checked_own_cast<TH1*>(
380  rootFile->Get("Material/Measured/DXerr_IPPS_NewG_errUncor")));
381  m_dX_IPPS_LAr.reset(checked_own_cast<TH1*>(
382  rootFile->Get("Material/Measured/DXerr_IPPS_NewG_errLAr")));
383 
384  m_dX_IPAcc_Nom.reset(checked_own_cast<TH1*>(
385  rootFile->Get("Material/Measured/DXerr_IPAcc_NewG_errUncor")));
386  m_dX_IPAcc_LAr.reset(checked_own_cast<TH1*>(
387  rootFile->Get("Material/Measured/DXerr_IPAcc_NewG_errLAr")));
388  m_dX_IPAcc_G4.reset(checked_own_cast<TH1*>(
389  rootFile->Get("Material/Measured/DXerr_IPAcc_NewG_errG4")));
390  m_dX_IPAcc_GL1.reset(checked_own_cast<TH1*>(
391  rootFile->Get("Material/Measured/DXerr_IPAcc_NewG_errGL1")));
392 
393  m_dX_PSAcc_Nom.reset(checked_own_cast<TH1*>(
394  rootFile->Get("Material/Measured/DXerr_PSAcc_NewG_errUncor")));
395  m_dX_PSAcc_LAr.reset(checked_own_cast<TH1*>(
396  rootFile->Get("Material/Measured/DXerr_PSAcc_NewG_errLAr")));
397  m_dX_PSAcc_G4.reset(checked_own_cast<TH1*>(
398  rootFile->Get("Material/Measured/DXerr_PSAcc_NewG_errG4")));
399 
400  m_convRadius.reset(checked_own_cast<TH1*>(
401  rootFile->Get("Conversions/es2011d/convRadiusMigrations")));
402  m_convFakeRate.reset(checked_own_cast<TH1*>(
403  rootFile->Get("Conversions/es2011d/convFakeRate")));
404  m_convRecoEfficiency.reset(checked_own_cast<TH1*>(
405  rootFile->Get("Conversions/es2011d/convRecoEfficiency")));
406 
407  m_begRunNumber = 177531;
408  m_endRunNumber = 194382;
409 
410  const std::string gain_filename1 = PathResolverFindCalibFile(
411  "ElectronPhotonFourMomentumCorrection/v8/FunctionsTO.root");
412  const std::string gain_filename2 = PathResolverFindCalibFile(
413  "ElectronPhotonFourMomentumCorrection/v8/FunctionsG_all.root");
414  m_gain_tool =
415  std::make_unique<egGain::GainTool>(gain_filename1, gain_filename2);
416 
417  m_e1hg_tool = std::make_unique<e1hg_systematics>(
418  PathResolverFindCalibFile("ElectronPhotonFourMomentumCorrection/v8/"
419  "e1hg_systematics_histos.root"));
420 
421  // mc12a : crude MSc fix in G4; old geometry
422  // All systematics as in 2010.
423  } else if (m_esmodel == egEnergyCorr::es2012a) {
425  m_aPSNom.reset(
426  checked_own_cast<TH1*>(rootFile->Get("Scales/es2012a/alphaPS_errTot")));
427  m_aS12Nom.reset(checked_own_cast<TH1*>(
428  rootFile->Get("Scales/es2012a/alphaS12_errTot")));
429 
430  m_zeeNom.reset(checked_own_cast<TH1*>(
431  rootFile->Get("Scales/es2012a/alphaZee_errStat")));
432  m_zeeSyst.reset(checked_own_cast<TH1*>(
433  rootFile->Get("Scales/es2012a/alphaZee_errSyst")));
434 
435  m_resNom.reset(checked_own_cast<TH1*>(
436  rootFile->Get("Resolution/es2012a/ctZee_errStat")));
437  m_resSyst.reset(checked_own_cast<TH1*>(
438  rootFile->Get("Resolution/es2012a/ctZee_errSyst")));
439  m_peakResData.reset(checked_own_cast<TH1*>(
440  rootFile->Get("Resolution/es2012a/resZee_Data")));
441  m_peakResMC.reset(
442  checked_own_cast<TH1*>(rootFile->Get("Resolution/es2012a/resZee_MC")));
443 
444  m_begRunNumber = 195847;
445  m_endRunNumber = 219365;
446 
447  // mc12c : correct MSc in G4; new geometry
448  // Final Run1 calibration scheme
449  } else if (m_esmodel == egEnergyCorr::es2012c) {
451  m_resolution_tool = std::make_unique<eg_resolution>("run1");
452 
453  m_aPSNom.reset(
454  checked_own_cast<TH1*>(rootFile->Get("Scales/es2012c/alphaPS_uncor")));
455  m_daPSCor.reset(
456  checked_own_cast<TH1*>(rootFile->Get("Scales/es2012c/dalphaPS_cor")));
457  m_aS12Nom.reset(
458  checked_own_cast<TH1*>(rootFile->Get("Scales/es2012c/alphaS12_uncor")));
459  m_daS12Cor.reset(
460  checked_own_cast<TH1*>(rootFile->Get("Scales/es2012c/dalphaS12_cor")));
461 
462  m_trkSyst.reset(checked_own_cast<TH1*>(
463  rootFile->Get("Scales/es2012c/momentum_errSyst")));
464 
465  m_zeeNom.reset(checked_own_cast<TH1*>(
466  rootFile->Get("Scales/es2012c/alphaZee_errStat")));
467  m_zeeSyst.reset(checked_own_cast<TH1*>(
468  rootFile->Get("Scales/es2012c/alphaZee_errSyst")));
469 
470  m_resNom.reset(checked_own_cast<TH1*>(
471  rootFile->Get("Resolution/es2012c/ctZee_errStat")));
472  m_resSyst.reset(checked_own_cast<TH1*>(
473  rootFile->Get("Resolution/es2012c/ctZee_errSyst")));
474 
475  m_pedestalL0.reset(checked_own_cast<TH1*>(
476  rootFile->Get("Pedestals/es2012c/pedestals_l0")));
477  m_pedestalL1.reset(checked_own_cast<TH1*>(
478  rootFile->Get("Pedestals/es2012c/pedestals_l1")));
479  m_pedestalL2.reset(checked_own_cast<TH1*>(
480  rootFile->Get("Pedestals/es2012c/pedestals_l2")));
481  m_pedestalL3.reset(checked_own_cast<TH1*>(
482  rootFile->Get("Pedestals/es2012c/pedestals_l3")));
483 
484  m_dX_ID_Nom.reset(
485  checked_own_cast<TH1*>(rootFile->Get("Material/DX0_ConfigA")));
486 
487  m_dX_IPPS_Nom.reset(checked_own_cast<TH1*>(
488  rootFile->Get("Material/Measured/DXerr_IPPS_NewG_errUncor")));
489  m_dX_IPPS_LAr.reset(checked_own_cast<TH1*>(
490  rootFile->Get("Material/Measured/DXerr_IPPS_NewG_errLAr")));
491 
492  m_dX_IPAcc_Nom.reset(checked_own_cast<TH1*>(
493  rootFile->Get("Material/Measured/DXerr_IPAcc_NewG_errUncor")));
494  m_dX_IPAcc_LAr.reset(checked_own_cast<TH1*>(
495  rootFile->Get("Material/Measured/DXerr_IPAcc_NewG_errLAr")));
496  m_dX_IPAcc_G4.reset(checked_own_cast<TH1*>(
497  rootFile->Get("Material/Measured/DXerr_IPAcc_NewG_errG4")));
498  m_dX_IPAcc_GL1.reset(checked_own_cast<TH1*>(
499  rootFile->Get("Material/Measured/DXerr_IPAcc_NewG_errGL1")));
500 
501  m_dX_PSAcc_Nom.reset(checked_own_cast<TH1*>(
502  rootFile->Get("Material/Measured/DXerr_PSAcc_NewG_errUncor")));
503  m_dX_PSAcc_LAr.reset(checked_own_cast<TH1*>(
504  rootFile->Get("Material/Measured/DXerr_PSAcc_NewG_errLAr")));
505  m_dX_PSAcc_G4.reset(checked_own_cast<TH1*>(
506  rootFile->Get("Material/Measured/DXerr_PSAcc_NewG_errG4")));
507 
508  m_convRadius.reset(checked_own_cast<TH1*>(
509  rootFile->Get("Conversions/es2012c/convRadiusMigrations")));
510  m_convFakeRate.reset(checked_own_cast<TH1*>(
511  rootFile->Get("Conversions/es2012c/convFakeRate")));
512  m_convRecoEfficiency.reset(checked_own_cast<TH1*>(
513  rootFile->Get("Conversions/es2012c/convRecoEfficiency")));
514 
515  m_begRunNumber = 195847;
516  m_endRunNumber = 219365;
517 
518  const std::string gain_filename1 = PathResolverFindCalibFile(
519  "ElectronPhotonFourMomentumCorrection/v8/FunctionsTO.root");
520  const std::string gain_filename2 = PathResolverFindCalibFile(
521  "ElectronPhotonFourMomentumCorrection/v8/FunctionsG_all.root");
522  m_gain_tool =
523  std::make_unique<egGain::GainTool>(gain_filename1, gain_filename2);
524 
525  m_e1hg_tool = std::make_unique<e1hg_systematics>(
526  PathResolverFindCalibFile("ElectronPhotonFourMomentumCorrection/v8/"
527  "e1hg_systematics_histos.root"));
528  } else if (m_esmodel == egEnergyCorr::es2012XX) {
529  m_use_etaCalo_scales = true;
531  m_resolution_tool = std::make_unique<eg_resolution>("run1");
532 
533  m_aPSNom.reset(
534  checked_own_cast<TH1*>(rootFile->Get("Scales/es2012c/alphaPS_uncor")));
535  m_daPSCor.reset(
536  checked_own_cast<TH1*>(rootFile->Get("Scales/es2012c/dalphaPS_cor")));
537  m_aS12Nom.reset(
538  checked_own_cast<TH1*>(rootFile->Get("Scales/es2012c/alphaS12_uncor")));
539  m_daS12Cor.reset(
540  checked_own_cast<TH1*>(rootFile->Get("Scales/es2012c/dalphaS12_cor")));
541 
542  m_trkSyst.reset(checked_own_cast<TH1*>(
543  rootFile->Get("Scales/es2012c/momentum_errSyst")));
544 
545  m_zeeNom.reset(checked_own_cast<TH1*>(
546  rootFile->Get("Scales/es2015PRE/alphaZee_errStat")));
547  m_zeeSyst.reset(checked_own_cast<TH1*>(
548  rootFile->Get("Scales/es2012c/alphaZee_errSyst")));
549 
550  m_resNom.reset(checked_own_cast<TH1*>(
551  rootFile->Get("Resolution/es2015PRE/ctZee_errStat")));
552  m_resSyst.reset(checked_own_cast<TH1*>(
553  rootFile->Get("Resolution/es2012c/ctZee_errSyst")));
554 
555  m_pedestalL0.reset(checked_own_cast<TH1*>(
556  rootFile->Get("Pedestals/es2012c/pedestals_l0")));
557  m_pedestalL1.reset(checked_own_cast<TH1*>(
558  rootFile->Get("Pedestals/es2012c/pedestals_l1")));
559  m_pedestalL2.reset(checked_own_cast<TH1*>(
560  rootFile->Get("Pedestals/es2012c/pedestals_l2")));
561  m_pedestalL3.reset(checked_own_cast<TH1*>(
562  rootFile->Get("Pedestals/es2012c/pedestals_l3")));
563 
564  m_dX_ID_Nom.reset(
565  checked_own_cast<TH1*>(rootFile->Get("Material/DX0_ConfigA")));
566 
567  m_dX_IPPS_Nom.reset(checked_own_cast<TH1*>(
568  rootFile->Get("Material/Measured/DXerr_IPPS_NewG_errUncor")));
569  m_dX_IPPS_LAr.reset(checked_own_cast<TH1*>(
570  rootFile->Get("Material/Measured/DXerr_IPPS_NewG_errLAr")));
571 
572  m_dX_IPAcc_Nom.reset(checked_own_cast<TH1*>(
573  rootFile->Get("Material/Measured/DXerr_IPAcc_NewG_errUncor")));
574  m_dX_IPAcc_LAr.reset(checked_own_cast<TH1*>(
575  rootFile->Get("Material/Measured/DXerr_IPAcc_NewG_errLAr")));
576  m_dX_IPAcc_G4.reset(checked_own_cast<TH1*>(
577  rootFile->Get("Material/Measured/DXerr_IPAcc_NewG_errG4")));
578  m_dX_IPAcc_GL1.reset(checked_own_cast<TH1*>(
579  rootFile->Get("Material/Measured/DXerr_IPAcc_NewG_errGL1")));
580 
581  m_dX_PSAcc_Nom.reset(checked_own_cast<TH1*>(
582  rootFile->Get("Material/Measured/DXerr_PSAcc_NewG_errUncor")));
583  m_dX_PSAcc_LAr.reset(checked_own_cast<TH1*>(
584  rootFile->Get("Material/Measured/DXerr_PSAcc_NewG_errLAr")));
585  m_dX_PSAcc_G4.reset(checked_own_cast<TH1*>(
586  rootFile->Get("Material/Measured/DXerr_PSAcc_NewG_errG4")));
587 
588  m_convRadius.reset(checked_own_cast<TH1*>(
589  rootFile->Get("Conversions/es2012c/convRadiusMigrations")));
590  m_convFakeRate.reset(checked_own_cast<TH1*>(
591  rootFile->Get("Conversions/es2012c/convFakeRate")));
592  m_convRecoEfficiency.reset(checked_own_cast<TH1*>(
593  rootFile->Get("Conversions/es2012c/convRecoEfficiency")));
594 
595  m_begRunNumber = 195847;
596  m_endRunNumber = 219365;
597 
598  const std::string gain_filename1 = PathResolverFindCalibFile(
599  "ElectronPhotonFourMomentumCorrection/v8/FunctionsTO.root");
600  const std::string gain_filename2 = PathResolverFindCalibFile(
601  "ElectronPhotonFourMomentumCorrection/v8/FunctionsG_all.root");
602  m_gain_tool =
603  std::make_unique<egGain::GainTool>(gain_filename1, gain_filename2);
604 
605  m_e1hg_tool = std::make_unique<e1hg_systematics>(
606  PathResolverFindCalibFile("ElectronPhotonFourMomentumCorrection/v8/"
607  "e1hg_systematics_histos.root"));
608  } else if (m_esmodel == egEnergyCorr::es2015PRE or
610  m_use_etaCalo_scales = true;
612  m_resolution_tool = std::make_unique<eg_resolution>("run2_pre");
613 
614  m_aPSNom.reset(
615  checked_own_cast<TH1*>(rootFile->Get("Scales/es2012c/alphaPS_uncor")));
616  m_daPSCor.reset(
617  checked_own_cast<TH1*>(rootFile->Get("Scales/es2012c/dalphaPS_cor")));
618  m_aS12Nom.reset(
619  checked_own_cast<TH1*>(rootFile->Get("Scales/es2012c/alphaS12_uncor")));
620  m_daS12Cor.reset(
621  checked_own_cast<TH1*>(rootFile->Get("Scales/es2012c/dalphaS12_cor")));
622 
623  m_trkSyst.reset(checked_own_cast<TH1*>(
624  rootFile->Get("Scales/es2012c/momentum_errSyst")));
625 
626  m_zeeNom.reset(checked_own_cast<TH1*>(
627  rootFile->Get("Scales/es2015PRE/alphaZee_errStat")));
628  m_zeeSyst.reset(checked_own_cast<TH1*>(
629  rootFile->Get("Scales/es2015PRE/alphaZee_errSyst")));
630  m_uA2MeV_2015_first2weeks_correction.reset(checked_own_cast<TH1*>(
631  rootFile->Get("Scales/es2015PRE/histo_uA2MeV_week12")));
632 
633  m_resNom.reset(checked_own_cast<TH1*>(
634  rootFile->Get("Resolution/es2015PRE/ctZee_errStat")));
635  m_resSyst.reset(checked_own_cast<TH1*>(
636  rootFile->Get("Resolution/es2015PRE/ctZee_errSyst")));
637 
638  m_pedestalL0.reset(checked_own_cast<TH1*>(
639  rootFile->Get("Pedestals/es2012c/pedestals_l0")));
640  m_pedestalL1.reset(checked_own_cast<TH1*>(
641  rootFile->Get("Pedestals/es2012c/pedestals_l1")));
642  m_pedestalL2.reset(checked_own_cast<TH1*>(
643  rootFile->Get("Pedestals/es2012c/pedestals_l2")));
644  m_pedestalL3.reset(checked_own_cast<TH1*>(
645  rootFile->Get("Pedestals/es2012c/pedestals_l3")));
646 
647  m_dX_ID_Nom.reset(
648  checked_own_cast<TH1*>(rootFile->Get("Material/DX0_ConfigA")));
649 
650  m_dX_IPPS_Nom.reset(checked_own_cast<TH1*>(
651  rootFile->Get("Material/Measured/DXerr_IPPS_NewG_errUncor")));
652  m_dX_IPPS_LAr.reset(checked_own_cast<TH1*>(
653  rootFile->Get("Material/Measured/DXerr_IPPS_NewG_errLAr")));
654 
655  m_dX_IPAcc_Nom.reset(checked_own_cast<TH1*>(
656  rootFile->Get("Material/Measured/DXerr_IPAcc_NewG_errUncor")));
657  m_dX_IPAcc_LAr.reset(checked_own_cast<TH1*>(
658  rootFile->Get("Material/Measured/DXerr_IPAcc_NewG_errLAr")));
659  m_dX_IPAcc_G4.reset(checked_own_cast<TH1*>(
660  rootFile->Get("Material/Measured/DXerr_IPAcc_NewG_errG4")));
661  m_dX_IPAcc_GL1.reset(checked_own_cast<TH1*>(
662  rootFile->Get("Material/Measured/DXerr_IPAcc_NewG_errGL1")));
663 
664  m_dX_PSAcc_Nom.reset(checked_own_cast<TH1*>(
665  rootFile->Get("Material/Measured/DXerr_PSAcc_NewG_errUncor")));
666  m_dX_PSAcc_LAr.reset(checked_own_cast<TH1*>(
667  rootFile->Get("Material/Measured/DXerr_PSAcc_NewG_errLAr")));
668  m_dX_PSAcc_G4.reset(checked_own_cast<TH1*>(
669  rootFile->Get("Material/Measured/DXerr_PSAcc_NewG_errG4")));
670 
671  m_convRadius.reset(checked_own_cast<TH1*>(
672  rootFile->Get("Conversions/es2012c/convRadiusMigrations")));
673  m_convFakeRate.reset(checked_own_cast<TH1*>(
674  rootFile->Get("Conversions/es2012c/convFakeRate")));
675  m_convRecoEfficiency.reset(checked_own_cast<TH1*>(
676  rootFile->Get("Conversions/es2012c/convRecoEfficiency")));
677 
678  m_begRunNumber = 195847;
679  m_endRunNumber = 219365;
680 
681  m_G4OverAFII_resolution_electron.reset(checked_own_cast<TH2*>(
682  rootFile->Get("FastSim/es2015/el_full_fast_resolution")));
683  m_G4OverAFII_resolution_unconverted.reset(checked_own_cast<TH2*>(
684  rootFile->Get("FastSim/es2015/ph_unconv_full_fast_resolution")));
685  m_G4OverAFII_resolution_converted.reset(checked_own_cast<TH2*>(
686  rootFile->Get("FastSim/es2015/ph_conv_full_fast_resolution")));
687 
691 
692  const std::string gain_filename1 = PathResolverFindCalibFile(
693  "ElectronPhotonFourMomentumCorrection/v8/FunctionsTO.root");
694  const std::string gain_filename2 = PathResolverFindCalibFile(
695  "ElectronPhotonFourMomentumCorrection/v8/FunctionsG_all.root");
696  m_gain_tool =
697  std::make_unique<egGain::GainTool>(gain_filename1, gain_filename2);
698 
699  m_e1hg_tool = std::make_unique<e1hg_systematics>(
700  PathResolverFindCalibFile("ElectronPhotonFourMomentumCorrection/v8/"
701  "e1hg_systematics_histos.root"));
704  m_use_etaCalo_scales = true;
706  m_resolution_tool = std::make_unique<eg_resolution>("run2_pre");
707 
708  m_aPSNom.reset(
709  checked_own_cast<TH1*>(rootFile->Get("Scales/es2012c/alphaPS_uncor")));
710  m_daPSCor.reset(
711  checked_own_cast<TH1*>(rootFile->Get("Scales/es2012c/dalphaPS_cor")));
712  m_aS12Nom.reset(
713  checked_own_cast<TH1*>(rootFile->Get("Scales/es2012c/alphaS12_uncor")));
714  m_daS12Cor.reset(
715  checked_own_cast<TH1*>(rootFile->Get("Scales/es2012c/dalphaS12_cor")));
716 
717  m_trkSyst.reset(checked_own_cast<TH1*>(
718  rootFile->Get("Scales/es2012c/momentum_errSyst")));
719 
720  m_zeeNom.reset(checked_own_cast<TH1*>(
721  rootFile->Get("Scales/es2015PRE/alphaZee_errStat")));
722  m_zeeSyst.reset(checked_own_cast<TH1*>(
723  rootFile->Get("Scales/es2015PRE/alphaZee_errSyst")));
724  m_uA2MeV_2015_first2weeks_correction.reset(checked_own_cast<TH1*>(
725  rootFile->Get("Scales/es2015PRE/histo_uA2MeV_week12")));
726 
727  m_resNom.reset(checked_own_cast<TH1*>(
728  rootFile->Get("Resolution/es2015PRE/ctZee_errStat")));
729  m_resSyst.reset(checked_own_cast<TH1*>(
730  rootFile->Get("Resolution/es2015PRE_res_improved/ctZee_errSyst")));
731 
732  m_pedestalL0.reset(checked_own_cast<TH1*>(
733  rootFile->Get("Pedestals/es2012c/pedestals_l0")));
734  m_pedestalL1.reset(checked_own_cast<TH1*>(
735  rootFile->Get("Pedestals/es2012c/pedestals_l1")));
736  m_pedestalL2.reset(checked_own_cast<TH1*>(
737  rootFile->Get("Pedestals/es2012c/pedestals_l2")));
738  m_pedestalL3.reset(checked_own_cast<TH1*>(
739  rootFile->Get("Pedestals/es2012c/pedestals_l3")));
740 
741  m_dX_ID_Nom.reset(
742  checked_own_cast<TH1*>(rootFile->Get("Material/DX0_ConfigA")));
743 
744  m_dX_IPPS_Nom.reset(checked_own_cast<TH1*>(
745  rootFile->Get("Material/Measured/DXerr_IPPS_NewG_errUncor")));
746  m_dX_IPPS_LAr.reset(checked_own_cast<TH1*>(
747  rootFile->Get("Material/Measured/DXerr_IPPS_NewG_errLAr")));
748 
749  m_dX_IPAcc_Nom.reset(checked_own_cast<TH1*>(
750  rootFile->Get("Material/Measured/DXerr_IPAcc_NewG_errUncor")));
751  m_dX_IPAcc_LAr.reset(checked_own_cast<TH1*>(
752  rootFile->Get("Material/Measured/DXerr_IPAcc_NewG_errLAr")));
753  m_dX_IPAcc_G4.reset(checked_own_cast<TH1*>(
754  rootFile->Get("Material/Measured/DXerr_IPAcc_NewG_errG4")));
755  m_dX_IPAcc_GL1.reset(checked_own_cast<TH1*>(
756  rootFile->Get("Material/Measured/DXerr_IPAcc_NewG_errGL1")));
757 
758  m_dX_PSAcc_Nom.reset(checked_own_cast<TH1*>(
759  rootFile->Get("Material/Measured/DXerr_PSAcc_NewG_errUncor")));
760  m_dX_PSAcc_LAr.reset(checked_own_cast<TH1*>(
761  rootFile->Get("Material/Measured/DXerr_PSAcc_NewG_errLAr")));
762  m_dX_PSAcc_G4.reset(checked_own_cast<TH1*>(
763  rootFile->Get("Material/Measured/DXerr_PSAcc_NewG_errG4")));
764 
765  m_convRadius.reset(checked_own_cast<TH1*>(
766  rootFile->Get("Conversions/es2012c/convRadiusMigrations")));
767  m_convFakeRate.reset(checked_own_cast<TH1*>(
768  rootFile->Get("Conversions/es2012c/convFakeRate")));
769  m_convRecoEfficiency.reset(checked_own_cast<TH1*>(
770  rootFile->Get("Conversions/es2012c/convRecoEfficiency")));
771 
772  m_begRunNumber = 195847;
773  m_endRunNumber = 219365;
774 
775  m_G4OverAFII_resolution_electron.reset(checked_own_cast<TH2*>(
776  rootFile->Get("FastSim/es2015/el_full_fast_resolution")));
777  m_G4OverAFII_resolution_unconverted.reset(checked_own_cast<TH2*>(
778  rootFile->Get("FastSim/es2015/ph_unconv_full_fast_resolution")));
779  m_G4OverAFII_resolution_converted.reset(checked_own_cast<TH2*>(
780  rootFile->Get("FastSim/es2015/ph_conv_full_fast_resolution")));
781 
785  const std::string gain_filename1 = PathResolverFindCalibFile(
786  "ElectronPhotonFourMomentumCorrection/v8/FunctionsTO.root");
787  const std::string gain_filename2 = PathResolverFindCalibFile(
788  "ElectronPhotonFourMomentumCorrection/v8/FunctionsG_all.root");
789  m_gain_tool =
790  std::make_unique<egGain::GainTool>(gain_filename1, gain_filename2);
791 
792  m_e1hg_tool = std::make_unique<e1hg_systematics>(
793  PathResolverFindCalibFile("ElectronPhotonFourMomentumCorrection/v8/"
794  "e1hg_systematics_histos.root"));
795  } else if (m_esmodel == egEnergyCorr::es2015c_summer) {
796  m_use_etaCalo_scales = true;
798  m_resolution_tool = std::make_unique<eg_resolution>("run2_pre");
799 
800  m_aPSNom.reset(
801  checked_own_cast<TH1*>(rootFile->Get("Scales/es2012c/alphaPS_uncor")));
802  m_daPSCor.reset(
803  checked_own_cast<TH1*>(rootFile->Get("Scales/es2012c/dalphaPS_cor")));
804  m_aS12Nom.reset(
805  checked_own_cast<TH1*>(rootFile->Get("Scales/es2012c/alphaS12_uncor")));
806  m_daS12Cor.reset(
807  checked_own_cast<TH1*>(rootFile->Get("Scales/es2012c/dalphaS12_cor")));
808 
809  m_trkSyst.reset(checked_own_cast<TH1*>(
810  rootFile->Get("Scales/es2012c/momentum_errSyst")));
811 
812  m_zeeNom.reset(checked_own_cast<TH1*>(
813  rootFile->Get("Scales/es2015Summer/alphaZee_errStat")));
814  m_zeeSyst.reset(checked_own_cast<TH1*>(
815  rootFile->Get("Scales/es2015Summer/alphaZee_errSyst")));
817 
818  m_resNom.reset(checked_own_cast<TH1*>(
819  rootFile->Get("Resolution/es2015Summer/ctZee_errStat")));
820  m_resSyst.reset(checked_own_cast<TH1*>(
821  rootFile->Get("Resolution/es2015Summer/ctZee_errSyst")));
822 
823  m_pedestalL0.reset(checked_own_cast<TH1*>(
824  rootFile->Get("Pedestals/es2012c/pedestals_l0")));
825  m_pedestalL1.reset(checked_own_cast<TH1*>(
826  rootFile->Get("Pedestals/es2012c/pedestals_l1")));
827  m_pedestalL2.reset(checked_own_cast<TH1*>(
828  rootFile->Get("Pedestals/es2012c/pedestals_l2")));
829  m_pedestalL3.reset(checked_own_cast<TH1*>(
830  rootFile->Get("Pedestals/es2012c/pedestals_l3")));
831 
832  m_dX_ID_Nom.reset(
833  checked_own_cast<TH1*>(rootFile->Get("Material/DX0_ConfigA")));
834 
835  m_dX_IPPS_Nom.reset(checked_own_cast<TH1*>(
836  rootFile->Get("Material/Measured/DXerr_IPPS_NewG_errUncor")));
837  m_dX_IPPS_LAr.reset(checked_own_cast<TH1*>(
838  rootFile->Get("Material/Measured/DXerr_IPPS_NewG_errLAr")));
839 
840  m_dX_IPAcc_Nom.reset(checked_own_cast<TH1*>(
841  rootFile->Get("Material/Measured/DXerr_IPAcc_NewG_errUncor")));
842  m_dX_IPAcc_LAr.reset(checked_own_cast<TH1*>(
843  rootFile->Get("Material/Measured/DXerr_IPAcc_NewG_errLAr")));
844  m_dX_IPAcc_G4.reset(checked_own_cast<TH1*>(
845  rootFile->Get("Material/Measured/DXerr_IPAcc_NewG_errG4")));
846  m_dX_IPAcc_GL1.reset(checked_own_cast<TH1*>(
847  rootFile->Get("Material/Measured/DXerr_IPAcc_NewG_errGL1")));
848 
849  m_dX_PSAcc_Nom.reset(checked_own_cast<TH1*>(
850  rootFile->Get("Material/Measured/DXerr_PSAcc_NewG_errUncor")));
851  m_dX_PSAcc_LAr.reset(checked_own_cast<TH1*>(
852  rootFile->Get("Material/Measured/DXerr_PSAcc_NewG_errLAr")));
853  m_dX_PSAcc_G4.reset(checked_own_cast<TH1*>(
854  rootFile->Get("Material/Measured/DXerr_PSAcc_NewG_errG4")));
855 
856  m_convRadius.reset(checked_own_cast<TH1*>(
857  rootFile->Get("Conversions/es2012c/convRadiusMigrations")));
858  m_convFakeRate.reset(checked_own_cast<TH1*>(
859  rootFile->Get("Conversions/es2012c/convFakeRate")));
860  m_convRecoEfficiency.reset(checked_own_cast<TH1*>(
861  rootFile->Get("Conversions/es2012c/convRecoEfficiency")));
862 
863  m_begRunNumber = 195847;
864  m_endRunNumber = 219365;
865 
866  m_G4OverAFII_resolution_electron.reset(checked_own_cast<TH2*>(
867  rootFile->Get("FastSim/es2015/el_full_fast_resolution")));
868  m_G4OverAFII_resolution_unconverted.reset(checked_own_cast<TH2*>(
869  rootFile->Get("FastSim/es2015/ph_unconv_full_fast_resolution")));
870  m_G4OverAFII_resolution_converted.reset(checked_own_cast<TH2*>(
871  rootFile->Get("FastSim/es2015/ph_conv_full_fast_resolution")));
872 
876 
877  const std::string gain_filename1 = PathResolverFindCalibFile(
878  "ElectronPhotonFourMomentumCorrection/v8/FunctionsTO.root");
879  const std::string gain_filename2 = PathResolverFindCalibFile(
880  "ElectronPhotonFourMomentumCorrection/v8/FunctionsG_all.root");
881  m_gain_tool =
882  std::make_unique<egGain::GainTool>(gain_filename1, gain_filename2);
883 
884  m_e1hg_tool = std::make_unique<e1hg_systematics>(
885  PathResolverFindCalibFile("ElectronPhotonFourMomentumCorrection/v8/"
886  "e1hg_systematics_histos.root"));
887  m_use_temp_correction201215 = true; // for eta > 2.5
889  } else if (m_esmodel == egEnergyCorr::es2016PRE) {
890  m_use_etaCalo_scales = true;
892  m_resolution_tool = std::make_unique<eg_resolution>("run2_pre");
893 
894  m_aPSNom.reset(
895  checked_own_cast<TH1*>(rootFile->Get("Scales/es2012c/alphaPS_uncor")));
896  m_daPSCor.reset(
897  checked_own_cast<TH1*>(rootFile->Get("Scales/es2012c/dalphaPS_cor")));
898  m_aS12Nom.reset(
899  checked_own_cast<TH1*>(rootFile->Get("Scales/es2012c/alphaS12_uncor")));
900  m_daS12Cor.reset(
901  checked_own_cast<TH1*>(rootFile->Get("Scales/es2012c/dalphaS12_cor")));
902 
903  m_trkSyst.reset(checked_own_cast<TH1*>(
904  rootFile->Get("Scales/es2012c/momentum_errSyst")));
905 
906  m_zeeNom.reset(checked_own_cast<TH1*>(
907  rootFile->Get("Scales/es2015Summer/alphaZee_errStat")));
908  m_zeeSyst.reset(checked_own_cast<TH1*>(
909  rootFile->Get("Scales/es2015Summer/alphaZee_errSyst")));
910 
911  m_resNom.reset(checked_own_cast<TH1*>(
912  rootFile->Get("Resolution/es2015Summer/ctZee_errStat")));
913  m_resSyst.reset(checked_own_cast<TH1*>(
914  rootFile->Get("Resolution/es2015Summer/ctZee_errSyst")));
915 
916  m_pedestalL0.reset(checked_own_cast<TH1*>(
917  rootFile->Get("Pedestals/es2012c/pedestals_l0")));
918  m_pedestalL1.reset(checked_own_cast<TH1*>(
919  rootFile->Get("Pedestals/es2012c/pedestals_l1")));
920  m_pedestalL2.reset(checked_own_cast<TH1*>(
921  rootFile->Get("Pedestals/es2012c/pedestals_l2")));
922  m_pedestalL3.reset(checked_own_cast<TH1*>(
923  rootFile->Get("Pedestals/es2012c/pedestals_l3")));
924 
925  m_dX_ID_Nom.reset(
926  checked_own_cast<TH1*>(rootFile->Get("Material/DX0_ConfigA")));
927 
928  m_dX_IPPS_Nom.reset(checked_own_cast<TH1*>(
929  rootFile->Get("Material/Measured/DXerr_IPPS_NewG_errUncor")));
930  m_dX_IPPS_LAr.reset(checked_own_cast<TH1*>(
931  rootFile->Get("Material/Measured/DXerr_IPPS_NewG_errLAr")));
932 
933  m_dX_IPAcc_Nom.reset(checked_own_cast<TH1*>(
934  rootFile->Get("Material/Measured/DXerr_IPAcc_NewG_errUncor")));
935  m_dX_IPAcc_LAr.reset(checked_own_cast<TH1*>(
936  rootFile->Get("Material/Measured/DXerr_IPAcc_NewG_errLAr")));
937  m_dX_IPAcc_G4.reset(checked_own_cast<TH1*>(
938  rootFile->Get("Material/Measured/DXerr_IPAcc_NewG_errG4")));
939  m_dX_IPAcc_GL1.reset(checked_own_cast<TH1*>(
940  rootFile->Get("Material/Measured/DXerr_IPAcc_NewG_errGL1")));
941 
942  m_dX_PSAcc_Nom.reset(checked_own_cast<TH1*>(
943  rootFile->Get("Material/Measured/DXerr_PSAcc_NewG_errUncor")));
944  m_dX_PSAcc_LAr.reset(checked_own_cast<TH1*>(
945  rootFile->Get("Material/Measured/DXerr_PSAcc_NewG_errLAr")));
946  m_dX_PSAcc_G4.reset(checked_own_cast<TH1*>(
947  rootFile->Get("Material/Measured/DXerr_PSAcc_NewG_errG4")));
948 
949  m_convRadius.reset(checked_own_cast<TH1*>(
950  rootFile->Get("Conversions/es2012c/convRadiusMigrations")));
951  m_convFakeRate.reset(checked_own_cast<TH1*>(
952  rootFile->Get("Conversions/es2012c/convFakeRate")));
953  m_convRecoEfficiency.reset(checked_own_cast<TH1*>(
954  rootFile->Get("Conversions/es2012c/convRecoEfficiency")));
955 
956  m_begRunNumber = 195847;
957  m_endRunNumber = 219365;
958 
959  m_G4OverAFII_resolution_electron.reset(checked_own_cast<TH2*>(
960  rootFile->Get("FastSim/es2015/el_full_fast_resolution")));
961  m_G4OverAFII_resolution_unconverted.reset(checked_own_cast<TH2*>(
962  rootFile->Get("FastSim/es2015/ph_unconv_full_fast_resolution")));
963  m_G4OverAFII_resolution_converted.reset(checked_own_cast<TH2*>(
964  rootFile->Get("FastSim/es2015/ph_conv_full_fast_resolution")));
965 
969 
970  const std::string gain_filename1 = PathResolverFindCalibFile(
971  "ElectronPhotonFourMomentumCorrection/v8/FunctionsTO.root");
972  const std::string gain_filename2 = PathResolverFindCalibFile(
973  "ElectronPhotonFourMomentumCorrection/v8/FunctionsG_all.root");
974  m_gain_tool =
975  std::make_unique<egGain::GainTool>(gain_filename1, gain_filename2);
976 
977  m_e1hg_tool = std::make_unique<e1hg_systematics>(
978  PathResolverFindCalibFile("ElectronPhotonFourMomentumCorrection/v8/"
979  "e1hg_systematics_histos.root"));
980 
981  m_use_temp_correction201215 = true; // for eta > 2.5
983  } else if (m_esmodel == egEnergyCorr::es2017 or
998  m_esmodel == egEnergyCorr::es2024_Run3_v0) { // add release 21
999  // here for now
1000  m_use_etaCalo_scales = true;
1011  m_resolution_tool = std::make_unique<eg_resolution>("run2_R21_v1");
1012  } else {
1013  m_resolution_tool = std::make_unique<eg_resolution>("run2_pre");
1014  }
1015 
1023  m_aPSNom.reset(checked_own_cast<TH1*>(
1024  rootFile->Get("Scales/es2017_summer_final/alphaPS_uncor")));
1025  m_daPSb12.reset(checked_own_cast<TH1*>(
1026  rootFile->Get("Scales/es2017_summer_final/dalphaPS_b12")));
1027  m_daPSCor.reset(
1028  checked_own_cast<TH1*>(rootFile->Get("Scales/es2012c/dalphaPS_cor")));
1029  m_aS12Nom.reset(checked_own_cast<TH1*>(
1030  rootFile->Get("Scales/es2017_summer_final/alphaS12_uncor")));
1031  m_daS12Cor.reset(checked_own_cast<TH1*>(
1032  rootFile->Get("Scales/es2012c/dalphaS12_cor")));
1033  } else if (m_esmodel == egEnergyCorr::es2018_R21_v1) {
1034  m_aPSNom.reset(checked_own_cast<TH1*>(
1035  rootFile->Get("Scales/es2017_summer_final/alphaPS_uncor")));
1036  m_daPSb12.reset(checked_own_cast<TH1*>(
1037  rootFile->Get("Scales/es2017_summer_final/dalphaPS_b12")));
1038  m_daPSCor.reset(
1039  checked_own_cast<TH1*>(rootFile->Get("Scales/es2012c/dalphaPS_cor")));
1040  m_aS12Nom.reset(checked_own_cast<TH1*>(
1041  rootFile->Get("Scales/es2018_R21_v1/alphaS12_uncor")));
1042  m_daS12Cor.reset(checked_own_cast<TH1*>(
1043  rootFile->Get("Scales/es2012c/dalphaS12_cor")));
1045  m_aPSNom.reset(checked_own_cast<TH1*>(
1046  rootFile->Get("Scales/es2023_R22_Run2_v0/alphaPS_uncor")));
1047  m_aS12Nom.reset(checked_own_cast<TH1*>(
1048  rootFile->Get("Scales/es2023_R22_Run2_v0/alphaS12_uncor")));
1051  // es2024_Run3_v0 has different central value but same systematic
1052  m_aPSNom.reset(checked_own_cast<TH1*>(
1053  rootFile->Get("Scales/es2023_R22_Run2_v0/alphaPS_uncor")));
1054  m_aS12Nom.reset(checked_own_cast<TH1*>(
1055  rootFile->Get("Scales/es2023_R22_Run2_v1/hE1E2_emu_run2_rel21_v0_fix")));
1056  } else {
1057  m_aPSNom.reset(checked_own_cast<TH1*>(
1058  rootFile->Get("Scales/es2012c/alphaPS_uncor")));
1059  m_daPSCor.reset(
1060  checked_own_cast<TH1*>(rootFile->Get("Scales/es2012c/dalphaPS_cor")));
1061  m_aS12Nom.reset(checked_own_cast<TH1*>(
1062  rootFile->Get("Scales/es2012c/alphaS12_uncor")));
1063  m_daS12Cor.reset(checked_own_cast<TH1*>(
1064  rootFile->Get("Scales/es2012c/dalphaS12_cor")));
1065  }
1066  m_trkSyst.reset(checked_own_cast<TH1*>(
1067  rootFile->Get("Scales/es2012c/momentum_errSyst")));
1068 
1070  m_zeeNom.reset(checked_own_cast<TH1*>(
1071  rootFile->Get("Scales/es2017/alphaZee_errStat_period_2016")));
1072  m_zeeNom_data2015.reset(checked_own_cast<TH1*>(
1073  rootFile->Get("Scales/es2017/alphaZee_errStat_period_2015")));
1074  } else if (m_esmodel == egEnergyCorr::es2017_summer or
1076  m_zeeNom.reset(checked_own_cast<TH1*>(
1077  rootFile->Get("Scales/es2017_summer/alphaZee_errStat_period_2016")));
1078  m_zeeNom_data2015.reset(checked_own_cast<TH1*>(
1079  rootFile->Get("Scales/es2017_summer/alphaZee_errStat_period_2015")));
1081  m_zeeNom.reset(checked_own_cast<TH1*>(rootFile->Get(
1082  "Scales/es2017_summer_final/alphaZee_errStat_period_2016")));
1083  m_zeeNom_data2015.reset(checked_own_cast<TH1*>(rootFile->Get(
1084  "Scales/es2017_summer_final/alphaZee_errStat_period_2015")));
1085  } else if (m_esmodel == egEnergyCorr::es2015_5TeV) {
1086  m_zeeNom.reset(checked_own_cast<TH1*>(
1087  rootFile->Get("Scales/es2015_5TeV/alphaZee_errStat_period_2015")));
1088  // Same histogram added twice for simplicity
1089  m_zeeNom_data2015.reset(checked_own_cast<TH1*>(
1090  rootFile->Get("Scales/es2015_5TeV/alphaZee_errStat_period_2015")));
1091  } else if (m_esmodel == egEnergyCorr::es2017_R21_v0) {
1092  m_zeeNom.reset(checked_own_cast<TH1*>(
1093  rootFile->Get("Scales/es2017_R21_v0/alphaZee_errStat_period_2017")));
1094  m_zeeNom_data2016.reset(checked_own_cast<TH1*>(
1095  rootFile->Get("Scales/es2017_R21_v0/alphaZee_errStat_period_2016")));
1096  m_zeeNom_data2015.reset(checked_own_cast<TH1*>(
1097  rootFile->Get("Scales/es2017_R21_v0/alphaZee_errStat_period_2015")));
1098  } else if (m_esmodel == egEnergyCorr::es2017_R21_v1) {
1099  m_zeeNom.reset(checked_own_cast<TH1*>(
1100  rootFile->Get("Scales/es2017_R21_v1/alphaZee_errStat_period_2017")));
1101  m_zeeNom_data2016.reset(checked_own_cast<TH1*>(
1102  rootFile->Get("Scales/es2017_R21_v1/alphaZee_errStat_period_2016")));
1103  m_zeeNom_data2015.reset(checked_own_cast<TH1*>(
1104  rootFile->Get("Scales/es2017_R21_v1/alphaZee_errStat_period_2015")));
1105  m_zeeFwdk.reset(checked_own_cast<TH1*>(
1106  rootFile->Get("Scales/es2017_R21_v1/alphaFwd_Finalk")));
1107  m_zeeFwdb.reset(checked_own_cast<TH1*>(
1108  rootFile->Get("Scales/es2017_R21_v1/alphaFwd_Finalb")));
1110  m_zeeNom.reset(checked_own_cast<TH1*>(rootFile->Get(
1111  "Scales/es2017_R21_ofc0_v1/alphaZee_errStat_period_2017")));
1112  m_zeeNom_data2016.reset(checked_own_cast<TH1*>(rootFile->Get(
1113  "Scales/es2017_R21_ofc0_v1/alphaZee_errStat_period_2016")));
1114  m_zeeNom_data2015.reset(checked_own_cast<TH1*>(rootFile->Get(
1115  "Scales/es2017_R21_ofc0_v1/alphaZee_errStat_period_2015")));
1116  m_zeeNom_data2018.reset(checked_own_cast<TH1*>(rootFile->Get(
1117  "Scales/es2017_R21_ofc0_v1/alphaZee_errStat_period_2018")));
1118  m_zeeFwdk.reset(checked_own_cast<TH1*>(
1119  rootFile->Get("Scales/es2017_R21_v1/alphaFwd_Finalk")));
1120  m_zeeFwdb.reset(checked_own_cast<TH1*>(
1121  rootFile->Get("Scales/es2017_R21_v1/alphaFwd_Finalb")));
1123  m_zeeNom.reset(checked_own_cast<TH1*>(rootFile->Get(
1124  "Scales/es2024_Run3_ofc0_v0/alphaZee_errStat")));
1125  m_zeeFwdk.reset(checked_own_cast<TH1*>(
1126  rootFile->Get("Scales/es2017_R21_v1/alphaFwd_Finalk")));
1127  m_zeeFwdb.reset(checked_own_cast<TH1*>(
1128  rootFile->Get("Scales/es2017_R21_v1/alphaFwd_Finalb")));
1129  } else if (m_esmodel == egEnergyCorr::es2018_R21_v0) {
1130 
1131  m_zeeNom.reset(checked_own_cast<TH1*>(
1132  rootFile->Get("Scales/es2018_R21_v0/alphaZee_errStat_period_2018")));
1133  m_zeeNom_data2017.reset(checked_own_cast<TH1*>(
1134  rootFile->Get("Scales/es2018_R21_v0/alphaZee_errStat_period_2017")));
1135  m_zeeNom_data2016.reset(checked_own_cast<TH1*>(
1136  rootFile->Get("Scales/es2018_R21_v0/alphaZee_errStat_period_2016")));
1137  m_zeeNom_data2015.reset(checked_own_cast<TH1*>(
1138  rootFile->Get("Scales/es2018_R21_v0/alphaZee_errStat_period_2015")));
1139  m_zeeFwdk.reset(checked_own_cast<TH1*>(
1140  rootFile->Get("Scales/es2018_R21_v0/alphaFwd_Finalk")));
1141  m_zeeFwdb.reset(checked_own_cast<TH1*>(
1142  rootFile->Get("Scales/es2018_R21_v0/alphaFwd_Finalb")));
1143  } else if (m_esmodel == egEnergyCorr::es2018_R21_v1) {
1144  m_zeeNom.reset(checked_own_cast<TH1*>(
1145  rootFile->Get("Scales/es2018_R21_v1/alphaZee_errStat_period_2018")));
1146  m_zeeNom_data2017.reset(checked_own_cast<TH1*>(
1147  rootFile->Get("Scales/es2018_R21_v1/alphaZee_errStat_period_2017")));
1148  m_zeeNom_data2016.reset(checked_own_cast<TH1*>(
1149  rootFile->Get("Scales/es2018_R21_v1/alphaZee_errStat_period_2016")));
1150  m_zeeNom_data2015.reset(checked_own_cast<TH1*>(
1151  rootFile->Get("Scales/es2018_R21_v1/alphaZee_errStat_period_2015")));
1152  // same as in v0 model
1153  m_zeeFwdk.reset(checked_own_cast<TH1*>(
1154  rootFile->Get("Scales/es2018_R21_v0/alphaFwd_Finalk")));
1155  m_zeeFwdb.reset(checked_own_cast<TH1*>(
1156  rootFile->Get("Scales/es2018_R21_v0/alphaFwd_Finalb")));
1157  } else if (m_esmodel == egEnergyCorr::es2022_R22_PRE) {
1158  m_zeeNom.reset(checked_own_cast<TH1*>(
1159  rootFile->Get("Scales/es2022_R22_PRE/alphaZee_errStat_period_2018")));
1160  // same as in v0 model
1161  m_zeeFwdk.reset(checked_own_cast<TH1*>(
1162  rootFile->Get("Scales/es2018_R21_v0/alphaFwd_Finalk")));
1163  m_zeeFwdb.reset(checked_own_cast<TH1*>(
1164  rootFile->Get("Scales/es2018_R21_v0/alphaFwd_Finalb")));
1166  m_zeeNom.reset(checked_own_cast<TH1*>(rootFile->Get(
1167  "Scales/es2023_R22_Run2_v0/alphaZee_errStat_period_2018")));
1168  m_zeeNom_data2017.reset(checked_own_cast<TH1*>(rootFile->Get(
1169  "Scales/es2023_R22_Run2_v0/alphaZee_errStat_period_2017")));
1170  m_zeeNom_data2016.reset(checked_own_cast<TH1*>(rootFile->Get(
1171  "Scales/es2023_R22_Run2_v0/alphaZee_errStat_period_2016")));
1172  m_zeeNom_data2015.reset(checked_own_cast<TH1*>(rootFile->Get(
1173  "Scales/es2023_R22_Run2_v0/alphaZee_errStat_period_2015")));
1174  // same as in v0 model
1175  m_zeeFwdk.reset(checked_own_cast<TH1*>(
1176  rootFile->Get("Scales/es2018_R21_v0/alphaFwd_Finalk")));
1177  m_zeeFwdb.reset(checked_own_cast<TH1*>(
1178  rootFile->Get("Scales/es2018_R21_v0/alphaFwd_Finalb")));
1180  // based on fixed E1E2
1181  m_zeeNom.reset(checked_own_cast<TH1*>(rootFile->Get(
1182  "Scales/es2023_R22_Run2_v1/alphaZee_errStat_period_2018")));
1183  m_zeeNom_data2017.reset(checked_own_cast<TH1*>(rootFile->Get(
1184  "Scales/es2023_R22_Run2_v1/alphaZee_errStat_period_2017")));
1185  m_zeeNom_data2016.reset(checked_own_cast<TH1*>(rootFile->Get(
1186  "Scales/es2023_R22_Run2_v1/alphaZee_errStat_period_2016")));
1187  m_zeeNom_data2015.reset(checked_own_cast<TH1*>(rootFile->Get(
1188  "Scales/es2023_R22_Run2_v1/alphaZee_errStat_period_2015")));
1189  // same as in v0 model
1190  m_zeeFwdk.reset(checked_own_cast<TH1*>(
1191  rootFile->Get("Scales/es2018_R21_v0/alphaFwd_Finalk")));
1192  m_zeeFwdb.reset(checked_own_cast<TH1*>(
1193  rootFile->Get("Scales/es2018_R21_v0/alphaFwd_Finalb")));
1194  } else if (m_esmodel == egEnergyCorr::es2024_Run3_v0) {
1195  m_zeeNom.reset(checked_own_cast<TH1*>(
1196  rootFile->Get("Scales/es2024_Run3_v0/alphaZee_errStat_period_2024")));
1197  m_zeeNom_data2023.reset(checked_own_cast<TH1*>(
1198  rootFile->Get("Scales/es2024_Run3_v0/alphaZee_errStat_period_2023")));
1199  m_zeeNom_data2022.reset(checked_own_cast<TH1*>(
1200  rootFile->Get("Scales/es2024_Run3_v0/alphaZee_errStat_period_2022")));
1201  } else {
1202  m_zeeNom.reset(checked_own_cast<TH1*>(
1203  rootFile->Get("Scales/es2017_R21_PRE/alphaZee_errStat_period_2016")));
1204  // SAME HISTO FOR 2015 FOR NOW
1205  m_zeeNom_data2015.reset(checked_own_cast<TH1*>(
1206  rootFile->Get("Scales/es2017_R21_PRE/alphaZee_errStat_period_2016")));
1207  }
1209  m_zeeSyst.reset(checked_own_cast<TH1*>(
1210  rootFile->Get("Scales/es2017/alphaZee_errSyst")));
1212  m_zeeSyst.reset(checked_own_cast<TH1*>(
1213  rootFile->Get("Scales/es2017_summer_final/alphaZee_errSyst")));
1214  } else if (m_esmodel == egEnergyCorr::es2015_5TeV) {
1215  m_zeeSyst.reset(checked_own_cast<TH1*>(
1216  rootFile->Get("Scales/es2015_5TeV/alphaZee_errSyst")));
1217  } else if (m_esmodel == egEnergyCorr::es2017_R21_v0) {
1218  m_zeeSyst.reset(checked_own_cast<TH1*>(
1219  rootFile->Get("Scales/es2017_summer_final/alphaZee_errSyst")));
1220  } else if (m_esmodel == egEnergyCorr::es2017_R21_v1) {
1221  m_zeeSyst.reset(checked_own_cast<TH1*>(
1222  rootFile->Get("Scales/es2017_R21_v1/alphaZee_errSyst")));
1224  m_zeeSyst.reset(checked_own_cast<TH1*>(
1225  rootFile->Get("Scales/es2017_R21_ofc0_v1/alphaZee_errSyst")));
1227  m_zeeSyst.reset(checked_own_cast<TH1*>(
1228  rootFile->Get("Scales/es2024_Run3_ofc0_v0/alphaZee_errSyst")));
1229  } else if (m_esmodel == egEnergyCorr::es2018_R21_v0) {
1230  m_zeeSyst.reset(checked_own_cast<TH1*>(
1231  rootFile->Get("Scales/es2018_R21_v0/alphaZee_errSyst")));
1232  } else if (m_esmodel == egEnergyCorr::es2018_R21_v1 ||
1236  m_zeeSyst.reset(checked_own_cast<TH1*>(
1237  rootFile->Get("Scales/es2018_R21_v1/alphaZee_errSyst")));
1238  } else if (m_esmodel == egEnergyCorr::es2022_R22_PRE) {
1239  m_zeeSyst.reset(checked_own_cast<TH1*>(
1240  rootFile->Get("Scales/es2022_R22_PRE/alphaZee_errSyst")));
1241  m_zeeSystOFC.reset(checked_own_cast<TH1*>(
1242  rootFile->Get("Scales/es2022_R22_PRE/alphaZee_errOFCSyst")));
1243  } else {
1244  m_zeeSyst.reset(checked_own_cast<TH1*>(
1245  rootFile->Get("Scales/es2017_summer/alphaZee_errSyst")));
1246  }
1247 
1250  m_resNom.reset(checked_own_cast<TH1*>(
1251  rootFile->Get("Resolution/es2017/ctZee_errStat")));
1252  } else if (m_esmodel == egEnergyCorr::es2017_summer or
1255  m_resNom.reset(checked_own_cast<TH1*>(
1256  rootFile->Get("Resolution/es2017_summer/ctZee_errStat")));
1258  m_resNom.reset(checked_own_cast<TH1*>(
1259  rootFile->Get("Resolution/es2017_summer_final/ctZee_errStat")));
1260  } else if (m_esmodel == egEnergyCorr::es2017_R21_v0) {
1261  m_resNom.reset(checked_own_cast<TH1*>(
1262  rootFile->Get("Resolution/es2017_R21_v0/ctZee_errStat")));
1263  } else if (m_esmodel == egEnergyCorr::es2017_R21_v1) {
1264  m_resNom.reset(checked_own_cast<TH1*>(
1265  rootFile->Get("Resolution/es2017_R21_v1/ctZee_errStat")));
1267  m_resNom.reset(checked_own_cast<TH1*>(
1268  rootFile->Get("Resolution/es2017_R21_ofc0_v1/ctZee_errStat")));
1270  // use same resolution smearing as run 2 ofc0 recommendation
1271  m_resNom.reset(checked_own_cast<TH1*>(
1272  rootFile->Get("Resolution/es2017_R21_ofc0_v1/ctZee_errStat")));
1273  } else if (m_esmodel == egEnergyCorr::es2018_R21_v0) {
1274  m_resNom.reset(checked_own_cast<TH1*>(
1275  rootFile->Get("Resolution/es2018_R21_v0/ctZee_errStat")));
1276  } else if (m_esmodel == egEnergyCorr::es2018_R21_v1) {
1277  m_resNom.reset(checked_own_cast<TH1*>(
1278  rootFile->Get("Resolution/es2018_R21_v1/ctZee_errStat")));
1279  } else if (m_esmodel == egEnergyCorr::es2022_R22_PRE) {
1280  m_resNom.reset(checked_own_cast<TH1*>(
1281  rootFile->Get("Resolution/es2022_R22_PRE/ctZee_errStat")));
1283  m_resNom.reset(checked_own_cast<TH1*>(
1284  rootFile->Get("Resolution/es2023_R22_Run2_v0/ctZee_errStat")));
1286  m_resNom.reset(checked_own_cast<TH1*>(
1287  rootFile->Get("Resolution/es2023_R22_Run2_v1/ctZee_errStat")));
1288  } else if (m_esmodel == egEnergyCorr::es2024_Run3_v0) {
1289  m_resNom.reset(checked_own_cast<TH1*>(
1290  rootFile->Get("Resolution/es2024_Run3_v0/ctZee_errStat")));
1291  } else {
1292  m_resNom.reset(checked_own_cast<TH1*>(
1293  rootFile->Get("Resolution/es2017_R21_PRE/ctZee_errStat")));
1294  }
1295 
1297  m_resSyst.reset(checked_own_cast<TH1*>(
1298  rootFile->Get("Resolution/es2017/ctZee_errSyst")));
1300  m_resSyst.reset(checked_own_cast<TH1*>(
1301  rootFile->Get("Resolution/es2017_summer_final/ctZee_errSyst")));
1302  } else if (m_esmodel == egEnergyCorr::es2015_5TeV) {
1303  m_resSyst.reset(checked_own_cast<TH1*>(
1304  rootFile->Get("Resolution/es2015_5TeV/ctZee_errSyst")));
1305  } else if (m_esmodel == egEnergyCorr::es2017_R21_v0) {
1306  m_resSyst.reset(checked_own_cast<TH1*>(
1307  rootFile->Get("Resolution/es2017_summer_final/ctZee_errSyst")));
1308  } else if (m_esmodel == egEnergyCorr::es2017_R21_v1) {
1309  m_resSyst.reset(checked_own_cast<TH1*>(
1310  rootFile->Get("Resolution/es2017_R21_v1/ctZee_errSyst")));
1312  m_resSyst.reset(checked_own_cast<TH1*>(
1313  rootFile->Get("Resolution/es2017_R21_ofc0_v1/ctZee_errSyst")));
1315  // use same resolution smearing syst as run 2 ofc0 recommendataion
1316  m_resSyst.reset(checked_own_cast<TH1*>(
1317  rootFile->Get("Resolution/es2017_R21_ofc0_v1/ctZee_errSyst")));
1318  } else if (m_esmodel == egEnergyCorr::es2018_R21_v0) {
1319  m_resSyst.reset(checked_own_cast<TH1*>(
1320  rootFile->Get("Resolution/es2018_R21_v0/ctZee_errSyst")));
1321  } else if (m_esmodel == egEnergyCorr::es2018_R21_v1 ||
1325  m_resSyst.reset(checked_own_cast<TH1*>(
1326  rootFile->Get("Resolution/es2018_R21_v1/ctZee_errSyst")));
1327  } else if (m_esmodel == egEnergyCorr::es2022_R22_PRE) {
1328  m_resSyst.reset(checked_own_cast<TH1*>(
1329  rootFile->Get("Resolution/es2022_R22_PRE/ctZee_errSyst")));
1330  m_resSystOFC.reset(checked_own_cast<TH1*>(
1331  rootFile->Get("Resolution/es2022_R22_PRE/ctZee_errOFCSyst")));
1332  } else {
1333  m_resSyst.reset(checked_own_cast<TH1*>(
1334  rootFile->Get("Resolution/es2017_summer/ctZee_errSyst")));
1335  }
1336  // else{
1337  // m_resSyst.reset( checked_own_cast< TH1* >(
1338  // rootFile->Get("Resolution/es2017_summer_improved/ctZee_errSyst")));
1339  // }
1340 
1341  m_pedestals_es2017.reset(
1342  checked_own_cast<TH1*>(rootFile->Get("Pedestals/es2017/pedestals")));
1343 
1344  m_dX_ID_Nom.reset(
1345  checked_own_cast<TH1*>(rootFile->Get("Material/DX0_ConfigA")));
1346 
1347  m_dX_IPPS_Nom.reset(checked_own_cast<TH1*>(
1348  rootFile->Get("Material/Measured/DXerr_IPPS_NewG_errUncor")));
1349  m_dX_IPPS_LAr.reset(checked_own_cast<TH1*>(
1350  rootFile->Get("Material/Measured/DXerr_IPPS_NewG_errLAr")));
1351 
1352  m_dX_IPAcc_Nom.reset(checked_own_cast<TH1*>(
1353  rootFile->Get("Material/Measured/DXerr_IPAcc_NewG_errUncor")));
1354  m_dX_IPAcc_LAr.reset(checked_own_cast<TH1*>(
1355  rootFile->Get("Material/Measured/DXerr_IPAcc_NewG_errLAr")));
1356  m_dX_IPAcc_G4.reset(checked_own_cast<TH1*>(
1357  rootFile->Get("Material/Measured/DXerr_IPAcc_NewG_errG4")));
1358  m_dX_IPAcc_GL1.reset(checked_own_cast<TH1*>(
1359  rootFile->Get("Material/Measured/DXerr_IPAcc_NewG_errGL1")));
1360 
1361  m_dX_PSAcc_Nom.reset(checked_own_cast<TH1*>(
1362  rootFile->Get("Material/Measured/DXerr_PSAcc_NewG_errUncor")));
1363  m_dX_PSAcc_LAr.reset(checked_own_cast<TH1*>(
1364  rootFile->Get("Material/Measured/DXerr_PSAcc_NewG_errLAr")));
1365  m_dX_PSAcc_G4.reset(checked_own_cast<TH1*>(
1366  rootFile->Get("Material/Measured/DXerr_PSAcc_NewG_errG4")));
1367 
1368  m_convRadius.reset(checked_own_cast<TH1*>(
1369  rootFile->Get("Conversions/es2012c/convRadiusMigrations")));
1371  m_convFakeRate.reset(checked_own_cast<TH1*>(
1372  rootFile->Get("Conversions/es2012c/convFakeRate")));
1373  m_convRecoEfficiency.reset(checked_own_cast<TH1*>(
1374  rootFile->Get("Conversions/es2012c/convRecoEfficiency")));
1377  m_convFakeRate_2D.reset(checked_own_cast<TH2*>(
1378  rootFile->Get("Conversions/es2023_R22_Run2_v0/convFakeRate")));
1379  m_convRecoEfficiency_2D.reset(checked_own_cast<TH2*>(
1380  rootFile->Get("Conversions/es2023_R22_Run2_v0/convRecoEfficiency")));
1381  } else if (m_esmodel == egEnergyCorr::es2024_Run3_v0) {
1382  m_convFakeRate_2D.reset(checked_own_cast<TH2*>(
1383  rootFile->Get("Conversions/es2024_Run3_v0/conv_energybias")));
1384  m_convRecoEfficiency_2D.reset(checked_own_cast<TH2*>(
1385  rootFile->Get("Conversions/es2024_Run3_v0/unconv_energybias")));
1386  } else {
1387  m_convFakeRate.reset(checked_own_cast<TH1*>(
1388  rootFile->Get("Conversions/es2017_summer/convFakeRate")));
1389  m_convRecoEfficiency.reset(checked_own_cast<TH1*>(
1390  rootFile->Get("Conversions/es2017_summer/convRecoEfficiency")));
1391  }
1392 
1393  // TODO: change path when moving to calibarea
1394  // TODO: better package this somewhere
1395 
1396  const std::string filename_pp0 = PathResolverFindCalibFile(
1397  "ElectronPhotonFourMomentumCorrection/v8/PP0sys.root");
1398 
1399  TFile file_pp0(filename_pp0.c_str());
1400  m_pp0_elec.reset(checked_own_cast<TH2*>(file_pp0.Get("elec")));
1401  m_pp0_conv.reset(checked_own_cast<TH2*>(file_pp0.Get("conv")));
1402  m_pp0_unconv.reset(checked_own_cast<TH2*>(file_pp0.Get("unco")));
1403 
1404  // similar case for wtots1
1405  const std::string filename_wstot = PathResolverFindCalibFile(
1406  "ElectronPhotonFourMomentumCorrection/v8/wstot_related_syst.root");
1407 
1408  TFile file_wstot(filename_wstot.c_str());
1409  m_wstot_slope_A_data.reset(
1410  checked_own_cast<TH1*>(file_wstot.Get("A_data")));
1411  m_wstot_slope_B_MC.reset(checked_own_cast<TH1*>(file_wstot.Get("B_mc")));
1413  checked_own_cast<TH1*>(file_wstot.Get("wstot_pT_el_data_p0")));
1415  checked_own_cast<TH1*>(file_wstot.Get("wstot_pT_el_data_p1")));
1417  checked_own_cast<TH1*>(file_wstot.Get("wstot_pT_uc_data_p0")));
1419  checked_own_cast<TH1*>(file_wstot.Get("wstot_pT_uc_data_p1")));
1421  checked_own_cast<TH1*>(file_wstot.Get("wstot_pT_c_data_p0")));
1423  checked_own_cast<TH1*>(file_wstot.Get("wstot_pT_c_data_p1")));
1425  checked_own_cast<TH1*>(file_wstot.Get("wstot_pT_el_mc_p0")));
1427  checked_own_cast<TH1*>(file_wstot.Get("wstot_pT_el_mc_p1")));
1429  checked_own_cast<TH1*>(file_wstot.Get("wstot_pT_ph_uc_mc_p0")));
1431  checked_own_cast<TH1*>(file_wstot.Get("wstot_pT_ph_uc_mc_p1")));
1433  checked_own_cast<TH1*>(file_wstot.Get("wstot_pT_ph_c_mc_p0")));
1435  checked_own_cast<TH1*>(file_wstot.Get("wstot_pT_ph_c_mc_p1")));
1436 
1437  m_begRunNumber = 252604;
1438  m_endRunNumber = 314199;
1439 
1444  m_G4OverAFII_resolution_electron.reset(checked_own_cast<TH2*>(
1445  rootFile->Get("FastSim/es2017_v1/resol_Af2ToG4_elec_rel21")));
1446  m_G4OverAFII_resolution_unconverted.reset(checked_own_cast<TH2*>(
1447  rootFile->Get("FastSim/es2017_v1/resol_Af2ToG4_unco_rel21")));
1448  m_G4OverAFII_resolution_converted.reset(checked_own_cast<TH2*>(
1449  rootFile->Get("FastSim/es2017_v1/resol_Af2ToG4_conv_rel21")));
1450  }
1455  m_G4OverAFII_resolution_electron.reset(checked_own_cast<TH2*>(
1456  rootFile->Get("FastSim/es2023_R22_Run2_v1/resol_AF3ToG4_elec_rel22")));
1457  m_G4OverAFII_resolution_unconverted.reset(checked_own_cast<TH2*>(
1458  rootFile->Get("FastSim/es2023_R22_Run2_v1/resol_AF3ToG4_unco_rel22")));
1459  m_G4OverAFII_resolution_converted.reset(checked_own_cast<TH2*>(
1460  rootFile->Get("FastSim/es2023_R22_Run2_v1/resol_AF3ToG4_conv_rel22")));
1461  }
1463  m_G4OverAFII_resolution_electron.reset(checked_own_cast<TH2*>(
1464  rootFile->Get("FastSim/es2024_Run3_v0/resol_AF3ToG4_elec_mc23")));
1465  m_G4OverAFII_resolution_unconverted.reset(checked_own_cast<TH2*>(
1466  rootFile->Get("FastSim/es2024_Run3_v0/resol_AF3ToG4_unco_mc23")));
1467  m_G4OverAFII_resolution_converted.reset(checked_own_cast<TH2*>(
1468  rootFile->Get("FastSim/es2024_Run3_v0/resol_AF3ToG4_conv_mc23")));
1469  // extra systematic file for eta between 1.3 and 1.35 due to double Gaussian peak in Ereco/Etrue
1470  m_G4OverAF_electron_resolution_extra_sys.reset(checked_own_cast<TH1*>(
1471  rootFile->Get("FastSim/es2024_Run3_v0/adhoc_resol_AF3ToG4_elec_mc23_1p3_1p35")));
1472  m_G4OverAF_converted_resolution_extra_sys.reset(checked_own_cast<TH1*>(
1473  rootFile->Get("FastSim/es2024_Run3_v0/adhoc_resol_AF3ToG4_elec_mc23_1p3_1p35")));
1474  m_G4OverAF_unconverted_resolution_extra_sys.reset(checked_own_cast<TH1*>(
1475  rootFile->Get("FastSim/es2024_Run3_v0/adhoc_resol_AF3ToG4_unconv_mc23_1p3_1p35")));
1476  }
1477  else {
1478  m_G4OverAFII_resolution_electron.reset(checked_own_cast<TH2*>(
1479  rootFile->Get("FastSim/es2017/el_full_fast_resolution")));
1480  m_G4OverAFII_resolution_unconverted.reset(checked_own_cast<TH2*>(
1481  rootFile->Get("FastSim/es2017/ph_unconv_full_fast_resolution")));
1482  m_G4OverAFII_resolution_converted.reset(checked_own_cast<TH2*>(
1483  rootFile->Get("FastSim/es2017/ph_conv_full_fast_resolution")));
1484  }
1488 
1489  const std::string gain_filename1 = PathResolverFindCalibFile(
1490  "ElectronPhotonFourMomentumCorrection/v8/FunctionsTO.root");
1491  const std::string gain_filename2 = PathResolverFindCalibFile(
1492  "ElectronPhotonFourMomentumCorrection/v8/FunctionsG_all.root");
1493  m_gain_tool = nullptr;
1494 
1495  std::string gain_tool_run_2_filename;
1496  std::string gain_tool_run3_extra_filename;
1501  gain_tool_run_2_filename = PathResolverFindCalibFile(
1502  "ElectronPhotonFourMomentumCorrection/v11/"
1503  "gain_uncertainty_specialRun.root");
1506  m_esmodel == egEnergyCorr::es2024_Run3_v0) { // Run3: extra OFC NP will be added separatedly in different lines
1507  gain_tool_run_2_filename = PathResolverFindCalibFile(
1508  "ElectronPhotonFourMomentumCorrection/v29/"
1509  "gain_uncertainty_specialRun.root");
1511  gain_tool_run3_extra_filename = PathResolverFindCalibFile(
1512  "ElectronPhotonFourMomentumCorrection/v38/"
1513  "gain_uncertainty_specialRun.root");
1514  }
1515  } else {
1516  gain_tool_run_2_filename = PathResolverFindCalibFile(
1517  "ElectronPhotonFourMomentumCorrection/v14/"
1518  "gain_uncertainty_specialRun.root");
1519  }
1523  m_gain_tool_run2 = std::make_unique<egGain::GainUncertainty>(
1524  gain_tool_run_2_filename, true, "GainUncertainty",
1527  m_gain_tool_run3_extra = std::make_unique<egGain::GainUncertainty>(
1528  gain_tool_run3_extra_filename, true, "GainUncertainty",
1530  }
1531  } else {
1533  std::make_unique<egGain::GainUncertainty>(gain_tool_run_2_filename);
1534  }
1535 
1536  m_gain_tool_run2->msg().setLevel(this->msg().level());
1537 
1541  m_e1hg_tool = std::make_unique<e1hg_systematics>(
1542  PathResolverFindCalibFile("ElectronPhotonFourMomentumCorrection/v29/"
1543  "e1hg_systematics_histos.root"));
1544  } else {
1545  m_e1hg_tool = std::make_unique<e1hg_systematics>(
1546  PathResolverFindCalibFile("ElectronPhotonFourMomentumCorrection/v8/"
1547  "e1hg_systematics_histos.root"));
1548  }
1549 
1554  m_resolution_tool = std::make_unique<eg_resolution>("run2_pre");
1555 
1556  m_aPSNom.reset(checked_own_cast<TH1*>(
1557  rootFile->Get("Scales/es2015_day0/alphaPS_uncor"))); // old one
1558  m_daPSCor.reset(checked_own_cast<TH1*>(
1559  rootFile->Get("Scales/es2015_day0/dalphaPS_cor"))); // old one
1560  m_aS12Nom.reset(checked_own_cast<TH1*>(
1561  rootFile->Get("Scales/es2015_day0/alphaS12_uncor"))); // old one
1562  m_daS12Cor.reset(checked_own_cast<TH1*>(
1563  rootFile->Get("Scales/es2015_day0/dalphaS12_cor"))); // old one
1564 
1565  m_trkSyst.reset(checked_own_cast<TH1*>(
1566  rootFile->Get("Scales/es2015_day0/momentum_errSyst"))); // old one
1567 
1568  m_zeeNom.reset(checked_own_cast<TH1*>(
1569  rootFile->Get("Scales/es2015_day0/alphaZee_errStat"))); // old one
1570  m_zeeSyst.reset(checked_own_cast<TH1*>(
1571  rootFile->Get("Scales/es2015_day0/alphaZee_errSyst"))); // old one
1572 
1573  m_resNom.reset(checked_own_cast<TH1*>(
1574  rootFile->Get("Resolution/es2012c/ctZee_errStat"))); // old one
1575  m_resSyst.reset(checked_own_cast<TH1*>(
1576  rootFile->Get("Resolution/es2012c/ctZee_errSyst"))); // old one
1577 
1578  m_pedestalL0.reset(checked_own_cast<TH1*>(
1579  rootFile->Get("Pedestals/es2012c/pedestals_l0"))); // old one
1580  m_pedestalL1.reset(checked_own_cast<TH1*>(
1581  rootFile->Get("Pedestals/es2012c/pedestals_l1"))); // old one
1582  m_pedestalL2.reset(checked_own_cast<TH1*>(
1583  rootFile->Get("Pedestals/es2012c/pedestals_l2"))); // old one
1584  m_pedestalL3.reset(checked_own_cast<TH1*>(
1585  rootFile->Get("Pedestals/es2012c/pedestals_l3"))); // old one
1586 
1587  m_dX_ID_Nom.reset(checked_own_cast<TH1*>(
1588  rootFile->Get("Material/DX0_ConfigA"))); // old one
1589 
1590  m_dX_IPPS_Nom.reset(checked_own_cast<TH1*>(rootFile->Get(
1591  "Material/Measured/DXerr_IPPS_NewG_errUncor"))); // old one
1592  m_dX_IPPS_LAr.reset(checked_own_cast<TH1*>(
1593  rootFile->Get("Material/Measured/DXerr_IPPS_NewG_errLAr"))); // old one
1594 
1595  m_dX_IPAcc_Nom.reset(checked_own_cast<TH1*>(rootFile->Get(
1596  "Material/Measured/DXerr_IPAcc_NewG_errUncor"))); // old one
1597  m_dX_IPAcc_LAr.reset(checked_own_cast<TH1*>(rootFile->Get(
1598  "Material/Measured/DXerr_IPAcc_NewG_errLAr"))); // old one
1599  m_dX_IPAcc_G4.reset(checked_own_cast<TH1*>(
1600  rootFile->Get("Material/Measured/DXerr_IPAcc_NewG_errG4"))); // old one
1601  m_dX_IPAcc_GL1.reset(checked_own_cast<TH1*>(rootFile->Get(
1602  "Material/Measured/DXerr_IPAcc_NewG_errGL1"))); // old one
1603 
1604  m_dX_PSAcc_Nom.reset(checked_own_cast<TH1*>(rootFile->Get(
1605  "Material/Measured/DXerr_PSAcc_NewG_errUncor"))); // old one
1606  m_dX_PSAcc_LAr.reset(checked_own_cast<TH1*>(rootFile->Get(
1607  "Material/Measured/DXerr_PSAcc_NewG_errLAr"))); // old one
1608  m_dX_PSAcc_G4.reset(checked_own_cast<TH1*>(
1609  rootFile->Get("Material/Measured/DXerr_PSAcc_NewG_errG4"))); // old one
1610 
1611  m_convRadius.reset(checked_own_cast<TH1*>(
1612  rootFile->Get("Conversions/es2012c/convRadiusMigrations"))); // old one
1613  m_convFakeRate.reset(checked_own_cast<TH1*>(
1614  rootFile->Get("Conversions/es2012c/convFakeRate"))); // old one
1615  m_convRecoEfficiency.reset(checked_own_cast<TH1*>(
1616  rootFile->Get("Conversions/es2012c/convRecoEfficiency"))); // old one
1617 
1618  m_begRunNumber = 195847;
1619  m_endRunNumber = 219365;
1620 
1621  const std::string gain_filename1 = PathResolverFindCalibFile(
1622  "ElectronPhotonFourMomentumCorrection/v8/FunctionsTO.root");
1623  const std::string gain_filename2 = PathResolverFindCalibFile(
1624  "ElectronPhotonFourMomentumCorrection/v8/FunctionsG_all.root");
1625  m_gain_tool =
1626  std::make_unique<egGain::GainTool>(gain_filename1, gain_filename2);
1627 
1628  m_e1hg_tool = std::make_unique<e1hg_systematics>(
1629  PathResolverFindCalibFile("ElectronPhotonFourMomentumCorrection/v8/"
1630  "e1hg_systematics_histos.root"));
1631 
1632  // If we are here, fail s :
1633 
1634  } else if (m_esmodel == egEnergyCorr::UNDEFINED) {
1635  ATH_MSG_FATAL("ES model not initialized - Initialization fails");
1636  return 0;
1637  } else {
1638  ATH_MSG_FATAL("ES model not recognized - Initialization fails");
1639  return 0;
1640  }
1641 
1661  // E4 systematics
1662  m_E4ElectronEtaBins.reset(checked_own_cast<TAxis*>(
1663  rootFile->Get("E4Recalibration/v4/electron_eta_axis")));
1664  m_E4ElectronGraphs.reset(
1665  checked_own_cast<TList*>(rootFile->Get("E4Recalibration/v4/electron")));
1666  // for photons use the same as electrons
1667  m_E4UnconvertedEtaBins.reset(checked_own_cast<TAxis*>(
1668  rootFile->Get("E4Recalibration/v4/electron_eta_axis")));
1669  m_E4UnconvertedGraphs.reset(
1670  checked_own_cast<TList*>(rootFile->Get("E4Recalibration/v4/electron")));
1671  m_E4ConvertedEtaBins.reset(checked_own_cast<TAxis*>(
1672  rootFile->Get("E4Recalibration/v4/electron_eta_axis")));
1673  m_E4ConvertedGraphs.reset(
1674  checked_own_cast<TList*>(rootFile->Get("E4Recalibration/v4/electron")));
1675  }
1677  // E4 systematics (sensitivity per particle type)
1678  m_E4ElectronEtaBins.reset(checked_own_cast<TAxis*>(
1679  rootFile->Get("E4Recalibration/es2024_Run3_v0/E4_eta_axis")));
1680  m_E4ElectronGraphs.reset(
1681  checked_own_cast<TList*>(rootFile->Get("E4Recalibration/es2024_Run3_v0/electron_sensitivity")));
1682  m_E4UnconvertedEtaBins.reset(checked_own_cast<TAxis*>(
1683  rootFile->Get("E4Recalibration/es2024_Run3_v0/E4_eta_axis")));
1684  m_E4UnconvertedGraphs.reset(
1685  checked_own_cast<TList*>(rootFile->Get("E4Recalibration/es2024_Run3_v0/unconv_photon_sensitivity")));
1686  m_E4ConvertedEtaBins.reset(checked_own_cast<TAxis*>(
1687  rootFile->Get("E4Recalibration/es2024_Run3_v0/E4_eta_axis")));
1688  m_E4ConvertedGraphs.reset(
1689  checked_own_cast<TList*>(rootFile->Get("E4Recalibration/es2024_Run3_v0/conv_photon_sensitivity")));
1690  }
1691 
1692  // ... PS and S12 recalibration curves
1712 
1713  m_psElectronEtaBins.reset(checked_own_cast<TAxis*>(
1714  rootFile->Get("PSRecalibration/es2015PRE/ElectronAxis")));
1715  m_psElectronGraphs.reset(checked_own_cast<TList*>(
1716  rootFile->Get("PSRecalibration/es2015PRE/ElectronBiasPS")));
1717  m_psUnconvertedEtaBins.reset(checked_own_cast<TAxis*>(
1718  rootFile->Get("PSRecalibration/es2015PRE/UnconvertedAxis")));
1719  m_psUnconvertedGraphs.reset(checked_own_cast<TList*>(
1720  rootFile->Get("PSRecalibration/es2015PRE/UnconvertedBiasPS")));
1721  m_psConvertedEtaBins.reset(checked_own_cast<TAxis*>(
1722  rootFile->Get("PSRecalibration/es2015PRE/ConvertedAxis")));
1723  m_psConvertedGraphs.reset(checked_own_cast<TList*>(
1724  rootFile->Get("PSRecalibration/es2015PRE/ConvertedBiasPS")));
1725 
1726  m_s12ElectronEtaBins.reset(checked_own_cast<TAxis*>(
1727  rootFile->Get("S1Recalibration/es2015PRE/ElectronAxis")));
1728  m_s12ElectronGraphs.reset(checked_own_cast<TList*>(
1729  rootFile->Get("S1Recalibration/es2015PRE/ElectronBiasS1")));
1730  m_s12UnconvertedEtaBins.reset(checked_own_cast<TAxis*>(
1731  rootFile->Get("S1Recalibration/es2015PRE/UnconvertedAxis")));
1732  m_s12UnconvertedGraphs.reset(checked_own_cast<TList*>(
1733  rootFile->Get("S1Recalibration/es2015PRE/UnconvertedBiasS1")));
1734  m_s12ConvertedEtaBins.reset(checked_own_cast<TAxis*>(
1735  rootFile->Get("S1Recalibration/es2015PRE/ConvertedAxis")));
1736  m_s12ConvertedGraphs.reset(checked_own_cast<TList*>(
1737  rootFile->Get("S1Recalibration/es2015PRE/ConvertedBiasS1")));
1741  m_psElectronEtaBins.reset(checked_own_cast<TAxis*>(
1742  rootFile->Get("PSRecalibration/es2023_R22_Run2_v0/ElectronAxis")));
1743  m_psElectronGraphs.reset(checked_own_cast<TList*>(
1744  rootFile->Get("PSRecalibration/es2023_R22_Run2_v0/ElectronBiasPS")));
1745  m_psUnconvertedEtaBins.reset(checked_own_cast<TAxis*>(
1746  rootFile->Get("PSRecalibration/es2023_R22_Run2_v0/UnconvertedAxis")));
1747  m_psUnconvertedGraphs.reset(checked_own_cast<TList*>(
1748  rootFile->Get("PSRecalibration/es2023_R22_Run2_v0/UnconvertedBiasPS")));
1749  m_psConvertedEtaBins.reset(checked_own_cast<TAxis*>(
1750  rootFile->Get("PSRecalibration/es2023_R22_Run2_v0/ConvertedAxis")));
1751  m_psConvertedGraphs.reset(checked_own_cast<TList*>(
1752  rootFile->Get("PSRecalibration/es2023_R22_Run2_v0/ConvertedBiasPS")));
1753 
1754  m_s12ElectronEtaBins.reset(checked_own_cast<TAxis*>(
1755  rootFile->Get("S2Recalibration/ElectronAxis")));
1756  m_s12ElectronGraphs.reset(checked_own_cast<TList*>(
1757  rootFile->Get("S2Recalibration/ElectronBiasS2")));
1758  m_s12UnconvertedEtaBins.reset(checked_own_cast<TAxis*>(
1759  rootFile->Get("S2Recalibration/UnconvertedAxis")));
1760  m_s12UnconvertedGraphs.reset(checked_own_cast<TList*>(
1761  rootFile->Get("S2Recalibration/UnconvertedBiasS2")));
1762  m_s12ConvertedEtaBins.reset(checked_own_cast<TAxis*>(
1763  rootFile->Get("S2Recalibration/ConvertedAxis")));
1764  m_s12ConvertedGraphs.reset(checked_own_cast<TList*>(
1765  rootFile->Get("S2Recalibration/ConvertedBiasS2")));
1766 
1767  m_EaccElectronEtaBins.reset(checked_own_cast<TAxis*>(
1768  rootFile->Get("SaccRecalibration/ElectronAxis")));
1770  m_EaccElectronGraphs.reset(checked_own_cast<TList*>(
1771  rootFile->Get("SaccRecalibration/es2024_Run3_v0/ElectronBiasSacc")));
1772  }
1773  else {
1774  m_EaccElectronGraphs.reset(checked_own_cast<TList*>(
1775  rootFile->Get("SaccRecalibration/ElectronBiasSacc")));
1776  }
1777  m_EaccUnconvertedEtaBins.reset(checked_own_cast<TAxis*>(
1778  rootFile->Get("SaccRecalibration/UnconvertedAxis")));
1779  m_EaccUnconvertedGraphs.reset(checked_own_cast<TList*>(
1780  rootFile->Get("SaccRecalibration/UnconvertedBiasSacc")));
1781  m_EaccConvertedEtaBins.reset(checked_own_cast<TAxis*>(
1782  rootFile->Get("SaccRecalibration/ConvertedAxis")));
1783  m_EaccConvertedGraphs.reset(checked_own_cast<TList*>(
1784  rootFile->Get("SaccRecalibration/ConvertedBiasSacc")));
1785  } else // run1
1786  {
1787  m_psElectronEtaBins.reset(checked_own_cast<TAxis*>(
1788  rootFile->Get("PSRecalibration/ElectronAxis")));
1789  m_psElectronGraphs.reset(checked_own_cast<TList*>(
1790  rootFile->Get("PSRecalibration/ElectronBiasPS")));
1791  m_psUnconvertedEtaBins.reset(checked_own_cast<TAxis*>(
1792  rootFile->Get("PSRecalibration/UnconvertedAxis")));
1793  m_psUnconvertedGraphs.reset(checked_own_cast<TList*>(
1794  rootFile->Get("PSRecalibration/UnconvertedBiasPS")));
1795  m_psConvertedEtaBins.reset(checked_own_cast<TAxis*>(
1796  rootFile->Get("PSRecalibration/ConvertedAxis")));
1797  m_psConvertedGraphs.reset(checked_own_cast<TList*>(
1798  rootFile->Get("PSRecalibration/ConvertedBiasPS")));
1799 
1800  m_s12ElectronEtaBins.reset(checked_own_cast<TAxis*>(
1801  rootFile->Get("S1Recalibration/ElectronAxis")));
1802  m_s12ElectronGraphs.reset(checked_own_cast<TList*>(
1803  rootFile->Get("S1Recalibration/ElectronBiasS1")));
1804  m_s12UnconvertedEtaBins.reset(checked_own_cast<TAxis*>(
1805  rootFile->Get("S1Recalibration/UnconvertedAxis")));
1806  m_s12UnconvertedGraphs.reset(checked_own_cast<TList*>(
1807  rootFile->Get("S1Recalibration/UnconvertedBiasS1")));
1808  m_s12ConvertedEtaBins.reset(checked_own_cast<TAxis*>(
1809  rootFile->Get("S1Recalibration/ConvertedAxis")));
1810  m_s12ConvertedGraphs.reset(checked_own_cast<TList*>(
1811  rootFile->Get("S1Recalibration/ConvertedBiasS1")));
1812  }
1813 
1814  // further inputs do not depend on year
1815 
1816  // ... material distortions
1817  m_matUnconvertedScale.emplace_back(
1818  std::unique_ptr<TH1>(checked_own_cast<TH1*>(
1819  rootFile->Get("Material/unconvertedBiasSubtracted_ConfigA"))));
1820  m_matUnconvertedScale.emplace_back(
1821  std::unique_ptr<TH1>(checked_own_cast<TH1*>(
1822  rootFile->Get("Material/unconvertedBiasSubtracted_ConfigCpDp"))));
1823  m_matUnconvertedScale.emplace_back(
1824  std::unique_ptr<TH1>(checked_own_cast<TH1*>(
1825  rootFile->Get("Material/unconvertedBiasSubtracted_ConfigEpLp"))));
1826  m_matUnconvertedScale.emplace_back(
1827  std::unique_ptr<TH1>(checked_own_cast<TH1*>(
1828  rootFile->Get("Material/unconvertedBiasSubtracted_ConfigFpMX"))));
1829  m_matUnconvertedScale.emplace_back(
1830  std::unique_ptr<TH1>(checked_own_cast<TH1*>(
1831  rootFile->Get("Material/unconvertedBiasSubtracted_ConfigGp"))));
1832 
1833  m_matConvertedScale.emplace_back(std::unique_ptr<TH1>(checked_own_cast<TH1*>(
1834  rootFile->Get("Material/convertedBiasSubtracted_ConfigA"))));
1835  m_matConvertedScale.emplace_back(std::unique_ptr<TH1>(checked_own_cast<TH1*>(
1836  rootFile->Get("Material/convertedBiasSubtracted_ConfigCpDp"))));
1837  m_matConvertedScale.emplace_back(std::unique_ptr<TH1>(checked_own_cast<TH1*>(
1838  rootFile->Get("Material/convertedBiasSubtracted_ConfigEpLp"))));
1839  m_matConvertedScale.emplace_back(std::unique_ptr<TH1>(checked_own_cast<TH1*>(
1840  rootFile->Get("Material/convertedBiasSubtracted_ConfigFpMX"))));
1841  m_matConvertedScale.emplace_back(std::unique_ptr<TH1>(checked_own_cast<TH1*>(
1842  rootFile->Get("Material/convertedBiasSubtracted_ConfigGp"))));
1843 
1844  m_matElectronCstTerm.emplace_back(std::unique_ptr<TH1>(checked_own_cast<TH1*>(
1845  rootFile->Get("Material/electronCstTerm_ConfigA"))));
1846  m_matElectronCstTerm.emplace_back(std::unique_ptr<TH1>(checked_own_cast<TH1*>(
1847  rootFile->Get("Material/electronCstTerm_ConfigCpDp"))));
1848  m_matElectronCstTerm.emplace_back(std::unique_ptr<TH1>(checked_own_cast<TH1*>(
1849  rootFile->Get("Material/electronCstTerm_ConfigEpLp"))));
1850  m_matElectronCstTerm.emplace_back(std::unique_ptr<TH1>(checked_own_cast<TH1*>(
1851  rootFile->Get("Material/electronCstTerm_ConfigFpMX"))));
1852  m_matElectronCstTerm.emplace_back(std::unique_ptr<TH1>(checked_own_cast<TH1*>(
1853  rootFile->Get("Material/electronCstTerm_ConfigGp"))));
1854 
1864  // update dX0 plots for distorted geometry for case A, EL, FMX and N
1865  m_matX0Additions.emplace_back(std::unique_ptr<TH1>(
1866  checked_own_cast<TH1*>(rootFile->Get("Material_rel21/DX0_ConfigA"))));
1867  m_matX0Additions.emplace_back(std::unique_ptr<TH1>(
1868  checked_own_cast<TH1*>(rootFile->Get("Material/DX0_ConfigCpDp"))));
1869  m_matX0Additions.emplace_back(std::unique_ptr<TH1>(checked_own_cast<TH1*>(
1870  rootFile->Get("Material_rel21/DX0_ConfigEpLp"))));
1871  m_matX0Additions.emplace_back(std::unique_ptr<TH1>(checked_own_cast<TH1*>(
1872  rootFile->Get("Material_rel21/DX0_ConfigFpMX"))));
1873  m_matX0Additions.emplace_back(std::unique_ptr<TH1>(
1874  checked_own_cast<TH1*>(rootFile->Get("Material/DX0_ConfigGp"))));
1875  m_matX0Additions.emplace_back(std::unique_ptr<TH1>(
1876  checked_own_cast<TH1*>(rootFile->Get("Material_rel21/DX0_ConfigN"))));
1877  } else {
1878  m_matX0Additions.emplace_back(std::unique_ptr<TH1>(
1879  checked_own_cast<TH1*>(rootFile->Get("Material/DX0_ConfigA"))));
1880  m_matX0Additions.emplace_back(std::unique_ptr<TH1>(
1881  checked_own_cast<TH1*>(rootFile->Get("Material/DX0_ConfigCpDp"))));
1882  m_matX0Additions.emplace_back(std::unique_ptr<TH1>(
1883  checked_own_cast<TH1*>(rootFile->Get("Material/DX0_ConfigEpLp"))));
1884  m_matX0Additions.emplace_back(std::unique_ptr<TH1>(
1885  checked_own_cast<TH1*>(rootFile->Get("Material/DX0_ConfigFpMX"))));
1886  m_matX0Additions.emplace_back(std::unique_ptr<TH1>(
1887  checked_own_cast<TH1*>(rootFile->Get("Material/DX0_ConfigGp"))));
1888  }
1889 
1890  m_matElectronEtaBins.reset(
1891  checked_own_cast<TAxis*>(rootFile->Get("Material/LinearityEtaBins")));
1892  m_matElectronGraphs.emplace_back(
1893  std::unique_ptr<TList>(checked_own_cast<TList*>(
1894  rootFile->Get("Material/Linearity_Cluster_ConfigA"))));
1895  m_matElectronGraphs.emplace_back(
1896  std::unique_ptr<TList>(checked_own_cast<TList*>(
1897  rootFile->Get("Material/Linearity_Cluster_ConfigCpDp"))));
1898  m_matElectronGraphs.emplace_back(
1899  std::unique_ptr<TList>(checked_own_cast<TList*>(
1900  rootFile->Get("Material/Linearity_Cluster_ConfigEpLp"))));
1901  m_matElectronGraphs.emplace_back(
1902  std::unique_ptr<TList>(checked_own_cast<TList*>(
1903  rootFile->Get("Material/Linearity_Cluster_ConfigFpMX"))));
1904  m_matElectronGraphs.emplace_back(
1905  std::unique_ptr<TList>(checked_own_cast<TList*>(
1906  rootFile->Get("Material/Linearity_Cluster_ConfigGp"))));
1907  // ... new material distortions from release 21 parameterizations
1917  m_electronBias_ConfigA.reset(checked_own_cast<TH2*>(
1918  rootFile->Get("Material_rel21/electronBias_ConfigA")));
1919  m_electronBias_ConfigEpLp.reset(checked_own_cast<TH2*>(
1920  rootFile->Get("Material_rel21/electronBias_ConfigEpLp")));
1921  m_electronBias_ConfigFpMX.reset(checked_own_cast<TH2*>(
1922  rootFile->Get("Material_rel21/electronBias_ConfigFpMX")));
1923  m_electronBias_ConfigN.reset(checked_own_cast<TH2*>(
1924  rootFile->Get("Material_rel21/electronBias_ConfigN")));
1925  m_electronBias_ConfigIBL.reset(checked_own_cast<TH2*>(
1926  rootFile->Get("Material_rel21/electronBias_ConfigIBL")));
1927  m_electronBias_ConfigPP0.reset(checked_own_cast<TH2*>(
1928  rootFile->Get("Material_rel21/electronBias_ConfigPP0")));
1929  m_unconvertedBias_ConfigA.reset(checked_own_cast<TH2*>(
1930  rootFile->Get("Material_rel21/unconvertedBias_ConfigA")));
1931  m_unconvertedBias_ConfigEpLp.reset(checked_own_cast<TH2*>(
1932  rootFile->Get("Material_rel21/unconvertedBias_ConfigEpLp")));
1933  m_unconvertedBias_ConfigFpMX.reset(checked_own_cast<TH2*>(
1934  rootFile->Get("Material_rel21/unconvertedBias_ConfigFpMX")));
1935  m_unconvertedBias_ConfigN.reset(checked_own_cast<TH2*>(
1936  rootFile->Get("Material_rel21/unconvertedBias_ConfigN")));
1937  m_unconvertedBias_ConfigIBL.reset(checked_own_cast<TH2*>(
1938  rootFile->Get("Material_rel21/unconvertedBias_ConfigIBL")));
1939  m_unconvertedBias_ConfigPP0.reset(checked_own_cast<TH2*>(
1940  rootFile->Get("Material_rel21/unconvertedBias_ConfigPP0")));
1941  m_convertedBias_ConfigA.reset(checked_own_cast<TH2*>(
1942  rootFile->Get("Material_rel21/convertedBias_ConfigA")));
1943  m_convertedBias_ConfigEpLp.reset(checked_own_cast<TH2*>(
1944  rootFile->Get("Material_rel21/convertedBias_ConfigEpLp")));
1945  m_convertedBias_ConfigFpMX.reset(checked_own_cast<TH2*>(
1946  rootFile->Get("Material_rel21/convertedBias_ConfigFpMX")));
1947  m_convertedBias_ConfigN.reset(checked_own_cast<TH2*>(
1948  rootFile->Get("Material_rel21/convertedBias_ConfigN")));
1949  m_convertedBias_ConfigIBL.reset(checked_own_cast<TH2*>(
1950  rootFile->Get("Material_rel21/convertedBias_ConfigIBL")));
1951  m_convertedBias_ConfigPP0.reset(checked_own_cast<TH2*>(
1952  rootFile->Get("Material_rel21/convertedBias_ConfigPP0")));
1953  }
1954 
1955  // ... Fastsim to Fullsim corrections
1956 
1963 
1964  m_G4OverAFII_electron.reset(checked_own_cast<TH1*>(
1965  rootFile->Get("FastSim/es2015/el_scale_full_fast_peak_gaussian")));
1966  m_G4OverAFII_unconverted.reset(checked_own_cast<TH1*>(rootFile->Get(
1967  "FastSim/es2015/ph_unconv_scale_full_fast_peak_gaussian")));
1968  m_G4OverAFII_converted.reset(checked_own_cast<TH1*>(
1969  rootFile->Get("FastSim/es2015/ph_conv_scale_full_fast_peak_gaussian")));
1970  } else if (m_esmodel == egEnergyCorr::es2017 or
1977  m_G4OverAFII_electron.reset(checked_own_cast<TH1*>(
1978  rootFile->Get("FastSim/es2017/el_scale_full_fast_peak_gaussian")));
1979  m_G4OverAFII_unconverted.reset(checked_own_cast<TH1*>(rootFile->Get(
1980  "FastSim/es2017/ph_unconv_scale_full_fast_peak_gaussian")));
1981  m_G4OverAFII_converted.reset(checked_own_cast<TH1*>(
1982  rootFile->Get("FastSim/es2017/ph_conv_scale_full_fast_peak_gaussian")));
1983  } else if (m_esmodel == egEnergyCorr::es2017_R21_v1 ||
1987  m_G4OverAFII_electron_2D.reset(checked_own_cast<TH2*>(
1988  rootFile->Get("FastSim/es2017_v1/scale_Af2ToG4_elec_rel21")));
1989  m_G4OverAFII_electron_2D->SetDirectory(nullptr);
1990  m_G4OverAFII_unconverted_2D.reset(checked_own_cast<TH2*>(
1991  rootFile->Get("FastSim/es2017_v1/scale_Af2ToG4_unco_rel21")));
1992  m_G4OverAFII_converted_2D.reset(checked_own_cast<TH2*>(
1993  rootFile->Get("FastSim/es2017_v1/scale_Af2ToG4_conv_rel21")));
1994  }
1999  m_G4OverAFII_electron_2D.reset(checked_own_cast<TH2*>(
2000  rootFile->Get("FastSim/es2023_R22_Run2_v1/scale_AF3ToG4_elec_rel22")));
2001  m_G4OverAFII_electron_2D->SetDirectory(nullptr);
2002  m_G4OverAFII_unconverted_2D.reset(checked_own_cast<TH2*>(
2003  rootFile->Get("FastSim/es2023_R22_Run2_v1/scale_AF3ToG4_unco_rel22")));
2004  m_G4OverAFII_converted_2D.reset(checked_own_cast<TH2*>(
2005  rootFile->Get("FastSim/es2023_R22_Run2_v1/scale_AF3ToG4_conv_rel22")));
2006  }
2008  m_G4OverAFII_electron_2D.reset(checked_own_cast<TH2*>(
2009  rootFile->Get("FastSim/es2024_Run3_v0/scale_AF3ToG4_elec_mc23")));
2010  m_G4OverAFII_electron_2D->SetDirectory(nullptr);
2011  m_G4OverAFII_unconverted_2D.reset(checked_own_cast<TH2*>(
2012  rootFile->Get("FastSim/es2024_Run3_v0/scale_AF3ToG4_unco_mc23")));
2013  m_G4OverAFII_converted_2D.reset(checked_own_cast<TH2*>(
2014  rootFile->Get("FastSim/es2024_Run3_v0/scale_AF3ToG4_conv_mc23")));
2015  // extra systematic file for eta between 1.3 and 1.35 due to double Gaussian peak in Ereco/Etrue
2016  m_G4OverAF_electron_scale_extra_sys.reset(checked_own_cast<TH1*>(
2017  rootFile->Get("FastSim/es2024_Run3_v0/adhoc_scale_AF3ToG4_elec_mc23_1p3_1p35")));
2018  m_G4OverAF_converted_scale_extra_sys.reset(checked_own_cast<TH1*>(
2019  rootFile->Get("FastSim/es2024_Run3_v0/adhoc_scale_AF3ToG4_elec_mc23_1p3_1p35")));
2020  m_G4OverAF_unconverted_scale_extra_sys.reset(checked_own_cast<TH1*>(
2021  rootFile->Get("FastSim/es2024_Run3_v0/adhoc_scale_AF3ToG4_unconv_mc23_1p3_1p35")));
2022  }
2023  else { // run 1
2024  m_G4OverAFII_electron.reset(
2025  checked_own_cast<TH1*>(rootFile->Get("FastSim/hG4OverAF")));
2026  }
2027  m_G4OverFrSh.reset(
2028  checked_own_cast<TH1*>(rootFile->Get("FastSim/hG4OverFS")));
2029  // ... Leakage systematics
2030 
2046  m_leakageConverted.reset(
2047  checked_own_cast<TH1*>(rootFile->Get("Leakage/LeakageDiffConverted")));
2048  m_leakageUnconverted.reset(checked_own_cast<TH1*>(
2049  rootFile->Get("Leakage/LeakageDiffUnconverted")));
2053  m_leakageConverted.reset(checked_own_cast<TH1*>(
2054  rootFile->Get("Leakage/es2017_summer/LeakageDiffConverted")));
2055  m_leakageUnconverted.reset(checked_own_cast<TH1*>(
2056  rootFile->Get("Leakage/es2017_summer/LeakageDiffUnconverted")));
2057  } else {
2058  m_leakageConverted.reset(checked_own_cast<TH1*>(
2059  rootFile->Get("Leakage/es2023_R22_Run2_v0/LeakageDiffConverted")));
2060  m_leakageUnconverted.reset(checked_own_cast<TH1*>(
2061  rootFile->Get("Leakage/es2023_R22_Run2_v0/LeakageDiffUnconverted")));
2062  m_leakageElectron.reset(checked_own_cast<TH1*>(
2063  rootFile->Get("Leakage/es2023_R22_Run2_v0/LeakageDiffElectron")));
2064  m_leakageElectron->SetDirectory(nullptr);
2065  }
2066  if (m_leakageConverted.get() && m_leakageUnconverted.get()) {
2067  m_leakageConverted->SetDirectory(nullptr);
2068  m_leakageUnconverted->SetDirectory(nullptr);
2069  } else {
2070  ATH_MSG_INFO("No leakage systematic uncertainty for ES model "
2071  << m_esmodel);
2072  }
2073 
2074  // ... Zee S2 profile (needed for gain switch syst).
2075  m_zeeES2Profile.reset(
2076  checked_own_cast<TH1*>(rootFile->Get("ZeeEnergyProfiles/p2MC")));
2077  // mean Zee energy as function of eta
2079  m_meanZeeProfile.reset(checked_own_cast<TProfile*>(
2080  rootFile->Get("ZeeMeanET/es2024_Run3_v0/MC_eta_vs_et_profiled")));
2081  }
2082  // R22 Run 2
2083  else{
2084  m_meanZeeProfile.reset(checked_own_cast<TProfile*>(
2085  rootFile->Get("ZeeMeanET/MC_eta_vs_et_profiled")));
2086  }
2087  // OK, now we are all initialized and everything went fine
2088  m_initialized = true;
2089  return 1;
2090 }
2091 
2092 // User interface
2093 // universal compact interface to getCorrectedEnergy(...)
2096  PATCore::ParticleType::Type ptype, double momentum, double trk_eta,
2097  egEnergyCorr::Scale::Variation scaleVar, double varSF) const {
2098 
2099  double correctedMomentum = momentum;
2100  double aeta = std::abs(trk_eta);
2101 
2102  if (ptype == PATCore::ParticleType::Electron &&
2104 
2105  double corr = 0;
2106  if (scaleVar == egEnergyCorr::Scale::MomentumUp)
2107  corr = m_trkSyst->GetBinContent(m_trkSyst->FindFixBin(aeta));
2108  else if (scaleVar == egEnergyCorr::Scale::MomentumDown)
2109  corr = -m_trkSyst->GetBinContent(m_trkSyst->FindFixBin(aeta));
2110 
2111  correctedMomentum *= 1. + corr * varSF;
2112  }
2113 
2114  return correctedMomentum;
2115 }
2116 
2117 // This method handles the main switches between data and the various MC
2118 // flavours. Called internally by getCorrectedEnergy(...)
2121  PATCore::ParticleType::Type ptype, double cl_eta, double cl_etaS2, double cl_etaCalo,
2122  double energy, double energyS2, double eraw, RandomNumber random_seed,
2125  egEnergyCorr::Resolution::resolutionType resType, double varSF) const {
2126  double fullyCorrectedEnergy = energy;
2127 
2128  // Correct fast sim flavours
2129 
2130  if (dataType == PATCore::ParticleDataType::FastShower) // Frozen shower sim
2131  fullyCorrectedEnergy = energy * this->applyFStoG4(cl_eta);
2132  else if (dataType == PATCore::ParticleDataType::Fast) // AtlFast2 sim
2133  {
2134  fullyCorrectedEnergy =
2135  energy *
2136  this->applyAFtoG4(cl_eta, 0.001 * energy / cosh(cl_eta), ptype);
2137  }
2138 
2139  // If nothing is to be done
2140 
2141  if (scaleVar == egEnergyCorr::Scale::None &&
2143  return fullyCorrectedEnergy;
2144 
2145  ATH_MSG_DEBUG(std::format("after sim fl = {:.2f}", fullyCorrectedEnergy));
2146 
2147  // main E-scale corrections
2148 
2149  if (dataType == PATCore::ParticleDataType::Data) { // ... Data
2150 
2151  if (scaleVar == egEnergyCorr::Scale::Nominal) {
2152  double alpha =
2153  getAlphaValue(runnumber, cl_eta, cl_etaS2, cl_etaCalo, fullyCorrectedEnergy,
2154  energyS2, eraw, ptype, scaleVar, varSF);
2155  fullyCorrectedEnergy /= (1 + alpha);
2156  // apply additional k.E+b corrections if histograms exist (like in
2157  // es2017_R21_v1)
2158  if (m_zeeFwdk && m_zeeFwdb && std::abs(cl_eta) > 2.5) { // calo eta?
2159  int ieta_k = m_zeeFwdk->GetXaxis()->FindFixBin(cl_eta);
2160  double value_k = m_zeeFwdk->GetBinContent(ieta_k);
2161  int ieta_b = m_zeeFwdb->GetXaxis()->FindFixBin(cl_eta);
2162  double value_b = m_zeeFwdb->GetBinContent(ieta_b);
2163  fullyCorrectedEnergy =
2164  value_k * fullyCorrectedEnergy +
2165  value_b * GeV; // value is stored in GeV in the histogram file
2166  }
2167  ATH_MSG_DEBUG(std::format("after alpha = {:.2f}", fullyCorrectedEnergy));
2168  }
2169 
2170  }
2171  else { // ... MC
2172 
2173  // Do the energy scale correction (for systematic variations)
2174 
2175  if (scaleVar != egEnergyCorr::Scale::None &&
2176  scaleVar != egEnergyCorr::Scale::Nominal) {
2177  double deltaAlpha = getAlphaUncertainty(runnumber, cl_eta, cl_etaS2, cl_etaCalo,
2178  fullyCorrectedEnergy, energyS2,
2179  eraw, ptype, scaleVar, varSF);
2180  ATH_MSG_DEBUG("alpha sys " << variationName(scaleVar) << " = "
2181  << deltaAlpha);
2182  fullyCorrectedEnergy *= (1 + deltaAlpha);
2183  ATH_MSG_DEBUG(std::format("after mc alpha = {:.2f}", fullyCorrectedEnergy));
2184  }
2185 
2186  // AF2 systematics (this will not be in the sum of all other NP in the 1 NP
2187  // model)
2189  (scaleVar == egEnergyCorr::Scale::afUp or scaleVar == egEnergyCorr::Scale::afDown)) {
2190  double daAF2 = 0.;
2191  double sign = (scaleVar == egEnergyCorr::Scale::afUp) ? 1. : -1.;
2193  daAF2 = 0.005*sign;
2194  }
2195  else if (m_esmodel >= egEnergyCorr::es2017_R21_v1 and
2197  daAF2 = 0.001*sign;
2198  }
2199  else if (m_esmodel >= egEnergyCorr::es2022_R22_PRE and
2202  fullyCorrectedEnergy/cosh(cl_eta) < 20e3) {
2203  daAF2 = 0.003*sign;
2204  }
2205  else {
2206  daAF2 = 0.001*sign;
2207  }
2208  }
2210  if (std::abs(cl_eta) >= 1.3 and std::abs(cl_eta) <= 1.35) {
2211  if (ptype == PATCore::ParticleType::Electron) {
2212  daAF2 = getValueHistoAt(*m_G4OverAF_electron_scale_extra_sys,
2213  fullyCorrectedEnergy / cosh(cl_eta) / 1000.,
2214  true, true, true);
2215  }
2216  else if (ptype == PATCore::ParticleType::ConvertedPhoton) {
2217  daAF2 = getValueHistoAt(*m_G4OverAF_converted_scale_extra_sys,
2218  fullyCorrectedEnergy / cosh(cl_eta) / 1000.,
2219  true, true, true);
2220  }
2221  else if (ptype == PATCore::ParticleType::UnconvertedPhoton) {
2222  daAF2 = getValueHistoAt(*m_G4OverAF_unconverted_scale_extra_sys,
2223  fullyCorrectedEnergy / cosh(cl_eta) / 1000.,
2224  true, true, true);
2225  }
2226  daAF2 = sqrt(daAF2*daAF2 + 0.001*0.001)*sign;
2227  }
2228  else {
2229  daAF2 = 0.001*sign;
2230  }
2231  }
2232  fullyCorrectedEnergy *= (1 + daAF2);
2233  }
2234 
2235  // Do the resolution correction
2236  if (resVar != egEnergyCorr::Resolution::None)
2237  fullyCorrectedEnergy *=
2238  getSmearingCorrection(cl_eta, cl_etaCalo, fullyCorrectedEnergy,
2239  random_seed, ptype, dataType, resVar, resType);
2240 
2241  ATH_MSG_DEBUG(std::format("after resolution correction = {:.2f}", fullyCorrectedEnergy));
2242  }
2243 
2244  return fullyCorrectedEnergy;
2245 }
2246 
2247 // This method applied the overall energy corrections and systematic variations.
2248 // Called internally by getCorrectedEnergy(...).
2249 // convention is Edata = (1+alpha)*Emc, hence Edata -> Edata/(1+alpha) to match
2250 // the MC note : all energies in MeV
2251 
2252 // returns alpha_var. var = egEnergyCorr::Scale::Nominal or any systematic
2253 // variation
2254 
2256  long int runnumber, double cl_eta, double cl_etaS2, double cl_etaCalo,
2257  double energy, // input energy (not ET!!)
2258  double energyS2, // raw energy in S2
2259  double eraw, PATCore::ParticleType::Type ptype,
2260  egEnergyCorr::Scale::Variation var, double varSF) const {
2261 
2262  double meanET = getZeeMeanET(m_use_etaCalo_scales ? cl_etaCalo : cl_eta);
2263  ATH_MSG_DEBUG("getZeeMeanET() output " << meanET);
2264  ATH_MSG_DEBUG("getZeeMeanET() eta: "
2265  << double(m_use_etaCalo_scales ? cl_etaCalo : cl_eta));
2266  double meanE = meanET * std::cosh(cl_eta);
2267  double Et = energy / std::cosh(cl_eta);
2268 
2269  // Main Scale factor
2270 
2271  double alphaZee = getAlphaZee(
2272  runnumber, m_use_etaCalo_scales ? cl_etaCalo : cl_eta, var, varSF);
2273 
2274  // Sampling recalibration
2275 
2276  double daPS, daS12, linPS, linS12, linEacc, linPS_40_elec, linEacc_40_elec,
2277  linS12_40_elec;
2278  daPS = daS12 = linPS = linS12 = linEacc = linPS_40_elec = linEacc_40_elec =
2279  linS12_40_elec = 0.;
2280 
2281  double daE4 = 0., linE4 = 0.;
2282  // E4 contribution
2303  daE4 = getE4Uncertainty(cl_eta);
2305  daE4 *= -1;
2306  linE4 = getE4NonLinearity(cl_eta, energy, ptype) -
2308  }
2309 
2310  // wtots1 contribution
2311  double daWtots1 = 0.;
2312  if ((m_esmodel == egEnergyCorr::es2017 or
2330  daWtots1 = getWtots1Uncertainty(cl_eta, energy, ptype);
2332  daWtots1 = -daWtots1;
2333  }
2334 
2335  // ... Presampler contribution
2336 
2344 
2348  daPS = getLayerUncertainty(0, cl_eta, var, varSF);
2349  linPS = getLayerNonLinearity(0, cl_eta, energy, ptype) -
2350  getLayerNonLinearity(0, cl_eta, meanE,
2352  } else {
2353  daPS = getLayerUncertainty(0, cl_eta, var, varSF);
2354  linPS = getLayerNonLinearity(0, cl_eta, energy, ptype);
2355  linEacc = getLayerNonLinearity(
2356  6, m_use_etaCalo_scales ? cl_etaCalo : cl_eta, energy, ptype);
2357  linPS_40_elec = getLayerNonLinearity(0, cl_eta, meanE,
2359  linEacc_40_elec = getLayerNonLinearity(
2360  6, m_use_etaCalo_scales ? cl_etaCalo : cl_eta,
2361  meanET * std::cosh(m_use_etaCalo_scales ? cl_etaCalo : cl_eta),
2363  ATH_MSG_DEBUG(
2364  "es2023_R22_Run2_v0 PS non-linearity before Acc correction: "
2365  << linPS);
2366  linPS = linPS - linEacc * linPS_40_elec / linEacc_40_elec;
2367  ATH_MSG_DEBUG("es2023_R22_Run2_v0 PS non-linearity after Acc correction: "
2368  << linPS);
2369  }
2370  }
2371 
2372  // ... S1 / S2 contribution
2373 
2387  daS12 = getLayerUncertainty(1, cl_eta, var, varSF);
2388  linS12 = getLayerNonLinearity(1, cl_eta, energy, ptype) -
2389  getLayerNonLinearity(1, cl_eta, meanE,
2391  } else {
2392  daS12 = getLayerUncertainty(1, cl_eta, var, varSF) *
2393  -1.; // uncertainty applied to E2 is equal to -delta E1/E2 scale
2394  linS12 = getLayerNonLinearity(1, cl_eta, energy, ptype);
2395  linEacc = getLayerNonLinearity(
2396  6, m_use_etaCalo_scales ? cl_etaCalo : cl_eta, energy, ptype);
2397  linS12_40_elec = getLayerNonLinearity(1, cl_eta, meanE,
2399  linEacc_40_elec = getLayerNonLinearity(
2400  6, m_use_etaCalo_scales ? cl_etaCalo : cl_eta,
2401  meanET * std::cosh(m_use_etaCalo_scales ? cl_etaCalo : cl_eta),
2403  ATH_MSG_DEBUG(
2404  "es2023_R22_Run2_v0 S12 non-linearity before Acc correction: "
2405  << linS12);
2406  linS12 = linS12 - linEacc * linS12_40_elec / linEacc_40_elec;
2407  ATH_MSG_DEBUG(
2408  "es2023_R22_Run2_v0 S12 non-linearity after Acc correction: "
2409  << linS12);
2410  }
2411  }
2412 
2413  // Material contribution
2414 
2415  double daMatID, daMatCryo, daMatCalo;
2416  daMatID = daMatCryo = daMatCalo = 0;
2417 
2418  // for release 21 sensitivity use the same getMaterialNonLinearity for all
2419  // particles while in sensitivities derived from run 1 this is only used for
2420  // electrons
2421 
2422  if (ptype != PATCore::ParticleType::Electron &&
2432 
2433  daMatID = getAlphaMaterial(cl_eta, egEnergyCorr::MatID, ptype, var, varSF);
2434  daMatCryo =
2435  getAlphaMaterial(cl_eta, egEnergyCorr::MatCryo, ptype, var, varSF);
2436  daMatCalo =
2437  getAlphaMaterial(cl_eta, egEnergyCorr::MatCalo, ptype, var, varSF);
2438 
2439  } else {
2440 
2441  daMatID =
2443  varSF) -
2446  daMatCryo =
2448  var, varSF) -
2451  daMatCalo =
2453  var, varSF) -
2456  }
2457 
2458  // Pedestal subtraction
2459 
2460  double daPedestal =
2461  getAlphaPedestal(cl_eta, energy, eraw, ptype, false, var, varSF) -
2463  true, var, varSF);
2464 
2465  // double pedestal systematics for 2016, Guillaume 12/05/16
2467  daPedestal *= 2;
2468  }
2469 
2470  // Leakage contribution (electron-photon difference)
2471  double daLeakage = getAlphaLeakage2D(cl_etaS2, Et, ptype, var, varSF);
2472 
2473  // L1 Gain switch contribution
2474 
2475  double daL1GainSwitch = 0.;
2476 
2479 
2480  int eg_e1hg_ptype;
2481  if (ptype == PATCore::ParticleType::Electron)
2482  eg_e1hg_ptype = 0;
2483  else if (ptype == PATCore::ParticleType::UnconvertedPhoton)
2484  eg_e1hg_ptype = 1;
2485  else if (ptype == PATCore::ParticleType::ConvertedPhoton)
2486  eg_e1hg_ptype = 2;
2487  else
2488  return -1;
2489 
2490  daL1GainSwitch = m_e1hg_tool->getAlpha(eg_e1hg_ptype, energy, cl_eta, true);
2492  daL1GainSwitch = -daL1GainSwitch;
2493  }
2494 
2495  // L2 Gain switch contribution
2496 
2497  double daL2GainSwitch = 0.;
2498  double daL2MediumGainSwitch = 0.;
2499  double daL2LowGainSwitch = 0.;
2500 
2506  if (m_gain_tool) { // recipe for run1
2507  if (!(std::abs(cl_eta) < 1.52 && std::abs(cl_eta) > 1.37) &&
2508  std::abs(cl_eta) < 2.4) {
2509  double evar = m_gain_tool->CorrectionGainTool(cl_eta, energy / GeV,
2510  energyS2 / GeV, ptype);
2511  double meanES2 = m_zeeES2Profile->GetBinContent(
2512  m_zeeES2Profile->FindFixBin(cl_eta)); // in GeV already
2513  double eref = m_gain_tool->CorrectionGainTool(
2514  cl_eta, meanE / GeV, meanES2, PATCore::ParticleType::Electron);
2515  daL2GainSwitch = evar / energy - eref / meanE;
2517  daL2GainSwitch = -daL2GainSwitch;
2518  }
2519  } else if (m_gain_tool_run2) { // recipe for run 2, see ATLASEG-44
2520  daL2GainSwitch = m_gain_tool_run2->getUncertainty(cl_etaCalo, Et, ptype,
2523  daL2GainSwitch *= -1;
2524  ATH_MSG_DEBUG("L2 gain uncertainty: " << daL2GainSwitch);
2525  } else {
2526  ATH_MSG_ERROR(
2527  "trying to compute gain systematic, but no tool for doing it has "
2528  "been instantiated, setting sys to 0");
2529  daL2GainSwitch = 0.;
2530  }
2531  }
2532 
2538  if (m_gain_tool_run2) { // recipe for run 2, see ATLASEG-44
2539  daL2MediumGainSwitch = m_gain_tool_run2->getUncertainty(
2540  cl_etaCalo, Et, ptype, m_useL2GainCorrection,
2543  daL2MediumGainSwitch *= -1;
2544  ATH_MSG_DEBUG("L2 gain Medium uncertainty: " << daL2MediumGainSwitch);
2545  } else {
2546  ATH_MSG_ERROR(
2547  "trying to compute gain systematic, but no tool for doing it has "
2548  "been instantiated, setting sys to 0");
2549  daL2MediumGainSwitch = 0.;
2550  }
2551  }
2552 
2556  if (m_gain_tool_run3_extra) { // extra for Run 3
2557  daL2MediumGainSwitch = m_gain_tool_run3_extra->getUncertainty(
2558  cl_etaCalo, Et, ptype, m_useL2GainCorrection,
2561  daL2MediumGainSwitch *= -1;
2562  ATH_MSG_DEBUG("L2 gain Medium uncertainty extraplation: " << daL2MediumGainSwitch);
2563  } else {
2564  ATH_MSG_ERROR(
2565  "trying to compute gain systematic, but no tool for doing it has "
2566  "been instantiated, setting sys to 0");
2567  daL2MediumGainSwitch = 0.;
2568  }
2569  }
2570 
2576  if (m_gain_tool_run2) { // recipe for run 2, see ATLASEG-44
2577  daL2LowGainSwitch = m_gain_tool_run2->getUncertainty(
2578  cl_etaCalo, Et, ptype, m_useL2GainCorrection,
2581  daL2LowGainSwitch *= -1;
2582  ATH_MSG_DEBUG("L2 gain Low uncertainty: " << daL2LowGainSwitch);
2583  } else {
2584  ATH_MSG_ERROR(
2585  "trying to compute Low gain systematic, but no tool for doing it has "
2586  "been instantiated, setting sys to 0");
2587  daL2LowGainSwitch = 0.;
2588  }
2589  }
2590 
2594  if (m_gain_tool_run3_extra) { // extra for Run 3
2595  daL2LowGainSwitch = m_gain_tool_run3_extra->getUncertainty(
2596  cl_etaCalo, Et, ptype, m_useL2GainCorrection,
2599  daL2LowGainSwitch *= -1;
2600  ATH_MSG_DEBUG("L2 gain Low uncertainty extraplation: " << daL2LowGainSwitch);
2601  } else {
2602  ATH_MSG_ERROR(
2603  "trying to compute gain systematic, but no tool for doing it has "
2604  "been instantiated, setting sys to 0");
2605  daL2LowGainSwitch = 0.;
2606  }
2607  }
2608 
2609  // pp0 (and IBL)
2610  double dapp0 = 0.;
2611  // values from the histogram already are 0 for the Z->ee electrons
2614  // new parameterization for release 21 reconstruction with mc16 geometries +
2615  // distortions
2625 
2626  if (std::abs(cl_eta) < 1.5)
2627  dapp0 = getMaterialEffect(egEnergyCorr::ConfigIBL, ptype, cl_eta,
2628  energy / GeV / cosh(cl_eta)) -
2631  getZeeMeanET(cl_eta) / GeV);
2632  else
2633  dapp0 = getMaterialEffect(egEnergyCorr::ConfigPP0, ptype, cl_eta,
2634  energy / GeV / cosh(cl_eta)) -
2637  getZeeMeanET(cl_eta) / GeV);
2638 
2640  dapp0 = -dapp0;
2641  }
2642  }
2643 
2644  // release 20 run 2 systematics for mc15 like geometries
2645  else {
2646  // Just pick the owned one from a unique_ptr per case
2647  const TH2* histo = nullptr;
2649  histo = m_pp0_elec.get();
2651  histo = m_pp0_conv.get();
2652  else if (ptype == PATCore::ParticleType::UnconvertedPhoton &&
2653  m_pp0_unconv)
2654  histo = m_pp0_unconv.get();
2655 
2656  if (histo) {
2657  const double aeta = std::abs(cl_eta);
2658  dapp0 = getValueHistAt(*histo, aeta, energy / GeV / cosh(cl_eta), false,
2659  true, false, true);
2661  dapp0 = -dapp0;
2662  }
2663 
2664  // normalize to pp0 systematics
2665  if (aeta > 1.5 and aeta < 2.0) {
2666  dapp0 *= 2.6;
2667  } else if (aeta >= 2.0 and aeta <= 2.5) {
2668  dapp0 *= 2.3;
2669  }
2670  }
2671  }
2672  }
2673 
2674  // Conversion systematics
2675 
2676  double daConvSyst = getAlphaConvSyst(cl_eta, energy, ptype, var, varSF);
2677 
2678  // topo cluster threshold systematics for release 21
2679  double daTopoCluster = 0;
2692  double Et = energy / cosh(cl_eta);
2693  double Et0 = 10000.;
2694  // Effect taken as 10**-3/(Et/10GeV) - order of magniture from
2695  // https://indico.cern.ch/event/669895/contributions/2745266/attachments/1535612/2405452/slides.pdf
2697  daTopoCluster = 1e-3 * (1. / (Et / Et0) - 1. / (meanET / Et0));
2699  daTopoCluster = -1e-3 * (1. / (Et / Et0) - 1. / (meanET / Et0));
2700  }
2701 
2702  // ADC non linearity correction. 30% of the effect from
2703  // https://indico.cern.ch/event/1001455/contributions/4205636/attachments/2179584/3681315/ADC-linearity-28jan2021.pdf
2704  // ?
2705  double daADCLin = 0;
2711  if (m_ADCLinearity_tool) {
2712  double corr = m_ADCLinearity_tool->getCorr(cl_etaCalo, Et, ptype) - 1.;
2713  daADCLin = 0.3 * corr;
2714  } else {
2716  "trying to compute ADC correction systematic, but no tool for doing "
2717  "it has been instantiated, setting sys to 0");
2718  daADCLin = 0.;
2719  }
2721  daADCLin *= -1;
2722  }
2723 
2724  // Total
2725  double alphaTot = alphaZee;
2726  alphaTot += daE4 * linE4;
2727  alphaTot += daPS * linPS;
2728  alphaTot += daS12 * linS12;
2729  alphaTot += daMatID + daMatCryo + daMatCalo;
2730  alphaTot += daLeakage;
2731  alphaTot += daL1GainSwitch;
2732  alphaTot += daL2GainSwitch;
2733  alphaTot += daL2MediumGainSwitch;
2734  alphaTot += daL2LowGainSwitch;
2735  alphaTot += daConvSyst;
2736  alphaTot += daPedestal;
2737  alphaTot += daWtots1;
2738  alphaTot += dapp0;
2739  alphaTot += daTopoCluster;
2740  alphaTot += daADCLin;
2741 
2742  ATH_MSG_DEBUG("alpha value for " << variationName(var) << " = " << alphaTot);
2743 
2744  return alphaTot;
2745 }
2746 
2747 // returns alpha_var - alpha_nom, for systematic variations.
2748 
2750  long int runnumber, double cl_eta, double cl_etaS2, double cl_etaCalo, double energy,
2751  double energyS2, double eraw, PATCore::ParticleType::Type ptype,
2752  egEnergyCorr::Scale::Variation var, double varSF) const {
2753 
2754  double alphaNom =
2755  getAlphaValue(runnumber, cl_eta, cl_etaS2, cl_etaCalo, energy, energyS2, eraw,
2757  double alphaVar = 0.;
2758 
2763  // not an ALLUP
2764  alphaVar = getAlphaValue(runnumber, cl_eta, cl_etaS2, cl_etaCalo, energy, energyS2,
2765  eraw, ptype, var, varSF) -
2766  alphaNom;
2767  } else if (var == egEnergyCorr::Scale::AllUp) {
2772  continue;
2773  const double v = getAlphaValue(runnumber, cl_eta, cl_etaS2, cl_etaCalo, energy,
2774  energyS2, eraw, ptype, ivar, varSF) -
2775  alphaNom;
2776  ATH_MSG_DEBUG("computing ALLUP, adding " << variationName(ivar) << ": "
2777  << v);
2778  alphaVar += pow(v, 2);
2779  }
2780  alphaVar = sqrt(alphaVar);
2781  } else if (var == egEnergyCorr::Scale::AllDown) {
2786  continue;
2787  const double v = getAlphaValue(runnumber, cl_eta, cl_etaS2, cl_etaCalo, energy,
2788  energyS2, eraw, ptype, ivar, varSF) -
2789  alphaNom;
2790  ATH_MSG_DEBUG("computing ALLDOWN, adding " << variationName(ivar) << ": "
2791  << v);
2792  alphaVar += pow(v, 2);
2793  }
2794  alphaVar = -sqrt(alphaVar);
2795  } else if (var == egEnergyCorr::Scale::AllCorrelatedUp) {
2804  continue;
2805  const double v = getAlphaValue(runnumber, cl_eta, cl_etaS2, cl_etaCalo, energy,
2806  energyS2, eraw, ptype, ivar, varSF) -
2807  alphaNom;
2808  alphaVar += pow(v, 2);
2809  }
2810  alphaVar = sqrt(alphaVar);
2820  continue;
2821  const double v = getAlphaValue(runnumber, cl_eta, cl_etaS2, cl_etaCalo, energy,
2822  energyS2, eraw, ptype, ivar, varSF) -
2823  alphaNom;
2824  alphaVar += pow(v, 2);
2825  }
2826  alphaVar = -sqrt(alphaVar);
2827  }
2828 
2829  return alphaVar;
2830 }
2831 
2832 // returns mean electron ET at given eta
2833 double egammaEnergyCorrectionTool::getZeeMeanET(double cl_eta) const {
2837  return 40000.;
2838  else {
2839  if (std::abs(cl_eta) >= 2.47)
2840  cl_eta = 2.46;
2841  return m_meanZeeProfile->GetBinContent(
2842  m_meanZeeProfile->FindBin(std::abs(cl_eta))) *
2843  1000;
2844  }
2845 }
2846 
2847 // RESOLUTION FUNCTIONS START HERE (MB)
2848 
2849 // sampling term inMC, parametrization from Iro Koletsou
2850 
2852 
2853  double aeta = std::abs(cl_eta);
2854  double sampling = 0.;
2855 
2856  if (aeta < 0.8)
2857  sampling = 0.091;
2858 
2859  else if (aeta < 1.37)
2860  sampling = 0.036 + 0.130 * aeta;
2861 
2862  else if (aeta < 1.52)
2863  sampling = 0.27;
2864 
2865  else if (aeta < 2.0)
2866  sampling = 0.85 - 0.36 * aeta;
2867 
2868  else if (aeta < 2.3)
2869  sampling = 0.16;
2870 
2871  else if (aeta < 2.5)
2872  sampling = -1.05 + 0.52 * aeta;
2873 
2874  return sampling;
2875 }
2876 
2877 // sampling term uncertainty
2878 
2880 
2881  (void)cl_eta; // not used
2882  return 0.1; // when will this be improved?
2883 }
2884 
2885 // noise term in MC (from Iro)
2886 
2888 
2889  double aeta = std::abs(cl_eta);
2890  double noise = 0.;
2891 
2892  double noise37[25] = {0.27, 0.27, 0.27, 0.27, 0.27, 0.26, 0.25, 0.23, 0.21,
2893  0.19, 0.17, 0.16, 0.15, 0.14, 0.27, 0.23, 0.17, 0.15,
2894  0.13, 0.10, 0.07, 0.06, 0.05, 0.04, 0.03};
2895 
2896  int ieta = (int)(aeta / 0.1);
2897 
2898  if (ieta >= 0 && ieta < 25)
2899  noise = noise37[ieta] * cosh(cl_eta); // the above parametrization is vs ET
2900 
2901  return noise;
2902 }
2903 
2904 // constant term in MC (local)
2905 
2907 
2908  double aeta = std::abs(cl_eta);
2909  double cst = 0.;
2910 
2911  if (aeta < 0.6)
2912  cst = 0.005;
2913 
2914  else if (aeta < 1.75)
2915  cst = 0.003;
2916 
2917  else if (aeta < 2.5)
2918  cst = 0.0055 * (2.69 - aeta);
2919 
2920  // cst = 0.005;
2921 
2922  return cst;
2923 }
2924 
2925 // constant term fitted in data (long range)
2926 
2928  return std::max(0., m_resNom->GetBinContent(m_resNom->FindFixBin(eta)));
2929 }
2930 
2932  return m_resSyst->GetBinContent(m_resSyst->FindFixBin(eta));
2933 }
2934 
2936  return m_resSystOFC->GetBinContent(m_resSystOFC->FindFixBin(eta));
2937 }
2938 
2939 // fitted Z peak resolution, data, in GeV
2940 
2942 
2943  return m_peakResData->GetBinContent(
2944  std::as_const(*m_peakResData).GetXaxis()->FindBin(cl_eta));
2945 }
2946 
2947 // fitted Z peak resolution, MC, in GeV
2948 
2950 
2951  return m_peakResMC->GetBinContent(
2952  std::as_const(*m_peakResMC).GetXaxis()->FindBin(cl_eta));
2953 }
2954 
2955 // correlated part of constant term uncertainty, in data (approx.)
2956 
2958  double cl_eta) const {
2959 
2960  double mz = 91.2;
2961 
2962  double resData = dataZPeakResolution(cl_eta);
2963  double resMC = mcZPeakResolution(cl_eta);
2964  double cmc = mcConstantTerm(cl_eta);
2965 
2966  double smpup = 1. + mcSamplingTermRelError(cl_eta);
2967  double smpdo = 1. - mcSamplingTermRelError(cl_eta);
2968 
2969  double central =
2970  sqrt(2 * (resData * resData - resMC * resMC) / mz / mz + cmc * cmc);
2971  double vardown =
2972  sqrt(2 * (resData * resData - resMC * resMC * smpup * smpup) / mz / mz +
2973  cmc * cmc);
2974  double varup =
2975  sqrt(2 * (resData * resData - resMC * resMC * smpdo * smpdo) / mz / mz +
2976  cmc * cmc);
2977 
2978  double errdown = std::abs(central - vardown);
2979  double errup = std::abs(central - varup);
2980 
2981  return .5 * (errup + errdown);
2982 }
2983 
2984 // get fractional uncertainty on resolution
2985 
2988  double etaCalo, PATCore::ParticleType::Type ptype,
2991 
2992 {
2993 
2994  int eg_resolution_ptype;
2995  if (ptype == PATCore::ParticleType::Electron)
2996  eg_resolution_ptype = 0;
2997  else if (ptype == PATCore::ParticleType::UnconvertedPhoton)
2998  eg_resolution_ptype = 1;
2999  else if (ptype == PATCore::ParticleType::ConvertedPhoton)
3000  eg_resolution_ptype = 2;
3001  else
3002  return -1;
3003 
3004  int isys = 0;
3007  isys = 0xFFFF & ~0x200; // remove AF bit in AllUp/AllDown
3008  }
3011  isys = 0x1;
3012  }
3015  isys = 0x2;
3016  }
3019  isys = 0x4;
3020  }
3023  isys = 0x8;
3024  }
3027  isys = 0x10;
3028  }
3031  isys = 0x20;
3032  }
3035  isys = 0x40;
3036  }
3037 
3040  isys = 0x80;
3041  }
3044  isys = 0x100;
3045  }
3048  isys = 0x200;
3049  }
3052  isys = 0x400;
3053  }
3054 
3055  double sign = 1.;
3068  sign = -1.;
3069 
3070  double resolution;
3071  double resolution_error;
3072  double resolution_error_up;
3073  double resolution_error_down;
3074 
3075  getResolution_systematics(eg_resolution_ptype, energy, eta, etaCalo, isys,
3076  resolution, resolution_error, resolution_error_up,
3077  resolution_error_down, resType,
3079 
3080  // total resolution uncertainty
3083  resolution_error = resolution_error / resolution * sign;
3084  } else {
3085  if (sign == 1)
3086  resolution_error = resolution_error_up / resolution;
3087  else
3088  resolution_error = resolution_error_down / resolution;
3089  }
3090 
3091  return resolution_error;
3092 }
3093 
3094 // total resolution uncertainty (fractional) (OLD model)
3095 
3097  double cl_eta, double& errUp,
3098  double& errDown) const {
3099 
3100  double Cdata = dataConstantTerm(cl_eta);
3101  double Cdata_cor = dataConstantTermCorError(cl_eta);
3102  double Cdata_err = dataConstantTermError(cl_eta);
3103 
3104  double Cdata_unc = 0.;
3105  if (Cdata_err > Cdata_cor)
3106  Cdata_unc = sqrt(Cdata_err * Cdata_err - Cdata_cor * Cdata_cor);
3107  if (Cdata_unc < 0.001)
3108  Cdata_unc = 0.001; // preserve at least the stat error
3109 
3110  double Smc = mcSamplingTerm(cl_eta);
3111  double Smc_err = mcSamplingTermRelError(cl_eta);
3112 
3113  double central = fcn_sigma(energy, Cdata, 0., Smc, 0.);
3114 
3115  double err1 = fcn_sigma(energy, Cdata, Cdata_unc, Smc, 0.) - central;
3116  double err2 = fcn_sigma(energy, Cdata, -Cdata_unc, Smc, 0.) - central;
3117  double err3 = fcn_sigma(energy, Cdata, -Cdata_cor, Smc, Smc_err) - central;
3118  double err4 = -err3;
3119 
3120  errUp = 0;
3121  if (err1 > 0)
3122  errUp = sqrt(errUp * errUp + err1 * err1);
3123  if (err2 > 0)
3124  errUp = sqrt(errUp * errUp + err2 * err2);
3125  if (err3 > 0)
3126  errUp = sqrt(errUp * errUp + err3 * err3);
3127  if (err4 > 0)
3128  errUp = sqrt(errUp * errUp + err4 * err4);
3129 
3130  errDown = -errUp;
3131 }
3132 
3133 // total resolution (fractional)
3134 
3136  double energy, double cl_eta, double cl_etaCalo,
3137  PATCore::ParticleType::Type ptype, bool withCT, bool fast,
3139  int eg_resolution_ptype;
3140  if (ptype == PATCore::ParticleType::Electron)
3141  eg_resolution_ptype = 0;
3142  else if (ptype == PATCore::ParticleType::UnconvertedPhoton)
3143  eg_resolution_ptype = 1;
3144  else if (ptype == PATCore::ParticleType::ConvertedPhoton)
3145  eg_resolution_ptype = 2;
3146  else {
3147  ATH_MSG_FATAL("cannot understand particle type");
3148  return -1;
3149  }
3150 
3151  double sig2 = 0.;
3152 
3154  sig2 = pow(m_resolution_tool->getResolution(eg_resolution_ptype, energy,
3155  cl_eta, resType),
3156  2);
3157  const double et = energy / cosh(cl_eta);
3158  sig2 += pow(pileUpTerm(energy, cl_eta, eg_resolution_ptype) / et,
3159  2); // TODO: why et and not E?
3160  } else { // OLD model
3161 
3162  double energyGeV = energy / GeV;
3163  double a = mcSamplingTerm(cl_eta);
3164  double b = mcNoiseTerm(cl_eta);
3165  double c = mcConstantTerm(cl_eta);
3166  sig2 = a * a / energyGeV + b * b / energyGeV / energyGeV + c * c;
3167  }
3168 
3169  if (withCT and fast) {
3170  throw std::runtime_error(
3171  "It doesn't make sense to ask resolution fast sim + additional CT."
3172  " The resolution on data is FULL sim resolution + CT");
3173  }
3174 
3175  if (fast and std::abs(cl_eta) < 2.5) {
3198 
3199  double ratio_IQR_full_fast = 1.;
3200  const double ptGeV = energy / cosh(cl_eta) / 1E3;
3201 
3211  //
3212  // for es2017_R21_v1, histograms contain directly values of
3213  // deltaSigma**2 of relative energy resolution (FulSim-FastSIm) so need
3214  // to subtract this value to get the sigma**2 of FastSim
3215  bool interpolate_eta = false;
3216  bool interpolate_pt = false;
3218  // interpolate_eta = true;
3219  interpolate_pt = true;
3220  }
3221  if (ptype == PATCore::ParticleType::Electron)
3222  sig2 -= getValueHistAt(*m_G4OverAFII_resolution_electron, cl_eta,
3223  ptGeV, true, true, true, true,
3224  interpolate_eta, interpolate_pt);
3226  sig2 -= getValueHistAt(*m_G4OverAFII_resolution_unconverted, cl_eta,
3227  ptGeV, true, true, true, true,
3228  interpolate_eta, interpolate_pt);
3230  sig2 -= getValueHistAt(*m_G4OverAFII_resolution_converted, cl_eta,
3231  ptGeV, true, true, true, true,
3232  interpolate_eta, interpolate_pt);
3233  if (sig2 < 0.)
3234  sig2 = 0.;
3235  } else {
3236  if (ptype == PATCore::ParticleType::Electron) {
3237  ratio_IQR_full_fast = getValueHistAt(
3238  *m_G4OverAFII_resolution_electron, ptGeV, cl_eta, true, false);
3239  } else if (ptype == PATCore::ParticleType::UnconvertedPhoton) {
3240  ratio_IQR_full_fast = getValueHistAt(
3241  *m_G4OverAFII_resolution_unconverted, ptGeV, cl_eta, true, false);
3242  } else if (ptype == PATCore::ParticleType::ConvertedPhoton) {
3243  ratio_IQR_full_fast = getValueHistAt(
3244  *m_G4OverAFII_resolution_converted, ptGeV, cl_eta, true, false);
3245  }
3246 
3247  sig2 /= ratio_IQR_full_fast * ratio_IQR_full_fast;
3248  }
3249  }
3250  }
3251 
3252  // add the additional constant term from the Zee data/MC measurement
3253  if (withCT)
3254  sig2 += pow(
3255  dataConstantTerm(m_use_etaCalo_scales ? cl_etaCalo : cl_eta),
3256  2); // TODO: is it correct? Or should be += -c**2 + (c + deltac) ** 2 ?
3257 
3258  return sqrt(sig2);
3259 }
3260 
3261 // internal use only
3262 
3263 double egammaEnergyCorrectionTool::fcn_sigma(double energy, double Cdata,
3264  double Cdata_er, double S,
3265  double S_er) {
3266 
3267  double sigma2 = std::pow((Cdata + Cdata_er) * energy, 2) +
3268  std::pow(S * (1 + S_er) * std::sqrt(energy), 2);
3269 
3270  double sigma = 0;
3271  if (sigma2 > 0)
3272  sigma = sqrt(sigma2);
3273 
3274  return sigma / energy;
3275 }
3276 
3277 // derive smearing correction
3278 
3280  double cl_eta, double cl_etaCalo, double energy, RandomNumber seed,
3285 
3287  ATH_MSG_FATAL("Trying to compute smearing correction on data");
3288  }
3289 
3291  return 1.0;
3292 
3293  const double energyGeV = energy / GeV;
3294 
3295  // relative resolutions
3296  const double resMC =
3297  resolution(energy, cl_eta, cl_etaCalo, ptype, false, // no additional CT
3299  double resData =
3300  resolution(energy, cl_eta, cl_etaCalo, ptype, true, // with additional CT
3301  false, resType); // on top of Full simulation
3302 
3303  ATH_MSG_DEBUG("resolution in data: " << resData << " in MC: " << resMC);
3304 
3306  resData *= 1 + getResolutionError(dataType, energy, cl_eta, cl_etaCalo,
3307  ptype, value, resType);
3308  } else { // OLD model
3309  double errUp, errDown;
3310  resolutionError(energyGeV, cl_eta, errUp, errDown);
3312  resData += errDown;
3314  resData += errUp;
3316  // std::cout << "getSmearingCorrection : wrong value, return 1" <<
3317  // std::endl;
3318  return 1.0;
3319  }
3320  }
3321 
3322  ATH_MSG_DEBUG("resolution in data after systematics: " << resData);
3323 
3324  const double sigma2 =
3325  std::pow(resData * energyGeV, 2) - std::pow(resMC * energyGeV, 2);
3326 
3327  // TODO: for nominal case it can be simplified to:
3328  // const double sigma = dataConstantTerm(m_use_etaCalo_scales ? cl_etaCalo :
3329  // cl_eta) * energyGeV; which is just the additional constant term
3330  if (sigma2 <= 0) {
3331  return 1;
3332  }
3333 
3334  const double sigma = sqrt(sigma2);
3335 
3336  TRandom3 rng(seed);
3337 
3338  const double DeltaE0 = rng.Gaus(0, sigma);
3339  const double cor0 = (energyGeV + DeltaE0) / energyGeV;
3340 
3341  ATH_MSG_DEBUG("sigma|DeltaE0|cor0|seed = " << sigma << "|" << DeltaE0 << "|"
3342  << cor0 << "|" << rng.GetSeed());
3343 
3344  return cor0; // TODO: why not returning DeltaE0 and apply E -> E + DeltaE0 ?
3345 }
3346 
3347 // a calibration correction for crack electrons, to be applied to both data11
3348 // and MC11 not to be used in data12 / MC12
3349 
3351  double eta, double ET, PATCore::ParticleType::Type ptype) const {
3352 
3353  if (ptype != PATCore::ParticleType::Electron ||
3355  return 1.;
3356 
3357  double aeta = std::abs(eta);
3358 
3359  if (aeta < 1.42 || aeta > 1.55)
3360  return 1.;
3361 
3362  const int nBoundaries = 18;
3363  double ETBoundaries[nBoundaries] = {0., 5.4, 8.5, 12.9, 16., 20.,
3364  25., 30., 35., 40., 45., 50.,
3365  55., 60., 65., 70., 75., 99999.};
3366 
3367  double CalibFactors[nBoundaries - 1] = {
3368  0.884845, 0.898526, 0.902439, 0.91899, 0.925868, 0.929440,
3369  0.948080, 0.943788, 0.96026, 0.955709, 0.964285, 0.95762,
3370  0.970385, 0.963489, 0.968149, 0.970799, 0.961617};
3371 
3372  int i0 = -1;
3373  for (int i = 0; i < nBoundaries - 1; i++)
3374  if (ET / GeV > ETBoundaries[i] && ET / GeV <= ETBoundaries[i + 1])
3375  i0 = i;
3376 
3377  if (i0 >= 0 && i0 < nBoundaries - 1)
3378  return 1. / CalibFactors[i0];
3379 
3380  return 1.;
3381 }
3382 
3383 // AF -> G4 correction
3384 
3386  double eta, double ptGeV, PATCore::ParticleType::Type ptype) const {
3387  const double aeta = std::abs(eta);
3388  if (aeta > 2.47)
3389  return 1.;
3390 
3391  if ((m_esmodel >= egEnergyCorr::es2015PRE and
3395 
3397  //
3398  // in es02017_R21_v1 : AF2 to FullSim correction is in a 2D eta-Pt
3399  // histogram
3400  bool interpolate_eta = false;
3401  bool interpolate_pt = false;
3403  // interpolate_eta = true;
3404  interpolate_pt = true;
3405  }
3406  if (ptype == PATCore::ParticleType::Electron) {
3407  return (1. + getValueHistAt(*m_G4OverAFII_electron_2D, aeta, ptGeV,
3408  true, true, true, true,
3409  interpolate_eta, interpolate_pt));
3410  } else if (ptype == PATCore::ParticleType::ConvertedPhoton) {
3411  return (1. + getValueHistAt(*m_G4OverAFII_converted_2D, aeta, ptGeV,
3412  true, true, true, true,
3413  interpolate_eta, interpolate_pt));
3414  } else if (ptype == PATCore::ParticleType::UnconvertedPhoton) {
3415  return (1. + getValueHistAt(*m_G4OverAFII_unconverted_2D, aeta, ptGeV,
3416  true, true, true, true,
3417  interpolate_eta, interpolate_pt));
3418  } else {
3419  throw std::runtime_error("particle not valid");
3420  }
3421  } else {
3422  if (ptype == PATCore::ParticleType::Electron) {
3423  return getValueHistoAt(*m_G4OverAFII_electron, aeta);
3424  } else if (ptype == PATCore::ParticleType::ConvertedPhoton) {
3425  return getValueHistoAt(*m_G4OverAFII_converted, aeta);
3426  } else if (ptype == PATCore::ParticleType::UnconvertedPhoton) {
3427  return getValueHistoAt(*m_G4OverAFII_unconverted, aeta);
3428  } else {
3429  throw std::runtime_error("particle not valid");
3430  }
3431  }
3432  } else {
3433  // run 1
3434  return m_G4OverAFII_electron->GetBinContent(
3435  std::as_const(*m_G4OverAFII_electron).GetXaxis()->FindBin(eta));
3436  }
3437 }
3438 
3439 // Frozen Showers -> G4 correction
3440 
3442 
3443  double aeta = std::abs(eta);
3444  if (aeta < 3.3 || aeta > 4.9)
3445  return 1.;
3446 
3447  return m_G4OverFrSh->GetBinContent(
3448  std::as_const(*m_G4OverFrSh).GetXaxis()->FindBin(aeta));
3449 }
3450 
3451 // functions for energy scale corrections
3452 
3454  long int runnumber, double eta, egEnergyCorr::Scale::Variation var,
3455  double varSF) const {
3456 
3457  if (!m_zeeNom) {
3458  ATH_MSG_FATAL("no data for Zee");
3459  return -999.0;
3460  }
3461 
3462  double value = 0.;
3463  int ieta = std::as_const(*m_zeeNom).GetXaxis()->FindBin(eta);
3464  value = m_zeeNom->GetBinContent(ieta);
3465 
3466  // reference: https://twiki.cern.ch/twiki/bin/view/AtlasProtected/Run3DataMCForAnalysis#Run3_Data
3467  // !!! no calibration yet for 2025 and beyond !!!
3468  // 2024 is the nominal (469043-490223)
3469  // 2023
3471  runnumber >= 446800 && runnumber <= 462502) {
3472  int ieta = std::as_const(*m_zeeNom_data2023).GetXaxis()->FindBin(eta);
3473  value = m_zeeNom_data2023->GetBinContent(ieta);
3474  }
3475  // 2022
3477  runnumber >= 415278 && runnumber <= 440613) {
3478  int ieta = std::as_const(*m_zeeNom_data2022).GetXaxis()->FindBin(eta);
3479  value = m_zeeNom_data2022->GetBinContent(ieta);
3480  }
3481 
3482  // 2017
3487  runnumber <= 341649 && runnumber >= 324320) {
3488  int ieta = std::as_const(*m_zeeNom_data2017).GetXaxis()->FindBin(eta);
3489  value = m_zeeNom_data2017->GetBinContent(ieta);
3490  }
3491 
3492  // for es2017_R21_v0 different set of scales for 2017, 2016 and 2015 data
3493  if (m_esmodel == egEnergyCorr::es2017_R21_v0 && runnumber < 322817 &&
3494  runnumber >= 297000) {
3495  int ieta = std::as_const(*m_zeeNom_data2016).GetXaxis()->FindBin(eta);
3496  value = m_zeeNom_data2016->GetBinContent(ieta);
3497  }
3498 
3504  runnumber < 322817 && runnumber >= 297000) {
3505  int ieta = std::as_const(*m_zeeNom_data2016).GetXaxis()->FindBin(eta);
3506  value = m_zeeNom_data2016->GetBinContent(ieta);
3507  }
3508 
3510  runnumber >= 297000) {
3511  int ieta = std::as_const(*m_zeeNom_data2016).GetXaxis()->FindBin(eta);
3512  value = m_zeeNom_data2016->GetBinContent(ieta);
3513  }
3514 
3516  int ieta = std::as_const(*m_zeeNom_data2015).GetXaxis()->FindBin(eta);
3517  value = m_zeeNom_data2015->GetBinContent(ieta);
3518  }
3519 
3521  int ieta = std::as_const(*m_zeeNom_data2018).GetXaxis()->FindBin(eta);
3522  value = m_zeeNom_data2018->GetBinContent(ieta);
3523  }
3524 
3526  int ieta = std::as_const(*m_zeeNom).GetXaxis()->FindBin(eta);
3527  value = m_zeeNom->GetBinContent(ieta);
3528  }
3529 
3530  if ((m_esmodel == egEnergyCorr::es2017 or
3541  runnumber < 297000) {
3542  // 2 sets of scales for this configuration
3543  // change histogram if 2015 data
3544  int ieta = std::as_const(*m_zeeNom_data2015).GetXaxis()->FindBin(eta);
3545  value = m_zeeNom_data2015->GetBinContent(ieta);
3546  }
3547 
3552  // special case for es2015PRE
3553  // additional correction due to LAr temperature effect
3554  // for extrapolation 2012 -> 2015 temperature change
3555  // numbers from Guillaume 20150506
3556  /*
3557  2012 (K) 22/04/2015 DeltaResponse 2015/2012 (-2%/K) deltaAlpha
3558  EndCap C 88.41 88.63 -0.45% -0.45%
3559  Barrel C 88.47 88.70 -0.46% -0.46%
3560  Barrel A 88.50 88.71 -0.42% -0.42%
3561  EndCap A 88.70 88.70 +0.00% +0.00%
3562  */
3563  if (eta >= 0) { // side A
3564  if (eta < 1.45)
3565  value += -0.42E-2;
3566  else if (eta < 3.2)
3567  value += 0.;
3568  } else { // side C
3569  if (eta > -1.45)
3570  value += -0.46E-2;
3571  else if (eta > -3.2)
3572  value += -0.45E-2;
3573  }
3574 
3575  // special case for es2015PRE
3576  // additional correction for uA->MeV first 2 weeks 2015 data
3577  if (runnumber >= 266904 and runnumber <= 267639 and
3579  const double uA2MeV_correction =
3580  m_uA2MeV_2015_first2weeks_correction->GetBinContent(
3581  m_uA2MeV_2015_first2weeks_correction->FindFixBin(std::abs(eta)));
3582  // this takes into account also O((uA2MeV_correction - 1) * alpha) terms
3583  // a simpler formula would be: value + uA2MeV_correction - 1
3584  value = uA2MeV_correction * (1 + value) - 1;
3585  }
3586  } // end special case for es2015PRE*
3587 
3591  // keep the correction 2012->2015 for |eta| > 2.5
3592  // if (eta > 2.5 and eta < 3.2) value += 0.;
3593  if (eta < -2.5 and eta > -3.2)
3594  value += -0.45E-2;
3595  }
3596 
3598  m_esmodel ==
3599  egEnergyCorr::es2016PRE) { // correction for the extrapolation from
3600  // es2015_summer
3601  if (runnumber >= 297000) { // only for 2016 data
3602  if (eta >= 0) { // side A
3603  if (eta < 1.45)
3604  value *= 1.00028;
3605  else if (eta < 3.2)
3606  value *= 1.00018;
3607  } else { // side C
3608  if (eta > -1.45)
3609  value *= 1.00028;
3610  else if (eta > -3.2)
3611  value *= 0.99986;
3612  }
3613  }
3614  }
3615 
3616  ATH_MSG_DEBUG("getAlphaZee, def alpha " << value << " at eta = " << eta);
3617 
3620  const double sign = (var == egEnergyCorr::Scale::ZeeStatUp) ? 1 : -1;
3621 
3622  TH1* h = ((TH1*)m_zeeNom.get());
3623 
3624  if ((m_esmodel == egEnergyCorr::es2017 or
3636  runnumber < 297000) {
3637  h = ((TH1*)m_zeeNom_data2015.get()); // special for 2015 with es2017
3638  }
3646  runnumber >= 297000 && runnumber < 322817) {
3647  h = m_zeeNom_data2016.get(); // 2016 data
3648  }
3650  h = m_zeeNom_data2018.get();
3651  }
3652  //egEnergyCorr::es2024_Run3_ofc0_v0 noting to do (have only m_zeeNom)
3653 
3658  runnumber >= 324320 && runnumber <= 341649) {
3659  h = ((TH1*)m_zeeNom_data2017.get()); // 2017 data
3660  }
3662  runnumber >= 415278 && runnumber <= 440613) {
3663  h = ((TH1*)m_zeeNom_data2022.get()); // 2022 data
3664  }
3666  runnumber >= 446800 && runnumber <= 462502) {
3667  h = ((TH1*)m_zeeNom_data2023.get()); // 2023 data
3668  }
3669  double stat_error = h->GetBinError(h->FindFixBin(eta));
3671  stat_error = stat_error / sqrt(h->GetNbinsX());
3672  }
3673  value += sign * stat_error * varSF;
3674  } else if (var == egEnergyCorr::Scale::ZeeSystUp && m_zeeSyst) {
3675  value += get_ZeeSyst(eta) * varSF;
3676 
3677  } else if (var == egEnergyCorr::Scale::ZeeSystDown && m_zeeSyst) {
3678  value -= get_ZeeSyst(eta) * varSF;
3679  } else if (var == egEnergyCorr::Scale::OFCUp && m_zeeSystOFC) {
3680  value += get_OFCSyst(eta) * varSF;
3681  } else if (var == egEnergyCorr::Scale::OFCDown && m_zeeSystOFC) {
3682  value -= get_OFCSyst(eta) * varSF;
3683  } else if (var == egEnergyCorr::Scale::EXTRARUN3PREUp &&
3684  m_esmodel ==
3685  egEnergyCorr::es2022_R22_PRE) // as this is a flat 0.4% syst
3686  // hardcoded, need to switch on
3687  // only for es2022_R22_PRE. OFC
3688  // should be OK, as the OFC file
3689  // is only defined for this
3690  // pre-recommendation.
3691  {
3692  value +=
3693  0.4E-2 *
3694  varSF; // flat 0.4% syst (details:
3695  // https://indico.cern.ch/event/1250560/contributions/5253619/attachments/2586538/4462853/mc21-change.pdf)
3698  value -= 0.4E-2 * varSF;
3699  } else if (var == egEnergyCorr::Scale::ZeePhysUp && m_zeePhys) {
3700 
3701  int ieta = std::as_const(*m_zeePhys).GetXaxis()->FindBin(eta);
3702  value += m_zeePhys->GetBinContent(ieta) * varSF;
3703 
3704  } else if (var == egEnergyCorr::Scale::ZeePhysDown && m_zeePhys) {
3705 
3706  int ieta = std::as_const(*m_zeePhys).GetXaxis()->FindBin(eta);
3707  value -= m_zeePhys->GetBinContent(ieta) * varSF;
3708 
3716  // special case only for es2015PRE
3717  // add LAr temperature effect for extrapolation 2012 -> 2015 temperature
3718  // change numbers from Guillaume 20150506
3719 
3720  const double aeta = std::abs(eta);
3721  const double sign =
3723  if (aeta < 1.45) {
3724  value += 0.15E-2 * sign;
3725  } else if (aeta > 1.45 and aeta < 3.2) {
3726  value += 0.25E-2 * sign;
3727  }
3728  }
3729 
3735  // keep 2012->2015 extrapolation correction for eta > 2.5
3736  const double aeta = std::abs(eta);
3737  const double sign =
3739  if (aeta > 2.5 and aeta < 3.2) {
3740  value += 0.25E-2 * sign;
3741  }
3742  }
3743 
3748  // special case for es2016PRE (extrapolation from 2015)
3749  const double sign =
3751  // temp + pileup
3752  value += qsum(0.05E-2, 0.02E-2) *
3753  sign; // Guillaume email 23/05/2016 + 26/5/2016
3754  }
3755 
3756  else if (var == egEnergyCorr::Scale::ZeeAllDown ||
3758 
3759  int ieta = std::as_const(*m_zeeNom).GetXaxis()->FindBin(eta);
3760  double diff = pow(m_zeeNom->GetBinError(ieta) * varSF, 2);
3761 
3762  if (m_zeeSyst) {
3763  diff += pow(get_ZeeSyst(eta) * varSF, 2);
3764  }
3765 
3766  if (m_zeePhys) {
3767  ieta = std::as_const(*m_zeePhys).GetXaxis()->FindBin(eta);
3768  diff += pow(m_zeePhys->GetBinContent(ieta) * varSF, 2);
3769  }
3770 
3772  value += sqrt(diff);
3774  value -= sqrt(diff);
3775  }
3776 
3777  return value;
3778 }
3779 
3781  const double aeta = std::abs(eta);
3782  double data_mc_difference = 0.;
3783 
3785  if ((aeta > 1.72) or (aeta < 1.4)) {
3786  return 0.;
3787  }
3788  else {
3789  // 15% for Run 3 from Tao 13/02/2025, need to recalibrate in future
3790  data_mc_difference = 15E-2;
3791  }
3792  }
3793  else {
3794  if ((aeta > 1.6) or (aeta < 1.4)) {
3795  return 0.;
3796  }
3797  // numbers from Archil 20/5/2016
3798  else if (aeta < 1.46) {
3799  data_mc_difference = 1E-2;
3800  } // 1.4 - 1.46
3801  else if (aeta < 1.52) {
3802  data_mc_difference = 3E-2;
3803  } // 1.46 - 1.52
3804  else {
3805  data_mc_difference = 4.3E-2;
3806  } // 1.52 - 1.6
3807  }
3808 
3809  const double em_scale = 2.4E-2;
3810  const double mbias = 1E-2; // Archil presentation 26/5/2016
3811  const double laser = 4E-2;
3812 
3813  return std::sqrt(data_mc_difference * data_mc_difference +
3814  em_scale * em_scale + mbias * mbias + laser * laser);
3815 }
3816 
3818  double cl_eta, double energy, PATCore::ParticleType::Type ptype) const {
3819  double value = 0;
3820 
3821  // Get slopes and wstot values
3822  // deltaE/E (Et, particle type ) = 2*A/mZ * ( wstot(Et,particle type)_data -
3823  // <wstot(40 GeV Et electrons)_data)> ) - 2*B/mZ* (wstot(Et,particle type)_MC
3824  // - <w wstot(40 GeV Et electrons)_MC>) factor 2 to go from slopes in dM/M to
3825  // dE/E
3826 
3827  //|eta|>2.4 => use last eta bin
3828  if (cl_eta < -2.4)
3829  cl_eta = -2.35;
3830  if (cl_eta > 2.4)
3831  cl_eta = 2.35;
3832 
3833  int bin = m_wstot_slope_A_data->FindFixBin(cl_eta);
3834  double A = m_wstot_slope_A_data->GetBinContent(bin);
3835  double B = m_wstot_slope_B_MC->GetBinContent(bin);
3836 
3837  // the wstot=f(pT) depends on the particle type
3838  double ETGeV = energy / cosh(cl_eta) / 1E3;
3839  double wstot_pT_data_p0 = 0.;
3840  double wstot_pT_data_p1 = 0.;
3841  double wstot_pT_MC_p0 = 0.;
3842  double wstot_pT_MC_p1 = 0.;
3843 
3844  double wstot_40_data =
3845  m_wstot_pT_data_p0_electrons->GetBinContent(bin) +
3846  (m_wstot_pT_data_p1_electrons->GetBinContent(bin)) / sqrt(40.);
3847  double wstot_40_MC =
3848  m_wstot_pT_MC_p0_electrons->GetBinContent(bin) +
3849  (m_wstot_pT_MC_p1_electrons->GetBinContent(bin)) / sqrt(40.);
3850 
3851  if (ptype == PATCore::ParticleType::Electron) {
3852  wstot_pT_data_p0 = m_wstot_pT_data_p0_electrons->GetBinContent(bin);
3853  wstot_pT_data_p1 = m_wstot_pT_data_p1_electrons->GetBinContent(bin);
3854  wstot_pT_MC_p0 = m_wstot_pT_MC_p0_electrons->GetBinContent(bin);
3855  wstot_pT_MC_p1 = m_wstot_pT_MC_p1_electrons->GetBinContent(bin);
3856  } else if (ptype == PATCore::ParticleType::UnconvertedPhoton) {
3857  wstot_pT_data_p0 =
3859  wstot_pT_data_p1 =
3861  wstot_pT_MC_p0 = m_wstot_pT_MC_p0_unconverted_photons->GetBinContent(bin);
3862  wstot_pT_MC_p1 = m_wstot_pT_MC_p1_unconverted_photons->GetBinContent(bin);
3863  } else if (ptype == PATCore::ParticleType::ConvertedPhoton) {
3864  wstot_pT_data_p0 = m_wstot_pT_data_p0_converted_photons->GetBinContent(bin);
3865  wstot_pT_data_p1 = m_wstot_pT_data_p1_converted_photons->GetBinContent(bin);
3866  wstot_pT_MC_p0 = m_wstot_pT_MC_p0_converted_photons->GetBinContent(bin);
3867  wstot_pT_MC_p1 = m_wstot_pT_MC_p1_converted_photons->GetBinContent(bin);
3868  }
3869 
3870  double wstot_pT_data = 0.;
3871  double wstot_pT_MC = 0.;
3872 
3873  // Initial parametrization: [0]+1*pT
3874  // wstot_pT_data = wstot_pT_data_p0+wstot_pT_data_p1*ETGeV;
3875  // prevent wstot_pT_data from being negative
3876  // if(wstot_pT_data<0) wstot_pT_data = 0.;
3877 
3878  // New parametrization: p0+p1/sqrt(pT)
3879  // flat uncertainty below 25 GeV
3880  if (ETGeV < 25.)
3881  ETGeV = 25.;
3882 
3883  wstot_pT_data = wstot_pT_data_p0 + wstot_pT_data_p1 / sqrt(ETGeV);
3884  wstot_pT_MC = wstot_pT_MC_p0 + wstot_pT_MC_p1 / sqrt(ETGeV);
3885 
3886  value = 2 * A / 91.2 * (wstot_pT_data - wstot_40_data) -
3887  2 * B / 91.2 * (wstot_pT_MC - wstot_40_MC);
3888 
3889  return value;
3890 }
3891 
3892 // Layer scale uncertainties and induced non-linearity
3894 
3896  int iLayer, double cl_eta, egEnergyCorr::Scale::Variation var,
3897  double varSF) const {
3898 
3899  double value = 0.;
3900 
3902  return value;
3903 
3904  // nearest eta outside of crack (for PS scale values and uncertainties)
3905  double nearestEta = cl_eta;
3909  nearestEta = nearestEtaBEC(cl_eta);
3910  }
3911 
3912  if (iLayer == 0) { // use nearestEta
3913 
3915  value = m_aPSNom->GetBinError(m_aPSNom->FindFixBin(nearestEta));
3916 
3917  else if (var == egEnergyCorr::Scale::PSDown && m_aPSNom)
3918  value = -m_aPSNom->GetBinError(m_aPSNom->FindFixBin(nearestEta));
3919 
3921  value = m_daPSb12->GetBinContent(m_daPSb12->FindFixBin(nearestEta));
3922 
3924  value = -m_daPSb12->GetBinContent(m_daPSb12->FindFixBin(nearestEta));
3925 
3927  value = m_daPSCor->GetBinContent(m_daPSCor->FindFixBin(nearestEta));
3928 
3930  value = -m_daPSCor->GetBinContent(m_daPSCor->FindFixBin(nearestEta));
3931 
3932  else if ((var == egEnergyCorr::Scale::PSEXTRARUN3Up or
3935  const double aeta = std::abs(cl_eta);
3936  if (aeta<=1.8) {
3937  float sign = (var == egEnergyCorr::Scale::PSEXTRARUN3Up) ? 1. : -1.;
3938  value = 1.E-2 * sign;
3939  }
3940  }
3941  }
3942 
3943  else if (iLayer == 1) { // use cl_eta
3944 
3946  value = m_aS12Nom->GetBinError(m_aS12Nom->FindFixBin(cl_eta));
3947  } else if (var == egEnergyCorr::Scale::S12Down && m_aS12Nom) {
3948  value = -m_aS12Nom->GetBinError(m_aS12Nom->FindFixBin(cl_eta));
3949  } else if (var == egEnergyCorr::Scale::LArCalibUp && m_daS12Cor) {
3950  value = m_daS12Cor->GetBinContent(m_daS12Cor->FindFixBin(cl_eta));
3952  value = -m_daS12Cor->GetBinContent(m_daS12Cor->FindFixBin(cl_eta));
3965  // special case for es2015PRE and also for es2015c_summer and also for
3966  // es2017 numbers from Lydia and Christophe,
3967  // https://indico.cern.ch/event/395345/contribution/2/material/slides/0.pdf
3968  // assuming constant uncertainty
3969  // es2017_summer: increased to 5% in the endcap
3970  const double aeta = std::abs(cl_eta);
3971  // endcap
3972  if (aeta >= 1.37 and aeta < 2.5) {
3977  value = 5.0E-2;
3978  else
3979  value = 1.5E-2;
3980  } else { // barrel
3982  value = 2.5E-2;
3983  else
3984  value = 1.5E-2;
3985  }
3998  const double aeta = std::abs(cl_eta);
3999  // endcap
4000  if (aeta >= 1.37 and aeta < 2.5) {
4005  value = -5.0E-2;
4006  else
4007  value = -1.5E-2;
4008  } else { // barrel
4011  value = -2.5E-2;
4012  else
4013  value = -1.5E-2;
4014  }
4015  }
4016 
4019  // special large sys for run2 in the last eta-bin in es2017, see
4020  // ATLASEG-42
4026  const double aeta = std::abs(cl_eta);
4027  if (aeta >= 2.4 and aeta < 2.5) {
4029  value = 25E-2;
4030  else
4031  value = -25E-2;
4032  }
4033  }
4034  }
4038  float sign = (var == egEnergyCorr::Scale::S12EXTRARUN3Up) ? 1. : -1.;
4039  const double aeta = std::abs(cl_eta);
4040  if (aeta <= 0.8) {
4041  value = 0.01 * sign;
4042  }
4043  else if (aeta <= 1.5) {
4044  value = 0.02 * sign;
4045  }
4046  else if (aeta <= 2.5) {
4047  value = 0.01 * sign;
4048  }
4049  }
4050  }
4051 
4052  return value * varSF;
4053 }
4054 
4056  double cl_eta, double energy, PATCore::ParticleType::Type ptype) const {
4057  double value = 0;
4058  const double aeta = std::abs(cl_eta);
4059 
4060  // This will point to the return of get() of a unique_ptr
4061  const TAxis* axis;
4062  const TList* graphs;
4063 
4064  if (ptype == PATCore::ParticleType::Electron) {
4065  axis = m_E4ElectronEtaBins.get();
4066  graphs = m_E4ElectronGraphs.get();
4067  } else if (ptype == PATCore::ParticleType::UnconvertedPhoton) {
4068  axis = m_E4UnconvertedEtaBins.get();
4069  graphs = m_E4UnconvertedGraphs.get();
4070  } else if (ptype == PATCore::ParticleType::ConvertedPhoton) {
4071  axis = m_E4ConvertedEtaBins.get();
4072  graphs = m_E4ConvertedGraphs.get();
4073  } else {
4074  ATH_MSG_FATAL("invalid particle type");
4075  return -1;
4076  }
4077  // type is TGraph if not es2024_Run3_v0, else TF1
4078  const int ieta = axis->FindFixBin(aeta) - 1;
4079  if (ieta >= 0 and ieta < graphs->GetSize()) {
4081  const double ETMeV = energy / cosh(cl_eta);
4082  value = static_cast<TF1*>(graphs->At(ieta))->Eval(ETMeV);
4083  } else {
4084  const double ETGeV = energy / cosh(cl_eta) / 1E3;
4085  value = static_cast<TGraph*>(graphs->At(ieta))->Eval(ETGeV);
4086  }
4087  }
4088 
4089  return value;
4090 }
4091 
4093  int iLayer, double cl_eta, double energy,
4094  PATCore::ParticleType::Type ptype) const {
4095 
4096  double value = 0;
4097  // Accordion histogram specicif condition
4098  if (iLayer == 6 && std::abs(cl_eta) >= 2.47)
4099  cl_eta = 2.46;
4100  double aeta = std::abs(cl_eta);
4101  double ET = energy / cosh(cl_eta);
4102 
4103  // move out of crack
4107  aeta = nearestEtaBEC(aeta);
4108 
4109  // argument ET is transverse energy in MeV
4110 
4111  if (iLayer == 0 && aeta >= 1.82)
4112  return value;
4113 
4114  if (ptype == PATCore::ParticleType::Electron) {
4115 
4116  if (iLayer == 0) {
4117 
4118  const int ieta = m_psElectronEtaBins->FindFixBin(aeta) - 1;
4119  if (ieta >= 0 and ieta < m_psElectronGraphs->GetSize()) {
4120  value = ((TF1*)m_psElectronGraphs->At(ieta))->Eval(ET);
4121  }
4122  } else if (iLayer == 1) {
4123 
4124  const int ieta = m_s12ElectronEtaBins->FindFixBin(aeta) - 1;
4125  if (ieta >= 0 and ieta < m_s12ElectronGraphs->GetSize()) {
4126  value = ((TF1*)m_s12ElectronGraphs->At(ieta))->Eval(ET);
4127  }
4128  } else if (iLayer == 6) { // Accordion correction (for Precision Run-2)
4129 
4130  const int ieta = m_EaccElectronEtaBins->FindFixBin(aeta) - 1;
4131  if (ieta >= 0 && ieta < m_EaccElectronGraphs->GetSize()) {
4132  value = ((TF1*)m_EaccElectronGraphs->At(ieta))->Eval(ET);
4133  }
4134  }
4135 
4136  } else if (ptype == PATCore::ParticleType::UnconvertedPhoton) {
4137 
4138  if (iLayer == 0) {
4139 
4140  const int ieta = m_psUnconvertedEtaBins->FindFixBin(aeta) - 1;
4141  if (ieta >= 0 and ieta < m_psUnconvertedGraphs->GetSize()) {
4142  value = ((TF1*)m_psUnconvertedGraphs->At(ieta))->Eval(ET);
4143  }
4144 
4145  } else if (iLayer == 1) {
4146 
4147  const int ieta = m_s12UnconvertedEtaBins->FindFixBin(aeta) - 1;
4148  if (ieta >= 0 and ieta < m_s12UnconvertedGraphs->GetSize()) {
4149  value = ((TF1*)m_s12UnconvertedGraphs->At(ieta))->Eval(ET);
4150  }
4151  } else if (iLayer == 6) { // Accordion correction (for Precision Run-2)
4152 
4153  const int ieta = m_EaccUnconvertedEtaBins->FindFixBin(aeta) - 1;
4154  if (ieta >= 0 && ieta < m_EaccUnconvertedGraphs->GetSize()) {
4155  value = ((TF1*)m_EaccUnconvertedGraphs->At(ieta))->Eval(ET);
4156  }
4157  }
4158 
4159  } else if (ptype == PATCore::ParticleType::ConvertedPhoton) {
4160 
4161  if (iLayer == 0) {
4162 
4163  const int ieta = m_psConvertedEtaBins->FindFixBin(aeta) - 1;
4164  if (ieta >= 0 and ieta < m_psConvertedGraphs->GetSize()) {
4165  value = ((TF1*)m_psConvertedGraphs->At(ieta))->Eval(ET);
4166  }
4167 
4168  } else if (iLayer == 1) {
4169 
4170  const int ieta = m_s12ConvertedEtaBins->FindFixBin(aeta) - 1;
4171  if (ieta >= 0 and ieta < m_s12ConvertedGraphs->GetSize()) {
4172  value = ((TF1*)m_s12ConvertedGraphs->At(ieta))->Eval(ET);
4173  }
4174  } else if (iLayer == 6) { // Accordion correction (for Precision Run-2)
4175 
4176  const int ieta = m_EaccConvertedEtaBins->FindFixBin(aeta) - 1;
4177  if (ieta >= 0 && ieta < m_EaccConvertedGraphs->GetSize()) {
4178  if (ET < 10000. && (aeta < 1.2 || (aeta >= 1.59 && aeta < 1.73))) {
4179  // harcoded condition to correct bad beahviour of function at low ET
4180  // <10GeV
4181  value = ((TF1*)m_EaccConvertedGraphs->At(ieta))->Eval(10000.);
4182  } else {
4183  value = ((TF1*)m_EaccConvertedGraphs->At(ieta))->Eval(ET);
4184  }
4185  }
4186  }
4187  }
4188 
4189  ATH_MSG_DEBUG("Layer non-linearity: " << iLayer << " value: " << value);
4190 
4191  if (value < 0) {
4192  ATH_MSG_DEBUG("Value is negative -> set to 0");
4193  value = 0;
4194  }
4195 
4196  return value;
4197 }
4198 
4199 // passive material correction
4201 
4202 // ... material look-up function, called internally by getAlphaMaterial() and
4203 // getMaterialNonLinearity()
4204 
4206  double cl_eta, egEnergyCorr::MaterialCategory imat,
4208 
4209  double value = 0.;
4210  double aeta = std::abs(cl_eta);
4211 
4212  // "ID" : inner detector material; bottom-up (from construction/simulation
4213  // accuracy : ConfigA)
4214 
4215  if (imat == egEnergyCorr::MatID && m_dX_ID_Nom) {
4216 
4217  // ... NOTE : watch out here : this histo does not follow the usual
4218  // value/error look-up convention
4219 
4221  value += m_dX_ID_Nom->GetBinContent(m_dX_ID_Nom->FindFixBin(aeta));
4222  else if (var == egEnergyCorr::Scale::MatIDDown)
4223  value -= m_dX_ID_Nom->GetBinContent(m_dX_ID_Nom->FindFixBin(aeta));
4224 
4225  // "Cryo" : integral from IP to PS or Acc, depending on eta
4226 
4227  } else if (imat == egEnergyCorr::MatCryo && aeta < 1.82 &&
4228  m_dX_IPPS_Nom) { // Integral between IP and PS
4229 
4230  value = m_dX_IPPS_Nom->GetBinContent(m_dX_IPPS_Nom->FindFixBin(aeta));
4231 
4233  value += m_dX_IPPS_Nom->GetBinError(m_dX_IPPS_Nom->FindFixBin(aeta));
4235  value -= m_dX_IPPS_Nom->GetBinError(m_dX_IPPS_Nom->FindFixBin(aeta));
4236 
4237  // ... careful : sign below should be opposite to the effect of this source
4238  // on the PS scale!
4240  value -= m_dX_IPPS_LAr->GetBinContent(m_dX_IPPS_LAr->FindFixBin(aeta));
4242  value += m_dX_IPPS_LAr->GetBinContent(m_dX_IPPS_LAr->FindFixBin(aeta));
4243 
4244  } else if (imat == egEnergyCorr::MatCryo && aeta > 1.82 &&
4245  m_dX_IPAcc_Nom) { // Integral between IP and Accordion
4246 
4247  value = m_dX_IPAcc_Nom->GetBinContent(m_dX_IPAcc_Nom->FindFixBin(aeta));
4248 
4250  value += m_dX_IPAcc_Nom->GetBinError(m_dX_IPAcc_Nom->FindFixBin(aeta));
4252  value -= m_dX_IPAcc_Nom->GetBinError(m_dX_IPAcc_Nom->FindFixBin(aeta));
4253 
4255  value += m_dX_IPAcc_LAr->GetBinContent(m_dX_IPAcc_LAr->FindFixBin(aeta));
4257  value -= m_dX_IPAcc_LAr->GetBinContent(m_dX_IPAcc_LAr->FindFixBin(aeta));
4258 
4260  value += m_dX_IPAcc_G4->GetBinContent(m_dX_IPAcc_G4->FindFixBin(aeta));
4262  value -= m_dX_IPAcc_G4->GetBinContent(m_dX_IPAcc_G4->FindFixBin(aeta));
4263 
4265  value += m_dX_IPAcc_GL1->GetBinContent(m_dX_IPAcc_GL1->FindFixBin(aeta));
4267  value -= m_dX_IPAcc_GL1->GetBinContent(m_dX_IPAcc_GL1->FindFixBin(aeta));
4268 
4269  // "Calo" : between PS and Strips
4270 
4271  } else if (imat == egEnergyCorr::MatCalo && aeta < 1.82 && m_dX_PSAcc_Nom) {
4272 
4273  value = m_dX_PSAcc_Nom->GetBinContent(m_dX_PSAcc_Nom->FindFixBin(aeta));
4274 
4276  value += m_dX_PSAcc_Nom->GetBinError(m_dX_PSAcc_Nom->FindFixBin(aeta));
4278  value -= m_dX_PSAcc_Nom->GetBinError(m_dX_PSAcc_Nom->FindFixBin(aeta));
4279 
4281  value += m_dX_PSAcc_LAr->GetBinContent(m_dX_PSAcc_LAr->FindFixBin(aeta));
4283  value -= m_dX_PSAcc_LAr->GetBinContent(m_dX_PSAcc_LAr->FindFixBin(aeta));
4284 
4286  value += m_dX_PSAcc_G4->GetBinContent(m_dX_PSAcc_G4->FindFixBin(aeta));
4288  value -= m_dX_PSAcc_G4->GetBinContent(m_dX_PSAcc_G4->FindFixBin(aeta));
4289  }
4290 
4291  return value;
4292 }
4293 
4294 // returns the impact of material variation on response.
4295 // non-zero for photons only (the average effect is absorbed by the effective Z
4296 // scales for electrons).
4297 
4298 // Strategy for material before the PS :
4299 // - consider ID material and uncertainty fixed to ConfigA
4300 // - attribute measured material to ConfigL, with uncertainty from difference
4301 // between measurement and ConfigA
4302 // I.e : DX_A = 0 +- dA ; DX_L = DX_Meas +- (dMeas ++ dA)
4303 
4304 // Strategy for material after the PS :
4305 // - direct measurement
4306 // I.e : DX_M = DX_Meas +- dMeas
4307 
4308 // Then calculate the impact on the scale accordingly.
4309 
4311  double cl_eta, egEnergyCorr::MaterialCategory imat,
4313  double varSF) const {
4314 
4315  double value = 0.;
4316  if (ptype == PATCore::ParticleType::Electron)
4317  return value;
4319  return value;
4320 
4321  egEnergyCorr::Geometry geoID, geoCryo, geoCalo, geoGp;
4322  geoID = egEnergyCorr::ConfigA;
4323  if (std::abs(cl_eta) < 2.)
4324  geoCryo = egEnergyCorr::ConfigEL;
4325  else
4326  geoCryo = egEnergyCorr::ConfigFMX;
4327  geoCalo = egEnergyCorr::ConfigFMX;
4328  geoGp = egEnergyCorr::ConfigGp;
4329 
4330  // look up material bias
4331 
4332  double DeltaX = getDeltaX(cl_eta, imat, var) -
4333  getDeltaX(cl_eta, imat, egEnergyCorr::Scale::Nominal);
4334 
4335  // calculate scale change per unit added material
4336 
4337  double DAlphaDXID, DAlphaDXCryo, DAlphaDXCalo, DAlphaDXGp;
4338  DAlphaDXID = DAlphaDXCryo = DAlphaDXCalo = DAlphaDXGp = 0;
4340  DAlphaDXGp = m_matUnconvertedScale[geoGp]->GetBinContent(
4341  m_matUnconvertedScale[geoGp]->FindBin(cl_eta));
4342  DAlphaDXID = m_matUnconvertedScale[geoID]->GetBinContent(
4343  m_matUnconvertedScale[geoID]->FindBin(cl_eta));
4344  DAlphaDXCryo = m_matUnconvertedScale[geoCryo]->GetBinContent(
4345  m_matUnconvertedScale[geoCryo]->FindBin(cl_eta));
4346  DAlphaDXCalo = m_matUnconvertedScale[geoCalo]->GetBinContent(
4347  m_matUnconvertedScale[geoCalo]->FindBin(cl_eta));
4348  } else if (ptype == PATCore::ParticleType::ConvertedPhoton) {
4349  DAlphaDXGp = m_matConvertedScale[geoGp]->GetBinContent(
4350  m_matConvertedScale[geoGp]->FindBin(cl_eta));
4351  DAlphaDXID = m_matConvertedScale[geoID]->GetBinContent(
4352  m_matConvertedScale[geoID]->FindBin(cl_eta));
4353  DAlphaDXCryo = m_matConvertedScale[geoCryo]->GetBinContent(
4354  m_matConvertedScale[geoCryo]->FindBin(cl_eta));
4355  DAlphaDXCalo = m_matConvertedScale[geoCalo]->GetBinContent(
4356  m_matConvertedScale[geoCalo]->FindBin(cl_eta));
4357  }
4358 
4359  // when in crack, use G', exit
4360 
4361  if (isInCrack(cl_eta)) {
4363  value = DAlphaDXGp;
4364  else if (imat == egEnergyCorr::MatID &&
4366  value = -DAlphaDXGp;
4367  return value;
4368  }
4369 
4370  // normal case
4371 
4372  int idx = m_matX0Additions[geoID]->FindBin(std::abs(cl_eta));
4373  if (idx < 1 || idx > m_matX0Additions[geoID]->GetNbinsX())
4374  DAlphaDXID = 0;
4375  else
4376  DAlphaDXID /= m_matX0Additions[geoID]->GetBinContent(idx);
4377 
4378  idx = m_matX0Additions[geoCryo]->FindBin(std::abs(cl_eta));
4379  if (idx < 1 || idx > m_matX0Additions[geoCryo]->GetNbinsX())
4380  DAlphaDXCryo = 0;
4381  else
4382  DAlphaDXCryo /= m_matX0Additions[geoCryo]->GetBinContent(idx);
4383 
4384  idx = m_matX0Additions[geoCalo]->FindBin(std::abs(cl_eta));
4385  if (idx < 1 || idx > m_matX0Additions[geoCalo]->GetNbinsX())
4386  DAlphaDXCalo = 0;
4387  else
4388  DAlphaDXCalo /= m_matX0Additions[geoCalo]->GetBinContent(idx);
4389 
4390  // final value
4391 
4392  if (imat == egEnergyCorr::MatID)
4393  value = DeltaX * (DAlphaDXID - DAlphaDXCryo);
4394  else if (imat == egEnergyCorr::MatCryo)
4395  value = DeltaX * DAlphaDXCryo;
4396  else if (imat == egEnergyCorr::MatCalo)
4397  value = DeltaX * DAlphaDXCalo;
4398 
4399  return value * varSF;
4400 }
4401 
4404  double cl_eta, double ET) const {
4405 
4406  // Again this does no need to be ptr just get the one owned
4407  TH2D* hmat;
4408 
4409  if (ptype == PATCore::ParticleType::Electron) {
4410  if (geo == egEnergyCorr::ConfigA)
4411  hmat = ((TH2D*)m_electronBias_ConfigA.get());
4412  else if (geo == egEnergyCorr::ConfigEL)
4413  hmat = ((TH2D*)m_electronBias_ConfigEpLp.get());
4414  else if (geo == egEnergyCorr::ConfigFMX)
4415  hmat = ((TH2D*)m_electronBias_ConfigFpMX.get());
4416  else if (geo == egEnergyCorr::ConfigN)
4417  hmat = ((TH2D*)m_electronBias_ConfigN.get());
4418  else if (geo == egEnergyCorr::ConfigIBL)
4419  hmat = ((TH2D*)m_electronBias_ConfigIBL.get());
4420  else if (geo == egEnergyCorr::ConfigPP0)
4421  hmat = ((TH2D*)m_electronBias_ConfigPP0.get());
4422  else
4423  return 0;
4424  } else if (ptype == PATCore::ParticleType::UnconvertedPhoton) {
4425  if (geo == egEnergyCorr::ConfigA)
4426  hmat = ((TH2D*)m_unconvertedBias_ConfigA.get());
4427  else if (geo == egEnergyCorr::ConfigEL)
4428  hmat = ((TH2D*)m_unconvertedBias_ConfigEpLp.get());
4429  else if (geo == egEnergyCorr::ConfigFMX)
4430  hmat = ((TH2D*)m_unconvertedBias_ConfigFpMX.get());
4431  else if (geo == egEnergyCorr::ConfigN)
4432  hmat = ((TH2D*)m_unconvertedBias_ConfigN.get());
4433  else if (geo == egEnergyCorr::ConfigIBL)
4434  hmat = ((TH2D*)m_unconvertedBias_ConfigIBL.get());
4435  else if (geo == egEnergyCorr::ConfigPP0)
4436  hmat = ((TH2D*)m_unconvertedBias_ConfigIBL.get());
4437  else
4438  return 0;
4439  } else if (ptype == PATCore::ParticleType::ConvertedPhoton) {
4440  if (geo == egEnergyCorr::ConfigA)
4441  hmat = ((TH2D*)m_convertedBias_ConfigA.get());
4442  else if (geo == egEnergyCorr::ConfigEL)
4443  hmat = ((TH2D*)m_convertedBias_ConfigEpLp.get());
4444  else if (geo == egEnergyCorr::ConfigFMX)
4445  hmat = ((TH2D*)m_convertedBias_ConfigFpMX.get());
4446  else if (geo == egEnergyCorr::ConfigN)
4447  hmat = ((TH2D*)m_convertedBias_ConfigN.get());
4448  else if (geo == egEnergyCorr::ConfigIBL)
4449  hmat = ((TH2D*)m_convertedBias_ConfigIBL.get());
4450  else if (geo == egEnergyCorr::ConfigPP0)
4451  hmat = ((TH2D*)m_convertedBias_ConfigPP0.get());
4452  else
4453  return 0;
4454  } else
4455  return 0;
4456 
4457  // use one bin in eta and linear interpolation in Et between 2 bins
4458 
4459  double aeta = std::abs(cl_eta);
4460  int ieta = hmat->GetXaxis()->FindBin(aeta);
4461 
4462  int ipt = hmat->GetYaxis()->FindBin(ET);
4463  double ptBin = hmat->GetYaxis()->GetBinCenter(ipt);
4464 
4465  int i1, i2;
4466  double pt1, pt2;
4467  if (ET > ptBin) {
4468  i1 = ipt;
4469  i2 = ipt + 1;
4470  pt1 = ptBin;
4471  pt2 = hmat->GetYaxis()->GetBinCenter(i2);
4472  } else {
4473  i1 = ipt - 1;
4474  i2 = ipt;
4475  pt1 = hmat->GetYaxis()->GetBinCenter(i1);
4476  pt2 = ptBin;
4477  }
4478 
4479  int nbins = hmat->GetYaxis()->GetNbins();
4480  double value = 0;
4481  if (i1 >= 1 && i1 < nbins) {
4482  double v1 = hmat->GetBinContent(ieta, i1);
4483  double v2 = hmat->GetBinContent(ieta, i2);
4484  value = (v1 * (pt2 - ET) + v2 * (ET - pt1)) / (pt2 - pt1);
4485  } else {
4486  if (ipt < 1)
4487  ipt = 1;
4488  if (ipt > nbins)
4489  ipt = nbins;
4490  value = hmat->GetBinContent(ieta, ipt);
4491  }
4492  return value;
4493 }
4494 
4495 // returns the energy dependence of the above (non-zero for electrons only).
4496 
4498  double cl_eta, double energy, egEnergyCorr::MaterialCategory imat,
4500  double varSF) const {
4501 
4502  double value = 0;
4503  double ET = energy / cosh(cl_eta) / GeV;
4504 
4505  if ((ptype != PATCore::ParticleType::Electron &&
4516  return value;
4517 
4518  egEnergyCorr::Geometry geoID, geoCryo, geoCalo, geoGp;
4519  geoID = egEnergyCorr::ConfigA;
4520  if (std::abs(cl_eta) < 2.)
4521  geoCryo = egEnergyCorr::ConfigEL;
4522  else
4523  geoCryo = egEnergyCorr::ConfigFMX;
4524 
4525  // G.Unal 21.08.2018
4526  // for Calo material use correctly ConfigN material for endcap (PS to Calo) in
4527  // release 21 (not done for run 1, which used FMX in this case)
4528  if (std::abs(cl_eta) > 1.52 &&
4538  geoCalo = egEnergyCorr::ConfigN;
4539  else
4540  geoCalo = egEnergyCorr::ConfigFMX;
4541  geoGp = egEnergyCorr::ConfigGp;
4542 
4543  // look up material bias
4544 
4545  double DeltaX = getDeltaX(cl_eta, imat, var) -
4546  getDeltaX(cl_eta, imat, egEnergyCorr::Scale::Nominal);
4547 
4548  // calculate scale change per unit added material
4549 
4550  // G.Unal 21.08.2019 new code called for release 21 sensivitities
4551 
4552  double DAlphaDXGp, DAlphaDXID, DAlphaDXCryo, DAlphaDXCalo;
4553 
4563  DAlphaDXGp =
4565  ET); // no G' in release 21, use FMX for the crack
4566  DAlphaDXID = getMaterialEffect(geoID, ptype, cl_eta, ET);
4567  DAlphaDXCryo = getMaterialEffect(geoCryo, ptype, cl_eta, ET);
4568  DAlphaDXCalo = getMaterialEffect(geoCalo, ptype, cl_eta, ET);
4569 
4570  } else {
4571  int ialpha = m_matElectronEtaBins->FindFixBin(std::abs(cl_eta)) - 1;
4572  if (ialpha < 0 || ialpha >= m_matElectronGraphs[geoGp]->GetSize())
4573  return 0.;
4574 
4575  DAlphaDXGp = ((TGraphErrors*)m_matElectronGraphs[geoGp]->At(ialpha))
4576  ->GetFunction("fNonLin")
4577  ->Eval(ET);
4578  DAlphaDXID = ((TGraphErrors*)m_matElectronGraphs[geoID]->At(ialpha))
4579  ->GetFunction("fNonLin")
4580  ->Eval(ET);
4581  DAlphaDXCryo = ((TGraphErrors*)m_matElectronGraphs[geoCryo]->At(ialpha))
4582  ->GetFunction("fNonLin")
4583  ->Eval(ET);
4584  DAlphaDXCalo = ((TGraphErrors*)m_matElectronGraphs[geoCalo]->At(ialpha))
4585  ->GetFunction("fNonLin")
4586  ->Eval(ET);
4587  }
4588 
4589  // when in crack, use G', exit
4590 
4591  if (isInCrack(cl_eta)) {
4593  value = DAlphaDXGp;
4594  else if (imat == egEnergyCorr::MatID &&
4596  value = -DAlphaDXGp;
4597  return value;
4598  }
4599 
4600  int idx = m_matX0Additions[geoID]->FindBin(std::abs(cl_eta));
4601  if (idx < 1 || idx > m_matX0Additions[geoID]->GetNbinsX())
4602  DAlphaDXID = 0;
4603  else {
4604  if (m_matX0Additions[geoID]->GetBinContent(idx) > 0.)
4605  DAlphaDXID /= m_matX0Additions[geoID]->GetBinContent(idx);
4606  else
4607  DAlphaDXID = 0.;
4608  }
4609 
4610  idx = m_matX0Additions[geoCryo]->FindBin(std::abs(cl_eta));
4611  if (idx < 1 || idx > m_matX0Additions[geoCryo]->GetNbinsX())
4612  DAlphaDXCryo = 0;
4613  else {
4614  if (m_matX0Additions[geoCryo]->GetBinContent(idx) > 0.)
4615  DAlphaDXCryo /= m_matX0Additions[geoCryo]->GetBinContent(idx);
4616  else
4617  DAlphaDXCryo = 0.;
4618  }
4619 
4620  idx = m_matX0Additions[geoCalo]->FindBin(std::abs(cl_eta));
4621  if (idx < 1 || idx > m_matX0Additions[geoCalo]->GetNbinsX())
4622  DAlphaDXCalo = 0;
4623  else {
4624  if (m_matX0Additions[geoCalo]->GetBinContent(idx) > 0.)
4625  DAlphaDXCalo /= m_matX0Additions[geoCalo]->GetBinContent(idx);
4626  else
4627  DAlphaDXCalo = 0.;
4628  }
4629 
4630  // final value
4631 
4632  if (imat == egEnergyCorr::MatID)
4633  value = DeltaX * (DAlphaDXID - DAlphaDXCryo);
4634  else if (imat == egEnergyCorr::MatCryo)
4635  value = DeltaX * DAlphaDXCryo;
4636  else if (imat == egEnergyCorr::MatCalo)
4637  value = DeltaX * DAlphaDXCalo;
4638 
4639  return value * varSF;
4640 }
4641 
4643  double cl_eta, PATCore::ParticleType::Type ptype,
4644  egEnergyCorr::Scale::Variation var, double varSF) const {
4645 
4646  double alpha = 0.;
4647  double aeta = std::abs(cl_eta);
4648 
4651  return alpha;
4652 
4654 
4656  alpha = m_leakageUnconverted->GetBinContent(
4657  m_leakageUnconverted->FindFixBin(aeta));
4659  alpha = -m_leakageUnconverted->GetBinContent(
4660  m_leakageUnconverted->FindFixBin(aeta));
4661  }
4662 
4663  } else if (ptype == PATCore::ParticleType::ConvertedPhoton) {
4664 
4666  alpha = m_leakageConverted->GetBinContent(
4667  m_leakageConverted->FindFixBin(aeta));
4668  } else if (var == egEnergyCorr::Scale::LeakageConvDown) {
4669  alpha = -m_leakageConverted->GetBinContent(
4670  m_leakageConverted->FindFixBin(aeta));
4671  }
4672  }
4673 
4674  return alpha * varSF;
4675 }
4676 
4678  double cl_eta, double et, PATCore::ParticleType::Type ptype,
4679  egEnergyCorr::Scale::Variation var, double varSF) const {
4680 
4681  // To be on the safe side
4685  return getAlphaLeakage(cl_eta, ptype, var, varSF);
4686  }
4687 
4688  // No correction for electron
4689  if (ptype == PATCore::ParticleType::Electron &&
4692  return 0.;
4693 
4694  // Outside acceptance. Should never happen
4695  double aeta = std::abs(cl_eta);
4696  if (aeta > 2.47) {
4697  ATH_MSG_WARNING("Very high |eta| object, eta = " << cl_eta);
4698  return 0.;
4699  }
4700 
4701  // If no correction applied, can only be the egEnergyCorr::Scale::LeakageXXX
4702  // syst
4709  return 0.;
4710 
4711  double etGeV = et / GeV;
4712  double alpha = 0, dalpha = 0;
4715  dalpha = getAlphaUncAlpha(*m_leakageElectron, aeta, etGeV,
4717  .first;
4719  dalpha *= -1;
4720  if (ptype == PATCore::ParticleType::Electron)
4721  return dalpha;
4722  }
4723 
4724  bool isConv = ptype == PATCore::ParticleType::ConvertedPhoton;
4725  TH1* hh = isConv ? m_leakageConverted.get() : m_leakageUnconverted.get();
4726  std::pair<double, double> p =
4728 
4729  if (m_useLeakageCorrection) {
4730  alpha = p.first;
4731  }
4732  if ((isConv && (var == egEnergyCorr::Scale::LeakageConvDown ||
4734  (!isConv && (var == egEnergyCorr::Scale::LeakageUnconvDown ||
4736  // If we correct, use uncertainty. Else use full size of the effect
4737  // for es2023_R22_Run2_v0, use full size of correction as uncertainty
4738  if (m_useLeakageCorrection &&
4742  dalpha = p.second;
4743  else
4744  dalpha = alpha;
4745 
4748  dalpha *= -1;
4749  }
4750  alpha += dalpha;
4751 
4753  "In leakage2D alpha = " << alpha << " from var = " << variationName(var));
4754 
4755  return alpha * varSF;
4756 }
4757 
4759  const TH1& hh, double aeta, double et, bool useInterp) const {
4760 
4761  // stay within the histogram limits in pT
4762  // no warning to say the pT is not in the "validity" range...
4763  int ibeta = hh.GetXaxis()->FindBin(aeta);
4764  int nbpT = hh.GetYaxis()->GetNbins();
4765  int ibpT = hh.GetYaxis()->FindBin(et);
4766  bool isOUFlow = false;
4767  if (ibpT > nbpT) {
4768  ibpT = nbpT;
4769  isOUFlow = true;
4770  } else if (ibpT == 0) {
4771  ibpT = 1;
4772  isOUFlow = true;
4773  }
4774  double alpha = 0.;
4775  double pTp = hh.GetYaxis()->GetBinCenter(ibpT), pTn = pTp;
4776  if (!useInterp || isOUFlow || (ibpT == nbpT && et > pTp) ||
4777  (ibpT == 1 && et < pTp))
4778  alpha = hh.GetBinContent(ibeta, ibpT);
4779  else {
4780  int jp = ibpT, jn = ibpT - 1;
4781  if (et > pTp) {
4782  jp = ibpT + 1;
4783  jn = ibpT;
4784  pTn = pTp;
4785  pTp = hh.GetYaxis()->GetBinCenter(jp);
4786  } else {
4787  pTn = hh.GetYaxis()->GetBinCenter(jn);
4788  }
4789  double aPos = hh.GetBinContent(ibeta, jp);
4790  double aNeg = hh.GetBinContent(ibeta, jn);
4791  alpha = (aPos * (et - pTn) + aNeg * (pTp - et)) / (pTp - pTn);
4792  ATH_MSG_VERBOSE("interp et = " << et << " alpha+ = " << aPos << " alpha- = "
4793  << aNeg << " alpha = " << alpha);
4794  }
4795  double dalpha = hh.GetBinError(ibeta, ibpT);
4796 
4797  return std::make_pair(alpha, dalpha);
4798 }
4799 
4801  double cl_eta, double energy, PATCore::ParticleType::Type ptype,
4802  egEnergyCorr::Scale::Variation var, double varSF) const {
4803 
4804  double alpha = 0.;
4805  double aeta = std::abs(cl_eta);
4806  if (aeta > 2.37)
4807  aeta = 2.36;
4808  double ET = energy / std::cosh(cl_eta);
4809 
4812  return alpha;
4813 
4815 
4820  alpha = m_convRecoEfficiency->GetBinContent(
4821  m_convRecoEfficiency->FindFixBin(aeta));
4826  alpha = -m_convRecoEfficiency->GetBinContent(
4827  m_convRecoEfficiency->FindFixBin(aeta));
4828  else if (var == egEnergyCorr::Scale::ConvRecoUp &&
4833  else if (var == egEnergyCorr::Scale::ConvRecoDown &&
4837  alpha =
4839 
4840  } else if (ptype == PATCore::ParticleType::ConvertedPhoton) {
4841 
4846  alpha = m_convFakeRate->GetBinContent(m_convFakeRate->FindFixBin(aeta));
4851  alpha = -m_convFakeRate->GetBinContent(m_convFakeRate->FindFixBin(aeta));
4852  else if (var == egEnergyCorr::Scale::ConvRecoUp &&
4857  else if (var == egEnergyCorr::Scale::ConvRecoDown &&
4861  alpha = -1. * getInterpolateConvSyst2D(*m_convFakeRate_2D, aeta, ET);
4863  alpha =
4864  m_convRadius->GetBinContent(m_convRadius->FindFixBin(aeta, ET / GeV));
4866  alpha = -m_convRadius->GetBinContent(
4867  m_convRadius->FindFixBin(aeta, ET / GeV));
4868  }
4869 
4870  return alpha * varSF;
4871 }
4872 
4874  const TH2& conv_hist, double aeta, double ET) {
4875 
4876  // use one bin in eta and linear interpolation in Et between 2 bins
4877  int ieta = conv_hist.GetXaxis()->FindBin(aeta);
4878 
4879  int ipt = conv_hist.GetYaxis()->FindBin(ET);
4880  double ptBin = conv_hist.GetYaxis()->GetBinCenter(ipt);
4881 
4882  int i1, i2;
4883  double pt1, pt2;
4884  if (ET > ptBin) {
4885  i1 = ipt;
4886  i2 = ipt + 1;
4887  pt1 = ptBin;
4888  pt2 = conv_hist.GetYaxis()->GetBinCenter(i2);
4889  } else {
4890  i1 = ipt - 1;
4891  i2 = ipt;
4892  pt1 = conv_hist.GetYaxis()->GetBinCenter(i1);
4893  pt2 = ptBin;
4894  }
4895 
4896  int nbins = conv_hist.GetYaxis()->GetNbins();
4897  double value = 0;
4898  if (i1 >= 1 && i1 < nbins) {
4899  double v1 = conv_hist.GetBinContent(ieta, i1);
4900  double v2 = conv_hist.GetBinContent(ieta, i2);
4901  value = (v1 * (pt2 - ET) + v2 * (ET - pt1)) / (pt2 - pt1);
4902  } else {
4903  if (ipt < 1)
4904  ipt = 1;
4905  if (ipt > nbins)
4906  ipt = nbins;
4907  value = conv_hist.GetBinContent(ieta, ipt);
4908  }
4909 
4910  return value;
4911 }
4912 
4914  double cl_eta, double energy, double eraw,
4915  PATCore::ParticleType::Type ptype, bool isRef,
4916  egEnergyCorr::Scale::Variation var, double varSF) const {
4917  double alpha = 0.;
4921  const double delta =
4922  getValueHistoAt(*m_pedestals_es2017, std::abs(cl_eta));
4923  alpha = delta / (energy / cosh(cl_eta));
4925  alpha *= -1;
4926  } else if (m_esmodel == egEnergyCorr::es2017_summer or
4941  // Et uncertainty band: 10 MeV for the corrected cluster
4942  alpha = 10. / (energy / cosh(cl_eta));
4944  alpha *= -1;
4945  } else {
4946  // observed pedestal corrected as a systematic on MC for now.
4947  // TODO : correct for it in the data
4948 
4949  double pedestal = getLayerPedestal(cl_eta, ptype, 0, var, varSF) +
4950  getLayerPedestal(cl_eta, ptype, 1, var, varSF) +
4951  getLayerPedestal(cl_eta, ptype, 2, var, varSF) +
4952  getLayerPedestal(cl_eta, ptype, 3, var, varSF);
4953 
4954  if (isRef)
4955  alpha = pedestal / energy *
4956  1.06; // approximate average ratio between calibrated and raw
4957  else
4958  alpha = pedestal / eraw;
4959  }
4960  }
4961 
4962  return alpha * varSF;
4963 }
4964 
4966  double cl_eta, PATCore::ParticleType::Type ptype, int iLayer,
4967  egEnergyCorr::Scale::Variation var, double varSF) const {
4968 
4969  double pedestal = 0.;
4970  double aeta = std::abs(cl_eta);
4971 
4974 
4975  if (iLayer == 0)
4976  pedestal = m_pedestalL0->GetBinContent(m_pedestalL0->FindFixBin(aeta));
4977  else if (iLayer == 1)
4978  pedestal = m_pedestalL1->GetBinContent(m_pedestalL1->FindFixBin(aeta));
4979  else if (iLayer == 2)
4980  pedestal = m_pedestalL2->GetBinContent(m_pedestalL2->FindFixBin(aeta));
4981  else if (iLayer == 3)
4982  pedestal = m_pedestalL3->GetBinContent(m_pedestalL3->FindFixBin(aeta));
4983 
4984  if (ptype == PATCore::ParticleType::UnconvertedPhoton && aeta < 1.4) {
4985  if (iLayer <= 1)
4986  pedestal /= 1.5;
4987  else if (iLayer == 2)
4988  pedestal *= 15. / 21.;
4989  }
4990 
4992  pedestal *= -1.;
4993  }
4994 
4995  return pedestal * varSF;
4996 }
4997 
4999 
5000  return std::abs(cl_eta) >= 1.35 && std::abs(cl_eta) <= 1.55;
5001 }
5002 
5004 
5005  double newEta = cl_eta;
5006 
5007  if (!isInCrack(newEta))
5008  return newEta;
5009 
5010  if (newEta >= 1.35 && newEta <= 1.45)
5011  newEta = 1.349;
5012  if (newEta >= 1.45 && newEta <= 1.55)
5013  newEta = 1.551;
5014 
5015  if (newEta >= -1.55 && newEta <= -1.45)
5016  newEta = -1.551;
5017  if (newEta >= -1.45 && newEta <= -1.35)
5018  newEta = -1.349;
5019 
5020  return newEta;
5021 }
5022 
5024  int particle_type) const {
5025 
5026  double pileupNoise;
5027 
5028  // release 21 for <mu> =32 (combined 2015-2016-2017 dataset), pileup noise =
5029  // f(Et) for superclusters
5040  double avgmu = 32;
5043  avgmu = 34.;
5045  avgmu = 54.;
5046 
5047  double et = energy / cosh(eta);
5048  if (et < 5000.)
5049  et = 5000.;
5050  if (et > 50000.)
5051  et = 50000.;
5052  pileupNoise = sqrt(avgmu) * (60. + 40. * log(et / 10000.) / log(5.));
5053  } else {
5054  // approximate pileup noise addition to the total noise in MeV for
5055  // <mu_data> (2012) = 20 converted photons and electrons
5056  pileupNoise = 240.;
5057  // unconverted photons, different values in barrel and end-cap
5058  if (particle_type == 1) {
5059  if (std::abs(eta) < 1.4)
5060  pileupNoise = 200.;
5061  }
5062  }
5063  return pileupNoise;
5064 }
5065 
5067  int particle_type, double energy, double eta, double etaCalo, int syst_mask,
5068  double& resolution, double& resolution_error, double& resolution_error_up,
5069  double& resolution_error_down, int resol_type, bool fast) const {
5070 
5071  double pileupNoise = pileUpTerm(energy, eta, particle_type);
5072  double et = energy / cosh(eta);
5073 
5074  resolution =
5075  m_resolution_tool->getResolution(particle_type, energy, eta, resol_type);
5076  // std::cout << " resolution from tool " << resolution << std::endl;
5077  double smearingZ = dataConstantTerm(m_use_etaCalo_scales ? etaCalo : eta);
5078  double esmearingZ =
5080  double esmearingOFC = m_esmodel == egEnergyCorr::es2022_R22_PRE
5082  : 0.;
5083  double resolution2 = resolution * resolution + smearingZ * smearingZ +
5084  (pileupNoise * pileupNoise) / (et * et);
5085  resolution = sqrt(resolution2);
5086 
5087  double_t sum_sigma_resolution2 = 0.;
5088  double sum_deltaDown = 0.;
5089  double sum_deltaUp = 0.;
5090 
5091  for (int isys = 0; isys < 11; isys++) {
5092 
5093  if (syst_mask & (1 << isys)) {
5094 
5095  double sigma2 = 0.;
5096  double sigma2up = 0.;
5097  double sigma2down = 0.;
5098 
5099  // systematics on Z smearing measurement
5100  if (isys == 0) {
5101  double d1 = (smearingZ + esmearingZ) * (smearingZ + esmearingZ) -
5102  smearingZ * smearingZ;
5103  double d2 = smearingZ * smearingZ -
5104  (smearingZ - esmearingZ) * (smearingZ - esmearingZ);
5105  double d = 0.5 * (d1 + d2);
5106  sigma2up = d1;
5107  sigma2down = -d2;
5108  sigma2 = d;
5109  ATH_MSG_DEBUG(
5110  std::format("sys resolution Zsmearing: {:.7f} {:.7f} {:.7f}", sigma2, sigma2up, sigma2down));
5111  }
5112 
5113  // systematics on intrinsic resolution
5114  if (isys == 1) {
5115  double resolutionZ = m_resolution_tool->getResolution(
5116  3, 40000. * cosh(eta), eta, resol_type);
5117  double deltaSigma2 = (1.1 * resolutionZ) * (1.1 * resolutionZ) -
5118  resolutionZ * resolutionZ;
5119  double resolution1 =
5120  m_resolution_tool->getResolution(3, energy, eta, resol_type);
5121  sigma2up = (1.1 * resolution1) * (1.1 * resolution1) -
5122  resolution1 * resolution1 - deltaSigma2;
5123  deltaSigma2 = (0.9 * resolutionZ) * (0.9 * resolutionZ) -
5124  resolutionZ * resolutionZ;
5125  sigma2down = (0.9 * resolution1) * (0.9 * resolution1) -
5126  resolution1 * resolution1 - deltaSigma2;
5127  sigma2 = 0.5 * (sigma2up - sigma2down);
5128  ATH_MSG_DEBUG(
5129  std::format("sys resolution intrinsic: {:.7f} {:.7f} {:.7f}", sigma2, sigma2up, sigma2down));
5130  }
5131 
5132  // systematics from configA ID material
5133  else if (isys == 2) {
5134  double sigmaA =
5135  m_getMaterialDelta->getDelta(particle_type, energy, eta, 1, 0);
5136  sigma2 = sigmaA * sigmaA;
5137  sigma2up = sigma2;
5138  sigma2down = -1. * sigma2;
5139  ATH_MSG_DEBUG(
5140  std::format("sys resolution configA ID material: {:.7f} {:.7f} {:.7f}", sigma2, sigma2up, sigma2down));
5141  }
5142 
5143  // systematics from material presampler-layer 1 in barrel (based on half
5144  // config M )
5145  else if (isys == 3) {
5146  if (std::abs(eta) < 1.45) {
5147  double sigmaM =
5148  m_getMaterialDelta->getDelta(particle_type, energy, eta, 1, 3);
5149  sigma2 = 0.5 * sigmaM * sigmaM;
5150  } else
5151  sigma2 = 0.;
5152  sigma2up = sigma2;
5153  sigma2down = -1. * sigma2;
5154  ATH_MSG_DEBUG(
5155  std::format("sys resolution presampler-layer1: {:.7f} {:.7f} {:.7f}", sigma2, sigma2up, sigma2down));
5156  }
5157 
5158  // systematic from material in barrel-endcap gap (using full config X for
5159  // now)
5160  else if (isys == 4) {
5161  if (std::abs(eta) > 1.52 && std::abs(eta) < 1.82) {
5162  double sigmaX =
5163  m_getMaterialDelta->getDelta(particle_type, energy, eta, 1, 3);
5164  sigma2 = sigmaX * sigmaX;
5165  } else
5166  sigma2 = 0.;
5167  sigma2up = sigma2;
5168  sigma2down = -1. * sigma2;
5169  ATH_MSG_DEBUG(
5170  std::format("sys resolution barrel-endcap gap: {:.7f} {:.7f} {:.7f}", sigma2, sigma2up, sigma2down));
5171  }
5172 
5173  // systematics from material in cryostat area (using half config EL,
5174  // FIXME: could use clever eta dependent scaling)
5175  else if (isys == 5) {
5176  double sigmaEL =
5177  m_getMaterialDelta->getDelta(particle_type, energy, eta, 1, 2);
5178  sigma2 = 0.5 * sigmaEL * sigmaEL;
5179  sigma2up = sigma2;
5180  sigma2down = -1. * sigma2;
5181  ATH_MSG_DEBUG(
5182  std::format("sys resolution cryostat area: {:.7f} {:.7f} {:.7f}", sigma2, sigma2up, sigma2down));
5183  }
5184 
5185  // systematics from pileup noise on total noise (200 MeV in quadrature,
5186  // somewhat conservative)
5187  else if (isys == 6) {
5188  double et = energy / cosh(eta);
5189  double sigmaPileUp = 0.;
5190  double sigmaZ = 0.;
5191  // release 21 - 10% uncertainty on pileup noise
5200  double deltaNoise =
5201  sqrt(1.1 * 1.1 - 1.0) *
5202  pileupNoise; // uncertainty in quadrature 1.1*noise - noise
5203  sigmaPileUp = deltaNoise / et; // sigmaE/E impact
5204  sigmaZ = deltaNoise / 40000.; // sigmaE/E for Z->ee electrons
5205  // (absorbed in smearing correction)
5206  }
5207  // no pileup noise uncertainty for es2017_R21_ofc0_v1 and egEnergyCorr::es2024_Run3_ofc0_v0
5209  sigmaPileUp = 0.;
5210  sigmaZ = 0.;
5211  } else {
5212  // older models
5213  double deltaPileupNoise = 100.; // MeV
5214  if (std::abs(eta) >= 1.4 && std::abs(eta) < 1.8)
5215  deltaPileupNoise = 200.; // larger systematic in this eta bin
5216  double scaleNcells = 1;
5217  if (particle_type == 1 && std::abs(eta) < 1.4)
5218  scaleNcells = sqrt(3. / 5.); // cluster=3X5 instead of 3x7, rms
5219  // scales with cluster area
5220  sigmaPileUp = deltaPileupNoise * scaleNcells / et;
5221  sigmaZ =
5222  deltaPileupNoise / (40000.); // effect for Z->ee at Et=40 GeV
5223  }
5224  sigma2 = sigmaPileUp * sigmaPileUp - sigmaZ * sigmaZ;
5225  sigma2up = sigma2;
5226  sigma2down = -1. * sigma2;
5227  ATH_MSG_DEBUG(std::format("sys resolution pileup noise: {:.7f} {:.7f} {:.7f}", sigma2, sigma2up, sigma2down));
5228  }
5229 
5230  // systematics from material in IBL+PP0 for barrel
5231  else if (isys == 7 && std::abs(eta) < 1.5 &&
5247  double sigmaE =
5248  m_getMaterialDelta->getDelta(particle_type, energy, eta, 1, 5);
5249  sigma2 = sigmaE * sigmaE;
5250  sigma2up = sigma2;
5251  sigma2down = -1. * sigma2;
5252  ATH_MSG_DEBUG(
5253  std::format("sys resolution ibl material: {:.7f} {:.7f} {:.7f}", sigma2, sigma2up, sigma2down));
5254  }
5255 
5256  // systematics from material in IBL+PP0 for end-cap
5257  else if (isys == 8 && std::abs(eta) > 1.5 &&
5273  double sigmaE =
5274  m_getMaterialDelta->getDelta(particle_type, energy, eta, 1, 5);
5275  // scale factor 2.3 in X0 => sqrt(2) in resolution or 2 in resolution**2
5276  sigma2 = 2.3 * sigmaE * sigmaE;
5277  sigma2up = sigma2;
5278  sigma2down = -1. * sigma2;
5279  ATH_MSG_DEBUG(
5280  std::format("sys resolution pp0 material: {:.7f} {:.7f} {:.7f}", sigma2, sigma2up, sigma2down));
5281 
5282  }
5283 
5284  // AF2/AF3 resolution systematics since es2017_R21_v1 model (neglected before
5285  // that...)
5286  else if (isys == 9 &&
5288  fast) {
5289  const double ptGeV = et / 1e3;
5290  bool interpolate_eta = false;
5291  bool interpolate_pt = false;
5293  // interpolate_eta = true;
5294  interpolate_pt = true;
5295  }
5296  if (particle_type == 0) {
5297  sigma2 = getValueHistAt(*m_G4OverAFII_resolution_electron, eta, ptGeV,
5298  true, true, true, true,
5299  interpolate_eta, interpolate_pt);
5300  if (std::abs(eta)>=1.3 and std::abs(eta)<=1.35 and
5302  // sigma2 is FS^2 - AF^2, extra sys will degreate AF resolution, so decrease sigma2
5303  sigma2 -= pow(getValueHistoAt(*m_G4OverAF_electron_resolution_extra_sys,
5304  ptGeV, true, true, interpolate_pt), 2);
5305  }
5306  if (particle_type == 1) {
5307  sigma2 = getValueHistAt(*m_G4OverAFII_resolution_unconverted, eta,
5308  ptGeV, true, true, true, true,
5309  interpolate_eta, interpolate_pt);
5310  if (std::abs(eta)>=1.3 and std::abs(eta)<=1.35 and
5312  sigma2 -= pow(getValueHistoAt(*m_G4OverAF_unconverted_resolution_extra_sys,
5313  ptGeV, true, true, interpolate_pt), 2);
5314  }
5315  if (particle_type == 2) {
5316  sigma2 = getValueHistAt(*m_G4OverAFII_resolution_converted, eta,
5317  ptGeV, true, true, true, true,
5318  interpolate_eta, interpolate_pt);
5319  if (std::abs(eta)>=1.3 and std::abs(eta)<=1.35 and
5321  sigma2 -= pow(getValueHistoAt(*m_G4OverAF_converted_resolution_extra_sys,
5322  ptGeV, true, true, interpolate_pt), 2);
5323  }
5324  sigma2up = -1. * sigma2; // AF2 resolution worse than full Sim,
5325  // sigma2up gives back AF2 resolution
5326  sigma2down = sigma2;
5327  }
5328 
5329  // OFC resolution systematics for for es2022_RUN3_PRE
5330  else if (isys == 10 && (m_esmodel == egEnergyCorr::es2022_R22_PRE)) {
5331  double d1 = (smearingZ + esmearingOFC) * (smearingZ + esmearingOFC) -
5332  smearingZ * smearingZ;
5333  double d2 = smearingZ * smearingZ -
5334  (smearingZ - esmearingOFC) * (smearingZ - esmearingOFC);
5335  double d = 0.5 * (d1 + d2);
5336  sigma2up = d1;
5337  sigma2down = -d2;
5338  sigma2 = d;
5339  ATH_MSG_DEBUG(std::format("sys resolution OFC unc.: {:.7f} {:.7f} {:.7f}", sigma2, sigma2up, sigma2down));
5340  }
5341 
5342  // old method to use max of up and down for All
5343  /*
5344  double rr1 = sqrt(resolution2+sigma2); // nominal (data) +
5345  average error double rr2=0.; if((resolution2-sigma2) > 0.) rr2 =
5346  sqrt(resolution2-sigma2); // max(0, nominal (data) - average error)
5347  double deltaSigma_sys;
5348  if ((rr1-resolution) > (resolution-rr2) ) deltaSigma_sys =
5349  rr1-resolution; else deltaSigma_sys = resolution-rr2; deltaSigma_sys =
5350  deltaSigma_sys / resolution;
5351  */
5352 
5353  // use average of up and down for symmetric uncertainty for All
5354 
5355  double rr1 = 0.;
5356  if ((resolution2 + sigma2up) > 0.)
5357  rr1 = sqrt(resolution2 + sigma2up); // nominal (data) + up error
5358  double rr2 = 0.;
5359  if ((resolution2 + sigma2down) > 0.)
5360  rr2 = sqrt(resolution2 +
5361  sigma2down); // max(0, nominal (data) + down error
5362  double deltaSigma_sys;
5363  deltaSigma_sys =
5364  0.5 * (rr1 - rr2); // average of up and down uncertainties
5365  deltaSigma_sys =
5366  deltaSigma_sys / resolution; // relative resolution uncertainty
5367 
5368  sum_sigma_resolution2 += deltaSigma_sys * deltaSigma_sys;
5369 
5370  if ((resolution2 + sigma2up) > 0.)
5371  rr1 = sqrt(resolution2 + sigma2up);
5372  else
5373  rr1 = 0.;
5374  double deltaSigmaUp = (rr1 - resolution) / resolution;
5375  ATH_MSG_VERBOSE("relative resolution change Up " << deltaSigmaUp);
5376 
5377  if ((resolution2 + sigma2down) > 0.)
5378  rr2 = sqrt(resolution2 + sigma2down);
5379  else
5380  rr2 = 0.;
5381  double deltaSigmaDown = (rr2 - resolution) / resolution;
5382  ATH_MSG_VERBOSE("relative resolution change Down " << deltaSigmaDown);
5383 
5384  sum_deltaUp += deltaSigmaUp;
5385  sum_deltaDown += deltaSigmaDown;
5386  }
5387  }
5388 
5389  resolution = resolution * energy; // to return final resolution in MeV
5390  resolution_error = sqrt(sum_sigma_resolution2) *
5391  resolution; // to return resolution uncertainty in MeV
5392 
5393  resolution_error_up = sum_deltaUp * resolution;
5394  resolution_error_down = sum_deltaDown * resolution;
5395 
5396  ATH_MSG_VERBOSE("Resolution (MeV): "
5397  << resolution
5398  << " Resolution Error (MeV): " << resolution_error << " down "
5399  << resolution_error_down << " up " << resolution_error_up
5400  << " Z smearing " << smearingZ << " +- " << esmearingZ
5401  << " using mask " << syst_mask);
5402 }
5403 
5406  switch (var) {
5408  return "None";
5410  return "Nominal";
5412  return "topoClusterThresUp";
5414  return "topoClusterThresDown";
5416  return "MomentumUp";
5418  return "MomentumDown";
5420  return "ZeeStatUp";
5422  return "ZeeStatDown";
5424  return "ZeeSystUp";
5426  return "ZeeSystDown";
5428  return "ZeePhysUp";
5430  return "ZeePhysDown";
5432  return "ZeeAllUp";
5434  return "ZeeAllDown";
5436  return "LArCalibUp";
5438  return "LArCalibDown";
5440  return "LArUnconvCalibUp";
5442  return "LArUnconvCalibDown";
5444  return "LArElecCalibUp";
5446  return "LArElecCalibDown";
5448  return "LArCalibExtra2015PreUp";
5450  return "LArCalibExtra2015PreDown";
5452  return "LArElecUnconvUp";
5454  return "LArElecUnconvDown";
5456  return "G4Up";
5458  return "G4Down";
5460  return "PSUp";
5462  return "PSDown";
5464  return "PSb12Up";
5466  return "PSb12Down";
5468  return "S12Up";
5470  return "S12Down";
5472  return "S12ExtraLastEtaBinRun2Up";
5474  return "S12ExtraLastEtaBinRun2Down";
5476  return "MatIDUp";
5478  return "MatIDDown";
5480  return "MatCryoUp";
5482  return "MatCryoDown";
5484  return "MatCaloUp";
5486  return "MatCaloDown";
5488  return "L1GainUp";
5490  return "L1GainDown";
5492  return "L2GainUp";
5494  return "L2GainDown";
5496  return "L2LowGainDown";
5498  return "L2LowGainUp";
5500  return "L2MediumGainDown";
5502  return "L2MediumGainUp";
5504  return "ADCLinUp";
5506  return "ADCLinDown";
5508  return "LeakageElecUp";
5510  return "LeakageElecDown";
5512  return "ConvRecoUp";
5514  return "ConvRecoDown";
5516  return "afUp";
5518  return "afDown";
5520  return "LeakageUnconvUp";
5522  return "LeakageUnconvDown";
5524  return "LeakageConvUp";
5526  return "LeakageConvDown";
5528  return "ConvEfficiencyUp";
5530  return "ConvEfficiencyDown";
5532  return "ConvFakeRateUp";
5534  return "ConvFakeRateDown";
5536  return "ConvRadiusUp";
5538  return "ConvRadiusDown";
5540  return "PedestalUp";
5542  return "PedestalDown";
5544  return "AllUp";
5546  return "AllDown";
5548  return "AllCorrelatedUp";
5550  return "AllCorrelatedDown";
5552  return "LArTemperature2015PreUp";
5554  return "LArTemperature2015PreDown";
5556  return "LArTemperature2016PreUp";
5558  return "LArTemperature2016PreDown";
5560  return "E4ScintillatorUp";
5562  return "E4ScintillatorDown";
5564  return "MatPP0Up";
5566  return "MatPP0Down";
5568  return "Wtots1Up";
5570  return "Wtots1Down";
5572  return "LastScaleVariation";
5574  return "OFCUp";
5576  return "OFCDown";
5578  return "EXTRARUN3PREUp";
5580  return "EXTRARUN3PREDown";
5582  return "PSEXTRARUN3Up";
5584  return "PSEXTRARUN3Down";
5586  return "S12EXTRARUN3Up";
5588  return "S12EXTRARUN3Down";
5590  return "L2MediumGainEXTRARUN3Up";
5592  return "L2MediumGainEXTRARUN3Down";
5594  return "L2LowGainEXTRARUN3Up";
5596  return "L2LowGainEXTRARUN3Down";
5597  default:
5598  return "Unknown";
5599  }
5600 }
5601 
5604  switch (var) {
5606  return "Resolution::None";
5608  return "Resolution::Nominal";
5610  return "Resolution::AllDown";
5612  return "Resolution::AllUp";
5614  return "Resolution::ZSmearingUp";
5616  return "Resolution::ZSmearingDown";
5618  return "Resolution::SamplingTermUp";
5620  return "Resolution::SamplingTermDown";
5622  return "Resolution::MaterialUp";
5624  return "Resolution::MaterialDown";
5626  return "Resolution::MaterialUp";
5628  return "Resolution::MaterialDown";
5630  return "Resolution::MaterialUp";
5632  return "Resolution::MaterialDown";
5634  return "Resolution::MaterialUp";
5636  return "Resolution::MaterialDown";
5638  return "Resolution::PileUpUp";
5640  return "Resolution::PileUpDown";
5642  return "Resolution::MaterialPP0Up";
5644  return "Resolution::MaterialPP0Down";
5646  return "Resolution::MaterialIBLUp";
5648  return "Resolution::MaterialIBLDown";
5650  return "Resolution::afUp";
5652  return "Resolution::afDown";
5654  return "Resolution::OFCUp";
5656  return "Resolution::OFCDown";
5658  return "LastResolutionVariation";
5659  default:
5660  return "Resolution::Unknown";
5661  }
5662 }
5663 
5665  const auto ieta = std::as_const(*m_zeeSyst).GetXaxis()->FindFixBin(eta);
5666  auto value_histo = m_zeeSyst->GetBinContent(ieta);
5667 
5668  return value_histo;
5669 }
5670 
5672  const auto ieta = std::as_const(*m_zeeSystOFC).GetXaxis()->FindFixBin(eta);
5673  auto value_histo = m_zeeSystOFC->GetBinContent(ieta);
5674 
5675  return value_histo;
5676 }
5677 
5679  return *std::as_const(*m_zeeNom).GetXaxis();
5680 }
5681 
5682 } // namespace AtlasRoot
AtlasRoot::egammaEnergyCorrectionTool::m_dX_IPPS_LAr
std::unique_ptr< TH1 > m_dX_IPPS_LAr
Definition: egammaEnergyCorrectionTool.h:684
AtlasRoot::egammaEnergyCorrectionTool::get_ZeeStat_eta_axis
const TAxis & get_ZeeStat_eta_axis() const
Definition: egammaEnergyCorrectionTool.cxx:5678
egEnergyCorr::Scale::ZeeSystDown
@ ZeeSystDown
Definition: egammaEnergyCorrectionTool.h:147
egEnergyCorr::Scale::PSEXTRARUN3Down
@ PSEXTRARUN3Down
Definition: egammaEnergyCorrectionTool.h:274
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
egEnergyCorr::Resolution::MaterialPP0Up
@ MaterialPP0Up
Definition: egammaEnergyCorrectionTool.h:93
plotBeamSpotCompare.x1
x1
Definition: plotBeamSpotCompare.py:215
egEnergyCorr::es2024_Run3_v0
@ es2024_Run3_v0
Definition: egammaEnergyCorrectionTool.h:343
AtlasRoot::egammaEnergyCorrectionTool::m_resSyst
std::unique_ptr< TH1 > m_resSyst
Definition: egammaEnergyCorrectionTool.h:676
beamspotnt.var
var
Definition: bin/beamspotnt.py:1393
AtlasRoot::egammaEnergyCorrectionTool::m_rootFileName
std::string m_rootFileName
Definition: egammaEnergyCorrectionTool.h:643
egEnergyCorr::Scale::OFCDown
@ OFCDown
Definition: egammaEnergyCorrectionTool.h:266
AtlasRoot::egammaEnergyCorrectionTool::m_zeeNom_data2015
std::unique_ptr< TH1 > m_zeeNom_data2015
Definition: egammaEnergyCorrectionTool.h:658
AtlasRoot::egammaEnergyCorrectionTool::m_wstot_pT_MC_p0_unconverted_photons
std::unique_ptr< TH1 > m_wstot_pT_MC_p0_unconverted_photons
Definition: egammaEnergyCorrectionTool.h:756
egEnergyCorr::Scale::PSDown
@ PSDown
Definition: egammaEnergyCorrectionTool.h:184
PATCore::ParticleType::UnconvertedPhoton
@ UnconvertedPhoton
Definition: PATCoreEnums.h:38
AtlasRoot::egammaEnergyCorrectionTool::m_wstot_pT_data_p0_electrons
std::unique_ptr< TH1 > m_wstot_pT_data_p0_electrons
Definition: egammaEnergyCorrectionTool.h:748
AtlasRoot::egammaEnergyCorrectionTool::m_matElectronCstTerm
std::vector< std::unique_ptr< TH1 > > m_matElectronCstTerm
Definition: egammaEnergyCorrectionTool.h:766
et
Extra patterns decribing particle interation process.
egEnergyCorr::Resolution::SamplingTermUp
@ SamplingTermUp
Definition: egammaEnergyCorrectionTool.h:74
GeV
#define GeV
Definition: PhysicsAnalysis/TauID/TauAnalysisTools/Root/HelperFunctions.cxx:18
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
egEnergyCorr::es2011c
@ es2011c
Definition: egammaEnergyCorrectionTool.h:299
egEnergyCorr::ConfigIBL
@ ConfigIBL
Definition: egammaEnergyCorrectionTool.h:357
pdg_comparison.sigma
sigma
Definition: pdg_comparison.py:324
egEnergyCorr::Scale::LArCalibExtra2015PreDown
@ LArCalibExtra2015PreDown
Definition: egammaEnergyCorrectionTool.h:166
egEnergyCorr::Scale::LastScaleVariation
@ LastScaleVariation
Definition: egammaEnergyCorrectionTool.h:288
add-xsec-uncert-quadrature-N.alpha
alpha
Definition: add-xsec-uncert-quadrature-N.py:110
mc.random_seed
random_seed
Definition: mc.PhPy8EG_Hto4l_NNLOPS_nnlo_30_ggH125_ZZ4l.py:43
AtlasRoot::egammaEnergyCorrectionTool::mcSamplingTermRelError
static double mcSamplingTermRelError(double cl_eta)
Definition: egammaEnergyCorrectionTool.cxx:2879
AtlasRoot::egammaEnergyCorrectionTool::m_initialized
bool m_initialized
Definition: egammaEnergyCorrectionTool.h:829
AtlasRoot::egammaEnergyCorrectionTool::m_unconvertedBias_ConfigN
std::unique_ptr< TH2 > m_unconvertedBias_ConfigN
Definition: egammaEnergyCorrectionTool.h:785
egEnergyCorr::es2011d
@ es2011d
Definition: egammaEnergyCorrectionTool.h:301
egEnergyCorr::Scale::OFCUp
@ OFCUp
Definition: egammaEnergyCorrectionTool.h:265
egEnergyCorr::Scale::MatIDDown
@ MatIDDown
Definition: egammaEnergyCorrectionTool.h:216
beamspotman.sigmaZ
sigmaZ
Definition: beamspotman.py:1623
vtune_athena.format
format
Definition: vtune_athena.py:14
AtlasRoot::egammaEnergyCorrectionTool::m_convertedBias_ConfigA
std::unique_ptr< TH2 > m_convertedBias_ConfigA
Definition: egammaEnergyCorrectionTool.h:788
AtlasRoot::egammaEnergyCorrectionTool::m_G4OverAF_converted_scale_extra_sys
std::unique_ptr< TH1 > m_G4OverAF_converted_scale_extra_sys
Definition: egammaEnergyCorrectionTool.h:811
AtlasRoot::egammaEnergyCorrectionTool::m_unconvertedBias_ConfigPP0
std::unique_ptr< TH2 > m_unconvertedBias_ConfigPP0
Definition: egammaEnergyCorrectionTool.h:787
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
PATCore::ParticleType::Type
Type
Definition: PATCoreEnums.h:35
AtlasRoot::egammaEnergyCorrectionTool::m_resNom
std::unique_ptr< TH1 > m_resNom
Definition: egammaEnergyCorrectionTool.h:675
DiTauMassTools::TauTypes::hh
@ hh
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:53
AtlasRoot::egammaEnergyCorrectionTool::m_EaccUnconvertedGraphs
std::unique_ptr< TList > m_EaccUnconvertedGraphs
Definition: egammaEnergyCorrectionTool.h:719
egEnergyCorr::Scale::afUp
@ afUp
Definition: egammaEnergyCorrectionTool.h:245
xAOD::et
et
Definition: TrigEMCluster_v1.cxx:25
AtlasRoot::egammaEnergyCorrectionTool::m_psElectronGraphs
std::unique_ptr< TList > m_psElectronGraphs
Definition: egammaEnergyCorrectionTool.h:696
egEnergyCorr::Scale::LArTemperature2016PreUp
@ LArTemperature2016PreUp
Definition: egammaEnergyCorrectionTool.h:171
egEnergyCorr::Scale::AllCorrelatedDown
@ AllCorrelatedDown
Definition: egammaEnergyCorrectionTool.h:285
AtlasRoot::egammaEnergyCorrectionTool::m_endRunNumber
unsigned int m_endRunNumber
Definition: egammaEnergyCorrectionTool.h:646
AtlasRoot::egammaEnergyCorrectionTool::m_leakageElectron
std::unique_ptr< TH1 > m_leakageElectron
Definition: egammaEnergyCorrectionTool.h:738
AtlasRoot::egammaEnergyCorrectionTool::applyAFtoG4
double applyAFtoG4(double eta, double ptGeV, PATCore::ParticleType::Type ptype) const
MC calibration corrections.
Definition: egammaEnergyCorrectionTool.cxx:3385
egEnergyCorr::Scale::ConvFakeRateDown
@ ConvFakeRateDown
Definition: egammaEnergyCorrectionTool.h:255
graphs
Definition: graphs.py:1
egEnergyCorr::Resolution::ZSmearingUp
@ ZSmearingUp
Definition: egammaEnergyCorrectionTool.h:70
egEnergyCorr::Scale::G4Down
@ G4Down
Definition: egammaEnergyCorrectionTool.h:176
egEnergyCorr::Scale::AllDown
@ AllDown
Definition: egammaEnergyCorrectionTool.h:283
hist_file_dump.d
d
Definition: hist_file_dump.py:142
max
constexpr double max()
Definition: ap_fixedTest.cxx:33
RootHelpers::FindBin
Int_t FindBin(const TAxis *axis, const double x)
Definition: RootHelpers.cxx:14
AtlasRoot::egammaEnergyCorrectionTool::m_applyS12Correction
bool m_applyS12Correction
Definition: egammaEnergyCorrectionTool.h:827
AtlasRoot::egammaEnergyCorrectionTool::m_s12ConvertedEtaBins
std::unique_ptr< TAxis > m_s12ConvertedEtaBins
Definition: egammaEnergyCorrectionTool.h:713
AtlasRoot::egammaEnergyCorrectionTool::m_zeeES2Profile
std::unique_ptr< TH1 > m_zeeES2Profile
Definition: egammaEnergyCorrectionTool.h:740
AtlasRoot::egammaEnergyCorrectionTool::m_wstot_slope_B_MC
std::unique_ptr< TH1 > m_wstot_slope_B_MC
Definition: egammaEnergyCorrectionTool.h:747
egEnergyCorr::Scale::L2GainDown
@ L2GainDown
Definition: egammaEnergyCorrectionTool.h:226
AtlasRoot::egammaEnergyCorrectionTool::getResolutionError
double getResolutionError(PATCore::ParticleDataType::DataType dataType, double energy, double eta, double etaCalo, PATCore::ParticleType::Type ptype, egEnergyCorr::Resolution::Variation value, egEnergyCorr::Resolution::resolutionType resType=egEnergyCorr::Resolution::SigmaEff90) const
Definition: egammaEnergyCorrectionTool.cxx:2986
AtlasRoot::egammaEnergyCorrectionTool::getE4NonLinearity
double getE4NonLinearity(double cl_eta, double meanE, PATCore::ParticleType::Type) const
Definition: egammaEnergyCorrectionTool.cxx:4055
egEnergyCorr::Scale::L2MediumGainEXTRARUN3Down
@ L2MediumGainEXTRARUN3Down
Definition: egammaEnergyCorrectionTool.h:278
AtlasRoot::egammaEnergyCorrectionTool::m_pp0_elec
std::unique_ptr< TH2 > m_pp0_elec
Definition: egammaEnergyCorrectionTool.h:742
AtlasRoot::egammaEnergyCorrectionTool::getAlphaValue
double getAlphaValue(long int runnumber, double cl_eta, double cl_etaS2, double cl_etaCalo, double energy, double energyS2, double eraw, PATCore::ParticleType::Type ptype=PATCore::ParticleType::Electron, egEnergyCorr::Scale::Variation var=egEnergyCorr::Scale::Nominal, double varSF=1.) const
Definition: egammaEnergyCorrectionTool.cxx:2255
egEnergyCorr::Scale::LArTemperature2015PreDown
@ LArTemperature2015PreDown
Definition: egammaEnergyCorrectionTool.h:168
AtlasRoot::egammaEnergyCorrectionTool::m_G4OverAF_electron_resolution_extra_sys
std::unique_ptr< TH1 > m_G4OverAF_electron_resolution_extra_sys
Definition: egammaEnergyCorrectionTool.h:813
egEnergyCorr::Scale::LArElecUnconvUp
@ LArElecUnconvUp
Definition: egammaEnergyCorrectionTool.h:161
AtlasRoot::egammaEnergyCorrectionTool::m_unconvertedBias_ConfigEpLp
std::unique_ptr< TH2 > m_unconvertedBias_ConfigEpLp
Definition: egammaEnergyCorrectionTool.h:783
AtlasRoot::egammaEnergyCorrectionTool::getResolution_systematics
void getResolution_systematics(int particle_type, double energy, double eta, double etaCalo, int syst_mask, double &resolution, double &resolution_error, double &resolution_error_up, double &resolution_error_down, int resol_type=0, bool fast=false) const
get resolution and its uncertainty)
Definition: egammaEnergyCorrectionTool.cxx:5066
AtlasRoot::egammaEnergyCorrectionTool::m_psConvertedGraphs
std::unique_ptr< TList > m_psConvertedGraphs
Definition: egammaEnergyCorrectionTool.h:700
AtlasRoot::egammaEnergyCorrectionTool::m_s12ConvertedGraphs
std::unique_ptr< TList > m_s12ConvertedGraphs
Definition: egammaEnergyCorrectionTool.h:714
PATCore::ParticleDataType::Fast
@ Fast
Definition: PATCoreEnums.h:22
AtlasRoot::egammaEnergyCorrectionTool::getDeltaX
double getDeltaX(double cl_eta, egEnergyCorr::MaterialCategory imat, egEnergyCorr::Scale::Variation var=egEnergyCorr::Scale::Nominal) const
Definition: egammaEnergyCorrectionTool.cxx:4205
egEnergyCorr::Scale::LArElecCalibUp
@ LArElecCalibUp
Definition: egammaEnergyCorrectionTool.h:159
egEnergyCorr::Scale::L2LowGainEXTRARUN3Up
@ L2LowGainEXTRARUN3Up
Definition: egammaEnergyCorrectionTool.h:279
egEnergyCorr::Scale::MatIDUp
@ MatIDUp
Definition: egammaEnergyCorrectionTool.h:215
egEnergyCorr::es2017_R21_v1
@ es2017_R21_v1
Definition: egammaEnergyCorrectionTool.h:330
egEnergyCorr::Scale::LeakageElecUp
@ LeakageElecUp
Definition: egammaEnergyCorrectionTool.h:197
yodamerge_tmp.axis
list axis
Definition: yodamerge_tmp.py:241
AtlasRoot::egammaEnergyCorrectionTool::getE4Uncertainty
double getE4Uncertainty(double eta) const
Definition: egammaEnergyCorrectionTool.cxx:3780
AtlasRoot::egammaEnergyCorrectionTool::m_E4ConvertedEtaBins
std::unique_ptr< TAxis > m_E4ConvertedEtaBins
Definition: egammaEnergyCorrectionTool.h:706
AtlasRoot::egammaEnergyCorrectionTool::m_gain_tool
std::unique_ptr< egGain::GainTool > m_gain_tool
Definition: egammaEnergyCorrectionTool.h:474
egEnergyCorr::Scale::LeakageConvDown
@ LeakageConvDown
Definition: egammaEnergyCorrectionTool.h:204
egEnergyCorr::Scale::MatPP0Down
@ MatPP0Down
Definition: egammaEnergyCorrectionTool.h:242
AtlasRoot::egammaEnergyCorrectionTool::m_aS12Nom
std::unique_ptr< TH1 > m_aS12Nom
Definition: egammaEnergyCorrectionTool.h:654
egEnergyCorr::es2015PRE_res_improved
@ es2015PRE_res_improved
Definition: egammaEnergyCorrectionTool.h:314
AtlasRoot::egammaEnergyCorrectionTool::m_dX_ID_Nom
std::unique_ptr< TH1 > m_dX_ID_Nom
Definition: egammaEnergyCorrectionTool.h:681
AtlasRoot::egammaEnergyCorrectionTool::get_ZeeSyst
double get_ZeeSyst(double eta) const
Definition: egammaEnergyCorrectionTool.cxx:5664
asg
Definition: DataHandleTestTool.h:28
egammaEnergyCorrectionTool.h
bin
Definition: BinsDiffFromStripMedian.h:43
EgammaARTmonitoring_plotsMaker.particle_type
particle_type
Definition: EgammaARTmonitoring_plotsMaker.py:633
AtlasRoot::egammaEnergyCorrectionTool::m_matUnconvertedScale
std::vector< std::unique_ptr< TH1 > > m_matUnconvertedScale
Definition: egammaEnergyCorrectionTool.h:764
egEnergyCorr::Scale::Nominal
@ Nominal
Definition: egammaEnergyCorrectionTool.h:132
downloadSingle.dataType
string dataType
Definition: downloadSingle.py:18
mc.diff
diff
Definition: mc.SFGenPy8_MuMu_DD.py:14
AtlasRoot::egammaEnergyCorrectionTool::mcZPeakResolution
double mcZPeakResolution(double cl_eta) const
Definition: egammaEnergyCorrectionTool.cxx:2949
egEnergyCorr::Scale::EXTRARUN3PREDown
@ EXTRARUN3PREDown
Definition: egammaEnergyCorrectionTool.h:270
AtlasRoot::egammaEnergyCorrectionTool::m_s12UnconvertedGraphs
std::unique_ptr< TList > m_s12UnconvertedGraphs
Definition: egammaEnergyCorrectionTool.h:712
egEnergyCorr::Scale::S12Up
@ S12Up
Definition: egammaEnergyCorrectionTool.h:185
dq_defect_virtual_defect_validation.d1
d1
Definition: dq_defect_virtual_defect_validation.py:79
AtlasRoot::egammaEnergyCorrectionTool::m_G4OverAF_unconverted_scale_extra_sys
std::unique_ptr< TH1 > m_G4OverAF_unconverted_scale_extra_sys
Definition: egammaEnergyCorrectionTool.h:812
AtlasRoot::egammaEnergyCorrectionTool::m_daS12Cor
std::unique_ptr< TH1 > m_daS12Cor
Definition: egammaEnergyCorrectionTool.h:655
egEnergyCorr::Scale::L2LowGainDown
@ L2LowGainDown
Definition: egammaEnergyCorrectionTool.h:230
AtlasRoot::egammaEnergyCorrectionTool::m_e1hg_tool
std::unique_ptr< e1hg_systematics > m_e1hg_tool
Definition: egammaEnergyCorrectionTool.h:482
athena.value
value
Definition: athena.py:124
egEnergyCorr::Scale::ZeeStatUp
@ ZeeStatUp
Definition: egammaEnergyCorrectionTool.h:144
AtlasRoot::egammaEnergyCorrectionTool::dataConstantTerm
double dataConstantTerm(double eta) const
Definition: egammaEnergyCorrectionTool.cxx:2927
egEnergyCorr::es2011dMedium
@ es2011dMedium
Definition: egammaEnergyCorrectionTool.h:302
AtlasRoot::egammaEnergyCorrectionTool::m_meanZeeProfile
std::unique_ptr< TProfile > m_meanZeeProfile
Definition: egammaEnergyCorrectionTool.h:673
AtlasRoot::egammaEnergyCorrectionTool::getAlphaPedestal
double getAlphaPedestal(double cl_eta, double energy, double eraw, PATCore::ParticleType::Type ptype, bool isRef, egEnergyCorr::Scale::Variation var=egEnergyCorr::Scale::Nominal, double varSF=1.) const
Definition: egammaEnergyCorrectionTool.cxx:4913
AtlasRoot::egammaEnergyCorrectionTool::mcNoiseTerm
static double mcNoiseTerm(double cl_eta)
Definition: egammaEnergyCorrectionTool.cxx:2887
AtlasRoot::egammaEnergyCorrectionTool::m_uA2MeV_2015_first2weeks_correction
std::unique_ptr< TH1 > m_uA2MeV_2015_first2weeks_correction
Definition: egammaEnergyCorrectionTool.h:672
AtlasRoot::egammaEnergyCorrectionTool::m_pedestalL1
std::unique_ptr< TH1 > m_pedestalL1
Definition: egammaEnergyCorrectionTool.h:724
e1hg_systematics.h
egEnergyCorr::Resolution::afDown
@ afDown
Definition: egammaEnergyCorrectionTool.h:98
AtlasRoot::egammaEnergyCorrectionTool::variationName
static std::string variationName(egEnergyCorr::Scale::Variation &var)
Definition: egammaEnergyCorrectionTool.cxx:5404
egEnergyCorr::Scale::ConvRadiusUp
@ ConvRadiusUp
Definition: egammaEnergyCorrectionTool.h:256
egEnergyCorr::Scale::Wtots1Up
@ Wtots1Up
Definition: egammaEnergyCorrectionTool.h:237
egEnergyCorr::Scale::MatCryoDown
@ MatCryoDown
Definition: egammaEnergyCorrectionTool.h:218
AtlasRoot::egammaEnergyCorrectionTool::m_peakResData
std::unique_ptr< TH1 > m_peakResData
Definition: egammaEnergyCorrectionTool.h:678
AtlasRoot::egammaEnergyCorrectionTool::m_unconvertedBias_ConfigFpMX
std::unique_ptr< TH2 > m_unconvertedBias_ConfigFpMX
Definition: egammaEnergyCorrectionTool.h:784
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
AtlasRoot::egammaEnergyCorrectionTool::m_convFakeRate_2D
std::unique_ptr< TH2 > m_convFakeRate_2D
Definition: egammaEnergyCorrectionTool.h:733
dbg::ptr
void * ptr(T *p)
Definition: SGImplSvc.cxx:74
beamspotman.sigmaX
sigmaX
Definition: beamspotman.py:1623
egEnergyCorr::es2023_R22_Run2_v1
@ es2023_R22_Run2_v1
Definition: egammaEnergyCorrectionTool.h:340
egEnergyCorr::Scale::ConvRecoDown
@ ConvRecoDown
Definition: egammaEnergyCorrectionTool.h:262
egEnergyCorr::Scale::LeakageConvUp
@ LeakageConvUp
Definition: egammaEnergyCorrectionTool.h:203
AtlasRoot::egammaEnergyCorrectionTool::m_s12ElectronGraphs
std::unique_ptr< TList > m_s12ElectronGraphs
Definition: egammaEnergyCorrectionTool.h:710
AtlasRoot::egammaEnergyCorrectionTool::RandomNumber
unsigned int RandomNumber
Definition: egammaEnergyCorrectionTool.h:379
D3PDTest::rng
uint32_t rng()
Definition: FillerAlg.cxx:40
AtlasRoot::egammaEnergyCorrectionTool::m_G4OverAF_converted_resolution_extra_sys
std::unique_ptr< TH1 > m_G4OverAF_converted_resolution_extra_sys
Definition: egammaEnergyCorrectionTool.h:814
x
#define x
JetTiledMap::S
@ S
Definition: TiledEtaPhiMap.h:44
egEnergyCorr::Scale::ZeeSystUp
@ ZeeSystUp
Definition: egammaEnergyCorrectionTool.h:146
egGain::GainUncertainty::GainType::MEDIUM
@ MEDIUM
egEnergyCorr::Resolution::PileUpUp
@ PileUpUp
Definition: egammaEnergyCorrectionTool.h:88
Dedxcorrection::resolution
double resolution[nGasTypes][nParametersResolution]
Definition: TRT_ToT_Corrections.h:46
AtlasRoot::egammaEnergyCorrectionTool::m_begRunNumber
unsigned int m_begRunNumber
Definition: egammaEnergyCorrectionTool.h:645
AtlasRoot::egammaEnergyCorrectionTool::m_wstot_pT_MC_p1_electrons
std::unique_ptr< TH1 > m_wstot_pT_MC_p1_electrons
Definition: egammaEnergyCorrectionTool.h:755
PATCore::ParticleDataType::Data
@ Data
Definition: PATCoreEnums.h:22
makeTRTBarrelCans.y1
tuple y1
Definition: makeTRTBarrelCans.py:15
AtlasRoot::egammaEnergyCorrectionTool::m_leakageUnconverted
std::unique_ptr< TH1 > m_leakageUnconverted
Definition: egammaEnergyCorrectionTool.h:737
egEnergyCorr::ConfigN
@ ConfigN
Definition: egammaEnergyCorrectionTool.h:356
egEnergyCorr::Scale::L2GainUp
@ L2GainUp
Definition: egammaEnergyCorrectionTool.h:225
AtlasRoot::egammaEnergyCorrectionTool::m_EaccConvertedEtaBins
std::unique_ptr< TAxis > m_EaccConvertedEtaBins
Definition: egammaEnergyCorrectionTool.h:720
egEnergyCorr::Scale::L2MediumGainEXTRARUN3Up
@ L2MediumGainEXTRARUN3Up
Definition: egammaEnergyCorrectionTool.h:277
PATCore::ParticleDataType::DataType
DataType
Definition: PATCoreEnums.h:22
egEnergyCorr::Scale::AllCorrelatedUp
@ AllCorrelatedUp
Definition: egammaEnergyCorrectionTool.h:284
egEnergyCorr::Scale::MatCaloDown
@ MatCaloDown
Definition: egammaEnergyCorrectionTool.h:220
python.iconfTool.models.loaders.level
level
Definition: loaders.py:20
egEnergyCorr::Resolution::MaterialGapUp
@ MaterialGapUp
Definition: egammaEnergyCorrectionTool.h:82
egEnergyCorr::es2017_R21_v0
@ es2017_R21_v0
Definition: egammaEnergyCorrectionTool.h:328
AtlasRoot::egammaEnergyCorrectionTool::mcConstantTerm
static double mcConstantTerm(double cl_eta)
Definition: egammaEnergyCorrectionTool.cxx:2906
AtlasRoot::egammaEnergyCorrectionTool::m_G4OverAFII_resolution_unconverted
std::unique_ptr< TH2 > m_G4OverAFII_resolution_unconverted
Definition: egammaEnergyCorrectionTool.h:806
egEnergyCorr::Scale::LeakageElecDown
@ LeakageElecDown
Definition: egammaEnergyCorrectionTool.h:198
AtlasRoot::egammaEnergyCorrectionTool::m_unconvertedBias_ConfigIBL
std::unique_ptr< TH2 > m_unconvertedBias_ConfigIBL
Definition: egammaEnergyCorrectionTool.h:786
AtlasRoot::egammaEnergyCorrectionTool::m_zeeFwdk
std::unique_ptr< const TH1 > m_zeeFwdk
Definition: egammaEnergyCorrectionTool.h:666
egEnergyCorr::Scale::L2LowGainEXTRARUN3Down
@ L2LowGainEXTRARUN3Down
Definition: egammaEnergyCorrectionTool.h:280
AtlasRoot::egammaEnergyCorrectionTool::getLayerNonLinearity
double getLayerNonLinearity(int iLayer, double cl_eta, double energy, PATCore::ParticleType::Type ptype) const
Definition: egammaEnergyCorrectionTool.cxx:4092
AtlasRoot::egammaEnergyCorrectionTool::m_E4ConvertedGraphs
std::unique_ptr< TList > m_E4ConvertedGraphs
Definition: egammaEnergyCorrectionTool.h:707
egEnergyCorr::Scale::L2LowGainUp
@ L2LowGainUp
Definition: egammaEnergyCorrectionTool.h:229
egEnergyCorr::ConfigPP0
@ ConfigPP0
Definition: egammaEnergyCorrectionTool.h:358
AtlasRoot::egammaEnergyCorrectionTool::m_use_stat_error_scaling
bool m_use_stat_error_scaling
Definition: egammaEnergyCorrectionTool.h:831
eg_resolution.h
AtlasRoot::egammaEnergyCorrectionTool::m_usepTInterpolationForLeakage
bool m_usepTInterpolationForLeakage
Definition: egammaEnergyCorrectionTool.h:836
AtlasRoot::egammaEnergyCorrectionTool::getAlphaLeakage2D
double getAlphaLeakage2D(double cl_eta, double et, PATCore::ParticleType::Type ptype, egEnergyCorr::Scale::Variation var=egEnergyCorr::Scale::Nominal, double varSF=1.) const
Definition: egammaEnergyCorrectionTool.cxx:4677
AtlasRoot::egammaEnergyCorrectionTool::m_psUnconvertedEtaBins
std::unique_ptr< TAxis > m_psUnconvertedEtaBins
Definition: egammaEnergyCorrectionTool.h:697
AtlasRoot::egammaEnergyCorrectionTool::m_dX_IPPS_Nom
std::unique_ptr< TH1 > m_dX_IPPS_Nom
Definition: egammaEnergyCorrectionTool.h:683
egEnergyCorr::Scale::MomentumUp
@ MomentumUp
Definition: egammaEnergyCorrectionTool.h:137
AtlasRoot::egammaEnergyCorrectionTool::m_RunNumber
unsigned int m_RunNumber
Definition: egammaEnergyCorrectionTool.h:647
PATCore::ParticleType::ConvertedPhoton
@ ConvertedPhoton
Definition: PATCoreEnums.h:39
AtlasRoot::egammaEnergyCorrectionTool::m_use_etaCalo_scales
bool m_use_etaCalo_scales
Definition: egammaEnergyCorrectionTool.h:823
egEnergyCorr::es2015cPRE
@ es2015cPRE
Definition: egammaEnergyCorrectionTool.h:315
AtlasRoot::egammaEnergyCorrectionTool::getAlphaMaterial
double getAlphaMaterial(double cl_eta, egEnergyCorr::MaterialCategory imat, PATCore::ParticleType::Type ptype, egEnergyCorr::Scale::Variation var=egEnergyCorr::Scale::Nominal, double varSF=1.) const
Definition: egammaEnergyCorrectionTool.cxx:4310
AtlasRoot::egammaEnergyCorrectionTool::m_s12ElectronEtaBins
std::unique_ptr< TAxis > m_s12ElectronEtaBins
Definition: egammaEnergyCorrectionTool.h:709
AtlasRoot::egammaEnergyCorrectionTool::m_wstot_pT_MC_p1_converted_photons
std::unique_ptr< TH1 > m_wstot_pT_MC_p1_converted_photons
Definition: egammaEnergyCorrectionTool.h:759
egEnergyCorr::Scale::LArTemperature2015PreUp
@ LArTemperature2015PreUp
Definition: egammaEnergyCorrectionTool.h:167
egEnergyCorr::Scale::AllUp
@ AllUp
Definition: egammaEnergyCorrectionTool.h:282
AtlasRoot::egammaEnergyCorrectionTool::pileUpTerm
double pileUpTerm(double energy, double eta, int particle_type) const
Definition: egammaEnergyCorrectionTool.cxx:5023
AtlasRoot::egammaEnergyCorrectionTool::m_dX_PSAcc_LAr
std::unique_ptr< TH1 > m_dX_PSAcc_LAr
Definition: egammaEnergyCorrectionTool.h:693
AtlasRoot::egammaEnergyCorrectionTool::m_wstot_pT_data_p1_electrons
std::unique_ptr< TH1 > m_wstot_pT_data_p1_electrons
Definition: egammaEnergyCorrectionTool.h:749
egEnergyCorr::Scale::L1GainDown
@ L1GainDown
Definition: egammaEnergyCorrectionTool.h:224
egEnergyCorr::Resolution::ZSmearingDown
@ ZSmearingDown
Definition: egammaEnergyCorrectionTool.h:69
A
AtlasRoot::egammaEnergyCorrectionTool::m_convFakeRate
std::unique_ptr< TH1 > m_convFakeRate
Definition: egammaEnergyCorrectionTool.h:731
AtlasRoot::egammaEnergyCorrectionTool::m_matX0Additions
std::vector< std::unique_ptr< TH1 > > m_matX0Additions
Definition: egammaEnergyCorrectionTool.h:767
AtlasRoot::egammaEnergyCorrectionTool::m_resolution_tool
std::unique_ptr< eg_resolution > m_resolution_tool
Definition: egammaEnergyCorrectionTool.h:480
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:209
egEnergyCorr::es2015_day0_3percent
@ es2015_day0_3percent
Definition: egammaEnergyCorrectionTool.h:311
egEnergyCorr::Scale::LArCalibUp
@ LArCalibUp
Definition: egammaEnergyCorrectionTool.h:155
egEnergyCorr::Resolution::MaterialPP0Down
@ MaterialPP0Down
Definition: egammaEnergyCorrectionTool.h:94
egEnergyCorr::es2010
@ es2010
Definition: egammaEnergyCorrectionTool.h:297
egEnergyCorr::Geometry
Geometry
Definition: egammaEnergyCorrectionTool.h:350
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
CheckAppliedSFs.e3
e3
Definition: CheckAppliedSFs.py:264
egEnergyCorr::Scale::LeakageUnconvDown
@ LeakageUnconvDown
Definition: egammaEnergyCorrectionTool.h:202
AtlasRoot::egammaEnergyCorrectionTool::m_G4OverAF_unconverted_resolution_extra_sys
std::unique_ptr< TH1 > m_G4OverAF_unconverted_resolution_extra_sys
Definition: egammaEnergyCorrectionTool.h:815
ParticleGun_FastCalo_ChargeFlip_Config.energy
energy
Definition: ParticleGun_FastCalo_ChargeFlip_Config.py:78
beamspotnt.graphs
graphs
Definition: bin/beamspotnt.py:1537
egEnergyCorr::MatCalo
@ MatCalo
Definition: egammaEnergyCorrectionTool.h:366
AtlasRoot::egammaEnergyCorrectionTool::m_EaccConvertedGraphs
std::unique_ptr< TList > m_EaccConvertedGraphs
Definition: egammaEnergyCorrectionTool.h:721
UNDEFINED
@ UNDEFINED
Definition: sTGCenumeration.h:18
egEnergyCorr::Resolution::MaterialCryoUp
@ MaterialCryoUp
Definition: egammaEnergyCorrectionTool.h:84
egEnergyCorr::es2017_R21_PRE
@ es2017_R21_PRE
Definition: egammaEnergyCorrectionTool.h:326
ParticleGun_EoverP_Config.momentum
momentum
Definition: ParticleGun_EoverP_Config.py:63
AtlasRoot::egammaEnergyCorrectionTool::m_dX_PSAcc_Nom
std::unique_ptr< TH1 > m_dX_PSAcc_Nom
Definition: egammaEnergyCorrectionTool.h:691
AtlasRoot::egammaEnergyCorrectionTool::m_psConvertedEtaBins
std::unique_ptr< TAxis > m_psConvertedEtaBins
Definition: egammaEnergyCorrectionTool.h:699
egEnergyCorr::Scale::PSEXTRARUN3Up
@ PSEXTRARUN3Up
Definition: egammaEnergyCorrectionTool.h:273
egEnergyCorr::Scale::L1GainUp
@ L1GainUp
Definition: egammaEnergyCorrectionTool.h:223
egEnergyCorr::es2015cPRE_res_improved
@ es2015cPRE_res_improved
Definition: egammaEnergyCorrectionTool.h:316
lumiFormat.i
int i
Definition: lumiFormat.py:85
egEnergyCorr::Scale::topoClusterThresUp
@ topoClusterThresUp
Definition: egammaEnergyCorrectionTool.h:207
egEnergyCorr::Scale::ConvEfficiencyDown
@ ConvEfficiencyDown
Definition: egammaEnergyCorrectionTool.h:253
LinearityADC.h
AtlasRoot::egammaEnergyCorrectionTool::m_wstot_pT_MC_p0_converted_photons
std::unique_ptr< TH1 > m_wstot_pT_MC_p0_converted_photons
Definition: egammaEnergyCorrectionTool.h:758
AtlasRoot::egammaEnergyCorrectionTool::getAlphaZee
double getAlphaZee(long int runnumber, double eta, egEnergyCorr::Scale::Variation var=egEnergyCorr::Scale::Nominal, double varSF=1.) const
Definition: egammaEnergyCorrectionTool.cxx:3453
egEnergyCorr::Scale::LArElecUnconvDown
@ LArElecUnconvDown
Definition: egammaEnergyCorrectionTool.h:162
AtlasRoot::egammaEnergyCorrectionTool::m_use_new_resolution_model
bool m_use_new_resolution_model
Definition: egammaEnergyCorrectionTool.h:830
AtlasRoot::egammaEnergyCorrectionTool::m_psElectronEtaBins
std::unique_ptr< TAxis > m_psElectronEtaBins
Definition: egammaEnergyCorrectionTool.h:695
GainUncertainty.h
AtlasRoot::egammaEnergyCorrectionTool::getInterpolateConvSyst2D
static double getInterpolateConvSyst2D(const TH2 &conv_hist, double aeta, double ET)
Definition: egammaEnergyCorrectionTool.cxx:4873
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
AtlasRoot::egammaEnergyCorrectionTool::m_pp0_unconv
std::unique_ptr< TH2 > m_pp0_unconv
Definition: egammaEnergyCorrectionTool.h:743
AtlasRoot::egammaEnergyCorrectionTool::m_wstot_pT_data_p1_unconverted_photons
std::unique_ptr< TH1 > m_wstot_pT_data_p1_unconverted_photons
Definition: egammaEnergyCorrectionTool.h:751
AtlasRoot::egammaEnergyCorrectionTool::m_wstot_pT_data_p0_unconverted_photons
std::unique_ptr< TH1 > m_wstot_pT_data_p0_unconverted_photons
Definition: egammaEnergyCorrectionTool.h:750
egEnergyCorr::Resolution::afUp
@ afUp
Definition: egammaEnergyCorrectionTool.h:97
fitman.mz
mz
Definition: fitman.py:526
egEnergyCorr::Scale::LeakageUnconvUp
@ LeakageUnconvUp
Definition: egammaEnergyCorrectionTool.h:201
egEnergyCorr::Scale::MomentumDown
@ MomentumDown
Definition: egammaEnergyCorrectionTool.h:138
egEnergyCorr::Scale::ConvRecoUp
@ ConvRecoUp
Definition: egammaEnergyCorrectionTool.h:261
AtlasRoot::egammaEnergyCorrectionTool::m_zeePhys
std::unique_ptr< TH1 > m_zeePhys
Definition: egammaEnergyCorrectionTool.h:671
AtlasRoot::egammaEnergyCorrectionTool::getWtots1Uncertainty
double getWtots1Uncertainty(double cl_eta, double energy, PATCore::ParticleType::Type ptype) const
Definition: egammaEnergyCorrectionTool.cxx:3817
AtlasRoot::egammaEnergyCorrectionTool::m_use_uA2MeV_2015_first2weeks_correction
bool m_use_uA2MeV_2015_first2weeks_correction
Definition: egammaEnergyCorrectionTool.h:840
egEnergyCorr::Resolution::Nominal
@ Nominal
Definition: egammaEnergyCorrectionTool.h:62
plotBeamSpotCompare.ivar
int ivar
Definition: plotBeamSpotCompare.py:382
AtlasRoot::egammaEnergyCorrectionTool::isInCrack
static bool isInCrack(double cl_eta)
Definition: egammaEnergyCorrectionTool.cxx:4998
AtlasRoot::egammaEnergyCorrectionTool::fcn_sigma
static double fcn_sigma(double energy, double Cdata, double Cdata_er, double S, double S_er)
Definition: egammaEnergyCorrectionTool.cxx:3263
AtlasRoot::egammaEnergyCorrectionTool::m_esmodel
egEnergyCorr::ESModel m_esmodel
Definition: egammaEnergyCorrectionTool.h:819
egEnergyCorr::MaterialCategory
MaterialCategory
Definition: egammaEnergyCorrectionTool.h:363
AtlasRoot::egammaEnergyCorrectionTool::m_dX_IPAcc_Nom
std::unique_ptr< TH1 > m_dX_IPAcc_Nom
Definition: egammaEnergyCorrectionTool.h:686
asg::AsgMessaging::msg
MsgStream & msg() const
The standard message stream.
Definition: AsgMessaging.cxx:49
egEnergyCorr::es2012a
@ es2012a
Definition: egammaEnergyCorrectionTool.h:305
AtlasRoot::egammaEnergyCorrectionTool::m_applyPSCorrection
bool m_applyPSCorrection
Definition: egammaEnergyCorrectionTool.h:826
sign
int sign(int a)
Definition: TRT_StrawNeighbourSvc.h:107
AtlasRoot::egammaEnergyCorrectionTool::m_use_temp_correction201516
bool m_use_temp_correction201516
Definition: egammaEnergyCorrectionTool.h:839
AtlasRoot::egammaEnergyCorrectionTool::m_zeeNom_data2016
std::unique_ptr< TH1 > m_zeeNom_data2016
Definition: egammaEnergyCorrectionTool.h:659
AtlasRoot::egammaEnergyCorrectionTool::m_convertedBias_ConfigEpLp
std::unique_ptr< TH2 > m_convertedBias_ConfigEpLp
Definition: egammaEnergyCorrectionTool.h:789
AtlasRoot::egammaEnergyCorrectionTool::m_aPSNom
std::unique_ptr< TH1 > m_aPSNom
Definition: egammaEnergyCorrectionTool.h:651
egEnergyCorr::Scale::S12Down
@ S12Down
Definition: egammaEnergyCorrectionTool.h:186
egEnergyCorr::es2017_summer
@ es2017_summer
Definition: egammaEnergyCorrectionTool.h:320
AtlasRoot::egammaEnergyCorrectionTool::getAlphaLeakage
double getAlphaLeakage(double cl_eta, PATCore::ParticleType::Type ptype, egEnergyCorr::Scale::Variation var=egEnergyCorr::Scale::Nominal, double varSF=1.) const
Definition: egammaEnergyCorrectionTool.cxx:4642
makeComparison.rootFile
rootFile
Definition: makeComparison.py:27
egEnergyCorr::es2015c_summer
@ es2015c_summer
Definition: egammaEnergyCorrectionTool.h:317
AtlasRoot::egammaEnergyCorrectionTool::m_zeeFwdb
std::unique_ptr< const TH1 > m_zeeFwdb
Definition: egammaEnergyCorrectionTool.h:667
egEnergyCorr::Scale::G4Up
@ G4Up
Definition: egammaEnergyCorrectionTool.h:175
AtlasRoot::egammaEnergyCorrectionTool::nearestEtaBEC
static double nearestEtaBEC(double cl_eta)
Definition: egammaEnergyCorrectionTool.cxx:5003
AtlasRoot::egammaEnergyCorrectionTool::m_matElectronEtaBins
std::unique_ptr< TAxis > m_matElectronEtaBins
Definition: egammaEnergyCorrectionTool.h:771
AtlasRoot::egammaEnergyCorrectionTool::m_leakageConverted
std::unique_ptr< TH1 > m_leakageConverted
Definition: egammaEnergyCorrectionTool.h:736
egEnergyCorr::Scale::L2MediumGainUp
@ L2MediumGainUp
Definition: egammaEnergyCorrectionTool.h:227
egEnergyCorr::Scale::None
@ None
Definition: egammaEnergyCorrectionTool.h:129
TRT::Track::z0
@ z0
Definition: InnerDetector/InDetCalibEvent/TRT_CalibData/TRT_CalibData/TrackInfo.h:63
AtlasRoot::egammaEnergyCorrectionTool::m_G4OverAFII_converted_2D
std::unique_ptr< TH2 > m_G4OverAFII_converted_2D
Definition: egammaEnergyCorrectionTool.h:801
AtlasRoot::egammaEnergyCorrectionTool::m_convRadius
std::unique_ptr< TH1 > m_convRadius
Definition: egammaEnergyCorrectionTool.h:730
MuonR4::SegmentFit::ParamDefs::x0
@ x0
egEnergyCorr::Resolution::MaterialCryoDown
@ MaterialCryoDown
Definition: egammaEnergyCorrectionTool.h:83
egEnergyCorr::UNDEFINED
@ UNDEFINED
Definition: egammaEnergyCorrectionTool.h:344
egEnergyCorr::Scale::MatCaloUp
@ MatCaloUp
Definition: egammaEnergyCorrectionTool.h:219
GainTool.h
egEnergyCorr::MatCryo
@ MatCryo
Definition: egammaEnergyCorrectionTool.h:365
AtlasRoot::egammaEnergyCorrectionTool::m_pedestalL3
std::unique_ptr< TH1 > m_pedestalL3
Definition: egammaEnergyCorrectionTool.h:726
egEnergyCorr::ConfigGp
@ ConfigGp
Definition: egammaEnergyCorrectionTool.h:355
get_MaterialResolutionEffect.h
egEnergyCorr::Scale::ZeeStatDown
@ ZeeStatDown
Definition: egammaEnergyCorrectionTool.h:145
AtlasRoot::egammaEnergyCorrectionTool::m_zeeSystOFC
std::unique_ptr< TH1 > m_zeeSystOFC
Definition: egammaEnergyCorrectionTool.h:670
AtlasRoot::egammaEnergyCorrectionTool::m_EaccElectronGraphs
std::unique_ptr< TList > m_EaccElectronGraphs
Definition: egammaEnergyCorrectionTool.h:717
AtlasRoot::egammaEnergyCorrectionTool::m_electronBias_ConfigA
std::unique_ptr< TH2 > m_electronBias_ConfigA
Definition: egammaEnergyCorrectionTool.h:776
AtlasRoot::egammaEnergyCorrectionTool::m_gain_tool_run2
std::unique_ptr< egGain::GainUncertainty > m_gain_tool_run2
Definition: egammaEnergyCorrectionTool.h:476
egEnergyCorr::Scale::PedestalUp
@ PedestalUp
Definition: egammaEnergyCorrectionTool.h:233
DeMoScan.runnumber
runnumber
Definition: DeMoScan.py:264
AtlasRoot::egammaEnergyCorrectionTool::getMaterialNonLinearity
double getMaterialNonLinearity(double cl_eta, double energy, egEnergyCorr::MaterialCategory imat, PATCore::ParticleType::Type ptype, egEnergyCorr::Scale::Variation var=egEnergyCorr::Scale::Nominal, double varSF=1.) const
Definition: egammaEnergyCorrectionTool.cxx:4497
egEnergyCorr::Resolution::None
@ None
Definition: egammaEnergyCorrectionTool.h:59
AtlasRoot::egammaEnergyCorrectionTool::m_E4UnconvertedEtaBins
std::unique_ptr< TAxis > m_E4UnconvertedEtaBins
Definition: egammaEnergyCorrectionTool.h:704
egEnergyCorr::Resolution::PileUpDown
@ PileUpDown
Definition: egammaEnergyCorrectionTool.h:87
AtlasRoot::egammaEnergyCorrectionTool::m_convertedBias_ConfigFpMX
std::unique_ptr< TH2 > m_convertedBias_ConfigFpMX
Definition: egammaEnergyCorrectionTool.h:790
egEnergyCorr::Scale::E4ScintillatorUp
@ E4ScintillatorUp
Definition: egammaEnergyCorrectionTool.h:179
AtlasRoot::egammaEnergyCorrectionTool::m_G4OverAFII_converted
std::unique_ptr< TH1 > m_G4OverAFII_converted
Definition: egammaEnergyCorrectionTool.h:798
egEnergyCorr::Scale::S12EXTRARUN3Up
@ S12EXTRARUN3Up
Definition: egammaEnergyCorrectionTool.h:275
egEnergyCorr::Scale::ZeePhysDown
@ ZeePhysDown
Definition: egammaEnergyCorrectionTool.h:149
egEnergyCorr::Scale::Variation
Variation
Definition: egammaEnergyCorrectionTool.h:126
AtlasRoot::egammaEnergyCorrectionTool::resolutionError
void resolutionError(double energy, double cl_eta, double &errUp, double &errDown) const
Definition: egammaEnergyCorrectionTool.cxx:3096
AtlasRoot::egammaEnergyCorrectionTool::m_convRecoEfficiency_2D
std::unique_ptr< TH2 > m_convRecoEfficiency_2D
Definition: egammaEnergyCorrectionTool.h:734
MuonR4::SegmentFit::ParamDefs::y0
@ y0
egEnergyCorr::ConfigEL
@ ConfigEL
Definition: egammaEnergyCorrectionTool.h:353
AtlasRoot::egammaEnergyCorrectionTool::m_electronBias_ConfigN
std::unique_ptr< TH2 > m_electronBias_ConfigN
Definition: egammaEnergyCorrectionTool.h:779
PathResolver.h
AtlasRoot::egammaEnergyCorrectionTool::m_EaccUnconvertedEtaBins
std::unique_ptr< TAxis > m_EaccUnconvertedEtaBins
Definition: egammaEnergyCorrectionTool.h:718
AtlasRoot::egammaEnergyCorrectionTool::resolution
double resolution(double energy, double cl_eta, double cl_etaCalo, PATCore::ParticleType::Type ptype, bool withCT, bool fast, egEnergyCorr::Resolution::resolutionType resType=egEnergyCorr::Resolution::SigmaEff90) const
Definition: egammaEnergyCorrectionTool.cxx:3135
AtlasRoot::egammaEnergyCorrectionTool::m_pedestalL0
std::unique_ptr< TH1 > m_pedestalL0
Definition: egammaEnergyCorrectionTool.h:723
AtlasRoot::egammaEnergyCorrectionTool::m_daPSCor
std::unique_ptr< TH1 > m_daPSCor
Definition: egammaEnergyCorrectionTool.h:652
AtlasRoot
Definition: egammaEnergyCorrectionTool.h:371
egEnergyCorr::Scale::LArCalibExtra2015PreUp
@ LArCalibExtra2015PreUp
Definition: egammaEnergyCorrectionTool.h:165
AtlasRoot::egammaEnergyCorrectionTool::m_convertedBias_ConfigIBL
std::unique_ptr< TH2 > m_convertedBias_ConfigIBL
Definition: egammaEnergyCorrectionTool.h:792
AtlasRoot::egammaEnergyCorrectionTool::m_useLeakageCorrection
bool m_useLeakageCorrection
Definition: egammaEnergyCorrectionTool.h:835
AtlasRoot::egammaEnergyCorrectionTool::getAlphaConvSyst
double getAlphaConvSyst(double cl_eta, double energy, PATCore::ParticleType::Type ptype, egEnergyCorr::Scale::Variation var=egEnergyCorr::Scale::Nominal, double varSF=1.) const
Definition: egammaEnergyCorrectionTool.cxx:4800
VP1PartSpect::E
@ E
Definition: VP1PartSpectFlags.h:21
egEnergyCorr::Resolution::MaterialIBLUp
@ MaterialIBLUp
Definition: egammaEnergyCorrectionTool.h:91
egEnergyCorr::Resolution::Variation
Variation
Definition: egammaEnergyCorrectionTool.h:55
AtlasRoot::egammaEnergyCorrectionTool::m_psUnconvertedGraphs
std::unique_ptr< TList > m_psUnconvertedGraphs
Definition: egammaEnergyCorrectionTool.h:698
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:76
egEnergyCorr::es2016PRE
@ es2016PRE
Definition: egammaEnergyCorrectionTool.h:318
egEnergyCorr::MatID
@ MatID
Definition: egammaEnergyCorrectionTool.h:364
AtlasRoot::egammaEnergyCorrectionTool::m_pedestalL2
std::unique_ptr< TH1 > m_pedestalL2
Definition: egammaEnergyCorrectionTool.h:725
egEnergyCorr::es2017_summer_final
@ es2017_summer_final
Definition: egammaEnergyCorrectionTool.h:322
AtlasRoot::egammaEnergyCorrectionTool::m_gain_tool_run3_extra
std::unique_ptr< egGain::GainUncertainty > m_gain_tool_run3_extra
Definition: egammaEnergyCorrectionTool.h:478
AtlasRoot::egammaEnergyCorrectionTool::getMaterialEffect
double getMaterialEffect(egEnergyCorr::Geometry geo, PATCore::ParticleType::Type ptype, double cl_eta, double ET) const
Definition: egammaEnergyCorrectionTool.cxx:4402
egGain::GainUncertainty::GainType::LOW
@ LOW
egEnergyCorr::Scale::ADCLinUp
@ ADCLinUp
Definition: egammaEnergyCorrectionTool.h:193
egEnergyCorr::Scale::ZeeAllDown
@ ZeeAllDown
Definition: egammaEnergyCorrectionTool.h:151
egEnergyCorr::Resolution::OFCUp
@ OFCUp
Definition: egammaEnergyCorrectionTool.h:101
egEnergyCorr::Scale::MatPP0Up
@ MatPP0Up
Definition: egammaEnergyCorrectionTool.h:241
egEnergyCorr::es2012XX
@ es2012XX
Definition: egammaEnergyCorrectionTool.h:312
egEnergyCorr::Scale::ADCLinDown
@ ADCLinDown
Definition: egammaEnergyCorrectionTool.h:194
SCT_CalibAlgs::nbins
@ nbins
Definition: SCT_CalibNumbers.h:10
egEnergyCorr::Scale::S12ExtraLastEtaBinRun2Down
@ S12ExtraLastEtaBinRun2Down
Definition: egammaEnergyCorrectionTool.h:212
egEnergyCorr::ConfigFMX
@ ConfigFMX
Definition: egammaEnergyCorrectionTool.h:354
egEnergyCorr::es2023_R22_Run2_v0
@ es2023_R22_Run2_v0
Definition: egammaEnergyCorrectionTool.h:339
egEnergyCorr::es2012c
@ es2012c
Definition: egammaEnergyCorrectionTool.h:307
egEnergyCorr::Resolution::OFCDown
@ OFCDown
Definition: egammaEnergyCorrectionTool.h:102
egEnergyCorr::Scale::PSb12Down
@ PSb12Down
Definition: egammaEnergyCorrectionTool.h:190
egEnergyCorr::es2017
@ es2017
Definition: egammaEnergyCorrectionTool.h:319
egEnergyCorr::es2018_R21_v1
@ es2018_R21_v1
Definition: egammaEnergyCorrectionTool.h:335
AtlasRoot::egammaEnergyCorrectionTool::m_resSystOFC
std::unique_ptr< TH1 > m_resSystOFC
Definition: egammaEnergyCorrectionTool.h:677
PathResolverFindCalibFile
std::string PathResolverFindCalibFile(const std::string &logical_file_name)
Definition: PathResolver.cxx:283
AtlasRoot::egammaEnergyCorrectionTool::m_zeeNom_data2022
std::unique_ptr< TH1 > m_zeeNom_data2022
Definition: egammaEnergyCorrectionTool.h:662
AtlasRoot::egammaEnergyCorrectionTool::getSmearingCorrection
double getSmearingCorrection(double eta, double etaCalo, double energy, RandomNumber seed, PATCore::ParticleType::Type ptype=PATCore::ParticleType::Electron, PATCore::ParticleDataType::DataType dataType=PATCore::ParticleDataType::Full, egEnergyCorr::Resolution::Variation value=egEnergyCorr::Resolution::Nominal, egEnergyCorr::Resolution::resolutionType resType=egEnergyCorr::Resolution::SigmaEff90) const
smearing corrections
Definition: egammaEnergyCorrectionTool.cxx:3279
AtlasRoot::egammaEnergyCorrectionTool::m_pp0_conv
std::unique_ptr< TH2 > m_pp0_conv
Definition: egammaEnergyCorrectionTool.h:744
AtlasRoot::egammaEnergyCorrectionTool::m_matConvertedScale
std::vector< std::unique_ptr< TH1 > > m_matConvertedScale
Definition: egammaEnergyCorrectionTool.h:765
AtlasRoot::egammaEnergyCorrectionTool::m_useL2GainInterpolation
bool m_useL2GainInterpolation
Definition: egammaEnergyCorrectionTool.h:834
ReadCellNoiseFromCoolCompare.v2
v2
Definition: ReadCellNoiseFromCoolCompare.py:364
AtlasRoot::egammaEnergyCorrectionTool::mcSamplingTerm
static double mcSamplingTerm(double cl_eta)
Definition: egammaEnergyCorrectionTool.cxx:2851
python.AthDsoLogger.fname
string fname
Definition: AthDsoLogger.py:66
fast
bool fast
Definition: TrigGlobEffCorrValidation.cxx:190
egEnergyCorr::Scale::LArUnconvCalibDown
@ LArUnconvCalibDown
Definition: egammaEnergyCorrectionTool.h:158
python.PyAthena.v
v
Definition: PyAthena.py:154
egEnergyCorr::Scale::ConvEfficiencyUp
@ ConvEfficiencyUp
Definition: egammaEnergyCorrectionTool.h:252
egEnergyCorr::Scale::PSb12Up
@ PSb12Up
Definition: egammaEnergyCorrectionTool.h:189
AtlasRoot::egammaEnergyCorrectionTool::m_G4OverAFII_resolution_electron
std::unique_ptr< TH2 > m_G4OverAFII_resolution_electron
Definition: egammaEnergyCorrectionTool.h:805
AtlasRoot::egammaEnergyCorrectionTool::m_getMaterialDelta
std::unique_ptr< get_MaterialResolutionEffect > m_getMaterialDelta
Definition: egammaEnergyCorrectionTool.h:481
egEnergyCorr::Scale::E4ScintillatorDown
@ E4ScintillatorDown
Definition: egammaEnergyCorrectionTool.h:180
AtlasRoot::egammaEnergyCorrectionTool::m_pedestals_es2017
std::unique_ptr< TH1 > m_pedestals_es2017
Definition: egammaEnergyCorrectionTool.h:728
egEnergyCorr::Resolution::MaterialIDDown
@ MaterialIDDown
Definition: egammaEnergyCorrectionTool.h:77
egEnergyCorr::Scale::ConvFakeRateUp
@ ConvFakeRateUp
Definition: egammaEnergyCorrectionTool.h:254
AtlasRoot::egammaEnergyCorrectionTool::m_convRecoEfficiency
std::unique_ptr< TH1 > m_convRecoEfficiency
Definition: egammaEnergyCorrectionTool.h:732
a
TList * a
Definition: liststreamerinfos.cxx:10
egEnergyCorr::Resolution::MaterialIDUp
@ MaterialIDUp
Definition: egammaEnergyCorrectionTool.h:78
AtlasRoot::egammaEnergyCorrectionTool::m_EaccElectronEtaBins
std::unique_ptr< TAxis > m_EaccElectronEtaBins
Definition: egammaEnergyCorrectionTool.h:716
AtlasRoot::egammaEnergyCorrectionTool::m_wstot_pT_data_p1_converted_photons
std::unique_ptr< TH1 > m_wstot_pT_data_p1_converted_photons
Definition: egammaEnergyCorrectionTool.h:753
egEnergyCorr::Scale::Wtots1Down
@ Wtots1Down
Definition: egammaEnergyCorrectionTool.h:238
egEnergyCorr::Scale::PSUp
@ PSUp
Definition: egammaEnergyCorrectionTool.h:183
y
#define y
h
AtlasRoot::egammaEnergyCorrectionTool::m_peakResMC
std::unique_ptr< TH1 > m_peakResMC
Definition: egammaEnergyCorrectionTool.h:679
python.CaloAddPedShiftConfig.int
int
Definition: CaloAddPedShiftConfig.py:45
AtlasRoot::egammaEnergyCorrectionTool::m_G4OverFrSh
std::unique_ptr< TH1 > m_G4OverFrSh
Definition: egammaEnergyCorrectionTool.h:803
AtlasRoot::egammaEnergyCorrectionTool::getCorrectedMomentum
double getCorrectedMomentum(PATCore::ParticleDataType::DataType dataType, PATCore::ParticleType::Type ptype, double momentum, double trk_eta, egEnergyCorr::Scale::Variation scaleVar=egEnergyCorr::Scale::None, double varSF=1.0) const
take eta and uncorrected energy of electron, return corrected energy, apply given variation,...
Definition: egammaEnergyCorrectionTool.cxx:2094
egEnergyCorr::es2017_summer_improved
@ es2017_summer_improved
Definition: egammaEnergyCorrectionTool.h:321
AtlasRoot::egammaEnergyCorrectionTool::dataConstantTermCorError
double dataConstantTermCorError(double cl_eta) const
Definition: egammaEnergyCorrectionTool.cxx:2957
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
AtlasRoot::egammaEnergyCorrectionTool::m_zeeNom_data2023
std::unique_ptr< TH1 > m_zeeNom_data2023
Definition: egammaEnergyCorrectionTool.h:663
egEnergyCorr::Scale::LArElecCalibDown
@ LArElecCalibDown
Definition: egammaEnergyCorrectionTool.h:160
AtlasRoot::egammaEnergyCorrectionTool::egammaEnergyCorrectionTool
egammaEnergyCorrectionTool()
Definition: egammaEnergyCorrectionTool.cxx:181
AtlasRoot::egammaEnergyCorrectionTool::m_zeeNom
std::unique_ptr< TH1 > m_zeeNom
Definition: egammaEnergyCorrectionTool.h:657
egEnergyCorr::Scale::ZeeAllUp
@ ZeeAllUp
Definition: egammaEnergyCorrectionTool.h:150
LArCellConditions.geo
bool geo
Definition: LArCellConditions.py:46
AtlasRoot::egammaEnergyCorrectionTool::m_E4UnconvertedGraphs
std::unique_ptr< TList > m_E4UnconvertedGraphs
Definition: egammaEnergyCorrectionTool.h:705
egEnergyCorr::es2011dTight
@ es2011dTight
Definition: egammaEnergyCorrectionTool.h:303
egEnergyCorr::Resolution::LastResolutionVariation
@ LastResolutionVariation
Definition: egammaEnergyCorrectionTool.h:105
AtlasRoot::egammaEnergyCorrectionTool::m_ADCLinearity_tool
std::shared_ptr< LinearityADC > m_ADCLinearity_tool
Definition: egammaEnergyCorrectionTool.h:479
AtlasRoot::egammaEnergyCorrectionTool::m_wstot_pT_MC_p0_electrons
std::unique_ptr< TH1 > m_wstot_pT_MC_p0_electrons
Definition: egammaEnergyCorrectionTool.h:754
AtlasRoot::egammaEnergyCorrectionTool::m_G4OverAFII_unconverted
std::unique_ptr< TH1 > m_G4OverAFII_unconverted
Definition: egammaEnergyCorrectionTool.h:799
dq_defect_virtual_defect_validation.d2
d2
Definition: dq_defect_virtual_defect_validation.py:81
egEnergyCorr::es2024_Run3_ofc0_v0
@ es2024_Run3_ofc0_v0
Definition: egammaEnergyCorrectionTool.h:341
egEnergyCorr::Resolution::MaterialCaloUp
@ MaterialCaloUp
Definition: egammaEnergyCorrectionTool.h:80
AtlasRoot::egammaEnergyCorrectionTool::m_electronBias_ConfigPP0
std::unique_ptr< TH2 > m_electronBias_ConfigPP0
Definition: egammaEnergyCorrectionTool.h:781
AtlasRoot::egammaEnergyCorrectionTool::getAlphaUncAlpha
std::pair< double, double > getAlphaUncAlpha(const TH1 &hh, double cl_eta, double et, bool useInterp) const
Definition: egammaEnergyCorrectionTool.cxx:4758
egEnergyCorr::Resolution::SamplingTermDown
@ SamplingTermDown
Definition: egammaEnergyCorrectionTool.h:73
AtlasRoot::egammaEnergyCorrectionTool::m_wstot_pT_data_p0_converted_photons
std::unique_ptr< TH1 > m_wstot_pT_data_p0_converted_photons
Definition: egammaEnergyCorrectionTool.h:752
AtlasRoot::egammaEnergyCorrectionTool::m_wstot_slope_A_data
std::unique_ptr< TH1 > m_wstot_slope_A_data
Definition: egammaEnergyCorrectionTool.h:746
AtlasRoot::egammaEnergyCorrectionTool::m_G4OverAFII_electron
std::unique_ptr< TH1 > m_G4OverAFII_electron
Definition: egammaEnergyCorrectionTool.h:797
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
AtlasRoot::egammaEnergyCorrectionTool::m_G4OverAFII_electron_2D
std::unique_ptr< TH2 > m_G4OverAFII_electron_2D
Definition: egammaEnergyCorrectionTool.h:800
AtlasRoot::egammaEnergyCorrectionTool::initialize
int initialize()
Definition: egammaEnergyCorrectionTool.cxx:238
egEnergyCorr::Scale::afDown
@ afDown
Definition: egammaEnergyCorrectionTool.h:246
AtlasRoot::egammaEnergyCorrectionTool::dataConstantTermError
double dataConstantTermError(double eta) const
Definition: egammaEnergyCorrectionTool.cxx:2931
AtlasRoot::egammaEnergyCorrectionTool::m_dX_IPAcc_G4
std::unique_ptr< TH1 > m_dX_IPAcc_G4
Definition: egammaEnergyCorrectionTool.h:687
LArNewCalib_DelayDump_OFC_Cali.idx
idx
Definition: LArNewCalib_DelayDump_OFC_Cali.py:69
AtlasRoot::egammaEnergyCorrectionTool::m_wstot_pT_MC_p1_unconverted_photons
std::unique_ptr< TH1 > m_wstot_pT_MC_p1_unconverted_photons
Definition: egammaEnergyCorrectionTool.h:757
egEnergyCorr::Scale::L2MediumGainDown
@ L2MediumGainDown
Definition: egammaEnergyCorrectionTool.h:228
AtlasRoot::egammaEnergyCorrectionTool::m_useL2GainCorrection
bool m_useL2GainCorrection
Definition: egammaEnergyCorrectionTool.h:833
egEnergyCorr::Resolution::MaterialGapDown
@ MaterialGapDown
Definition: egammaEnergyCorrectionTool.h:81
AtlasRoot::egammaEnergyCorrectionTool::m_G4OverAF_electron_scale_extra_sys
std::unique_ptr< TH1 > m_G4OverAF_electron_scale_extra_sys
Definition: egammaEnergyCorrectionTool.h:810
egEnergyCorr::es2017_R21_ofc0_v1
@ es2017_R21_ofc0_v1
Definition: egammaEnergyCorrectionTool.h:332
AtlasRoot::egammaEnergyCorrectionTool::dataConstantTermOFCError
double dataConstantTermOFCError(double eta) const
Definition: egammaEnergyCorrectionTool.cxx:2935
egEnergyCorr::Scale::ZeePhysUp
@ ZeePhysUp
Definition: egammaEnergyCorrectionTool.h:148
AtlasRoot::egammaEnergyCorrectionTool::m_s12UnconvertedEtaBins
std::unique_ptr< TAxis > m_s12UnconvertedEtaBins
Definition: egammaEnergyCorrectionTool.h:711
egEnergyCorr::ConfigA
@ ConfigA
Definition: egammaEnergyCorrectionTool.h:351
egEnergyCorr::Scale::EXTRARUN3PREUp
@ EXTRARUN3PREUp
Definition: egammaEnergyCorrectionTool.h:269
AtlasRoot::egammaEnergyCorrectionTool::applyFStoG4
double applyFStoG4(double eta) const
Definition: egammaEnergyCorrectionTool.cxx:3441
egEnergyCorr::Scale::LArTemperature2016PreDown
@ LArTemperature2016PreDown
Definition: egammaEnergyCorrectionTool.h:172
egEnergyCorr::Resolution::resolutionType
resolutionType
Definition: egammaEnergyCorrectionTool.h:110
egEnergyCorr::es2022_R22_PRE
@ es2022_R22_PRE
Definition: egammaEnergyCorrectionTool.h:338
AtlasRoot::egammaEnergyCorrectionTool::getCorrectedEnergy
double getCorrectedEnergy(unsigned int runnumber, PATCore::ParticleDataType::DataType dataType, PATCore::ParticleType::Type ptype, double cl_eta, double cl_etaS2, double cl_etaCalo, double energy, double energyS2, double eraw, RandomNumber seed, egEnergyCorr::Scale::Variation scaleVar=egEnergyCorr::Scale::None, egEnergyCorr::Resolution::Variation resVar=egEnergyCorr::Resolution::None, egEnergyCorr::Resolution::resolutionType resType=egEnergyCorr::Resolution::SigmaEff90, double varSF=1.0) const
Definition: egammaEnergyCorrectionTool.cxx:2119
egEnergyCorr::Scale::PedestalDown
@ PedestalDown
Definition: egammaEnergyCorrectionTool.h:234
AtlasRoot::egammaEnergyCorrectionTool::m_trkSyst
std::unique_ptr< TH1 > m_trkSyst
Definition: egammaEnergyCorrectionTool.h:649
egEnergyCorr::Scale::ConvRadiusDown
@ ConvRadiusDown
Definition: egammaEnergyCorrectionTool.h:257
egEnergyCorr::Scale::LArCalibDown
@ LArCalibDown
Definition: egammaEnergyCorrectionTool.h:156
PATCore::ParticleType::Electron
@ Electron
Definition: PATCoreEnums.h:40
PATCore::ParticleDataType::FastShower
@ FastShower
Definition: PATCoreEnums.h:22
AtlasRoot::egammaEnergyCorrectionTool::m_electronBias_ConfigFpMX
std::unique_ptr< TH2 > m_electronBias_ConfigFpMX
Definition: egammaEnergyCorrectionTool.h:778
AtlasRoot::egammaEnergyCorrectionTool::m_zeeNom_data2017
std::unique_ptr< TH1 > m_zeeNom_data2017
Definition: egammaEnergyCorrectionTool.h:660
AtlasRoot::egammaEnergyCorrectionTool::m_convertedBias_ConfigN
std::unique_ptr< TH2 > m_convertedBias_ConfigN
Definition: egammaEnergyCorrectionTool.h:791
AtlasRoot::egammaEnergyCorrectionTool::getZeeMeanET
double getZeeMeanET(double cl_eta) const
Definition: egammaEnergyCorrectionTool.cxx:2833
egEnergyCorr::Scale::S12EXTRARUN3Down
@ S12EXTRARUN3Down
Definition: egammaEnergyCorrectionTool.h:276
AtlasRoot::egammaEnergyCorrectionTool::m_dX_IPAcc_LAr
std::unique_ptr< TH1 > m_dX_IPAcc_LAr
Definition: egammaEnergyCorrectionTool.h:688
AtlasRoot::egammaEnergyCorrectionTool::m_electronBias_ConfigEpLp
std::unique_ptr< TH2 > m_electronBias_ConfigEpLp
Definition: egammaEnergyCorrectionTool.h:777
AtlasRoot::egammaEnergyCorrectionTool::m_electronBias_ConfigIBL
std::unique_ptr< TH2 > m_electronBias_ConfigIBL
Definition: egammaEnergyCorrectionTool.h:780
plotBeamSpotCompare.histo
histo
Definition: plotBeamSpotCompare.py:414
AtlasRoot::egammaEnergyCorrectionTool::m_use_temp_correction201215
bool m_use_temp_correction201215
Definition: egammaEnergyCorrectionTool.h:838
python.PyAthena.obj
obj
Definition: PyAthena.py:132
pow
constexpr int pow(int base, int exp) noexcept
Definition: ap_fixedTest.cxx:15
AtlasRoot::egammaEnergyCorrectionTool::m_unconvertedBias_ConfigA
std::unique_ptr< TH2 > m_unconvertedBias_ConfigA
Definition: egammaEnergyCorrectionTool.h:782
egEnergyCorr::Scale::MatCryoUp
@ MatCryoUp
Definition: egammaEnergyCorrectionTool.h:217
AtlasRoot::egammaEnergyCorrectionTool::m_matElectronGraphs
std::vector< std::unique_ptr< TList > > m_matElectronGraphs
Definition: egammaEnergyCorrectionTool.h:772
AtlasRoot::egammaEnergyCorrectionTool::~egammaEnergyCorrectionTool
virtual ~egammaEnergyCorrectionTool()
Definition: egammaEnergyCorrectionTool.cxx:233
AtlasRoot::egammaEnergyCorrectionTool::m_G4OverAFII_unconverted_2D
std::unique_ptr< TH2 > m_G4OverAFII_unconverted_2D
Definition: egammaEnergyCorrectionTool.h:802
python.compressB64.c
def c
Definition: compressB64.py:93
egEnergyCorr::es2015_5TeV
@ es2015_5TeV
Definition: egammaEnergyCorrectionTool.h:324
egEnergyCorr::Resolution::AllUp
@ AllUp
Definition: egammaEnergyCorrectionTool.h:66
egEnergyCorr::Resolution::MaterialCaloDown
@ MaterialCaloDown
Definition: egammaEnergyCorrectionTool.h:79
AtlasRoot::egammaEnergyCorrectionTool::m_G4OverAFII_resolution_converted
std::unique_ptr< TH2 > m_G4OverAFII_resolution_converted
Definition: egammaEnergyCorrectionTool.h:807
AtlasRoot::egammaEnergyCorrectionTool::getLayerUncertainty
double getLayerUncertainty(int iLayer, double cl_eta, egEnergyCorr::Scale::Variation var=egEnergyCorr::Scale::Nominal, double varSF=1.) const
Definition: egammaEnergyCorrectionTool.cxx:3895
egEnergyCorr::Scale::S12ExtraLastEtaBinRun2Up
@ S12ExtraLastEtaBinRun2Up
Definition: egammaEnergyCorrectionTool.h:211
AtlasRoot::egammaEnergyCorrectionTool::m_convertedBias_ConfigPP0
std::unique_ptr< TH2 > m_convertedBias_ConfigPP0
Definition: egammaEnergyCorrectionTool.h:793
AtlasRoot::egammaEnergyCorrectionTool::m_daPSb12
std::unique_ptr< TH1 > m_daPSb12
Definition: egammaEnergyCorrectionTool.h:653
AtlasRoot::egammaEnergyCorrectionTool::getLayerPedestal
double getLayerPedestal(double cl_eta, PATCore::ParticleType::Type ptype, int iLayer, egEnergyCorr::Scale::Variation var=egEnergyCorr::Scale::Nominal, double varSF=1.) const
Definition: egammaEnergyCorrectionTool.cxx:4965
egEnergyCorr::es2018_R21_v0
@ es2018_R21_v0
Definition: egammaEnergyCorrectionTool.h:334
egEnergyCorr::es2015PRE
@ es2015PRE
Definition: egammaEnergyCorrectionTool.h:313
AtlasRoot::egammaEnergyCorrectionTool::m_zeeSyst
std::unique_ptr< TH1 > m_zeeSyst
Definition: egammaEnergyCorrectionTool.h:669
AtlasRoot::egammaEnergyCorrectionTool::dataZPeakResolution
double dataZPeakResolution(double cl_eta) const
Definition: egammaEnergyCorrectionTool.cxx:2941
AtlasRoot::egammaEnergyCorrectionTool::applyMCCalibration
double applyMCCalibration(double eta, double ET, PATCore::ParticleType::Type ptype) const
Definition: egammaEnergyCorrectionTool.cxx:3350
AtlasRoot::egammaEnergyCorrectionTool::getAlphaUncertainty
double getAlphaUncertainty(long int runnumber, double cl_eta, double cl_etaS2, double cl_etaCalo, double energy, double energyS2, double eraw, PATCore::ParticleType::Type ptype=PATCore::ParticleType::Electron, egEnergyCorr::Scale::Variation var=egEnergyCorr::Scale::Nominal, double varSF=1.) const
Definition: egammaEnergyCorrectionTool.cxx:2749
WriteCellNoiseToCool.noise
noise
Definition: WriteCellNoiseToCool.py:380
AtlasRoot::egammaEnergyCorrectionTool::m_dX_PSAcc_G4
std::unique_ptr< TH1 > m_dX_PSAcc_G4
Definition: egammaEnergyCorrectionTool.h:692
egEnergyCorr
Definition: egammaEnergyCorrectionTool.h:44
AtlasRoot::egammaEnergyCorrectionTool::get_OFCSyst
double get_OFCSyst(double eta) const
Definition: egammaEnergyCorrectionTool.cxx:5671
egEnergyCorr::Scale::topoClusterThresDown
@ topoClusterThresDown
Definition: egammaEnergyCorrectionTool.h:208
egEnergyCorr::Resolution::MaterialIBLDown
@ MaterialIBLDown
Definition: egammaEnergyCorrectionTool.h:92
AtlasRoot::egammaEnergyCorrectionTool::m_E4ElectronEtaBins
std::unique_ptr< TAxis > m_E4ElectronEtaBins
Definition: egammaEnergyCorrectionTool.h:702
egEnergyCorr::Scale::LArUnconvCalibUp
@ LArUnconvCalibUp
Definition: egammaEnergyCorrectionTool.h:157
AtlasRoot::egammaEnergyCorrectionTool::m_E4ElectronGraphs
std::unique_ptr< TList > m_E4ElectronGraphs
Definition: egammaEnergyCorrectionTool.h:703
AtlasRoot::egammaEnergyCorrectionTool::m_zeeNom_data2018
std::unique_ptr< TH1 > m_zeeNom_data2018
Definition: egammaEnergyCorrectionTool.h:661
egEnergyCorr::Resolution::AllDown
@ AllDown
Definition: egammaEnergyCorrectionTool.h:65
AtlasRoot::egammaEnergyCorrectionTool::m_dX_IPAcc_GL1
std::unique_ptr< TH1 > m_dX_IPAcc_GL1
Definition: egammaEnergyCorrectionTool.h:689