ATLAS Offline Software
egammaLayerRecalibTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include <iostream>
6 #include <exception>
7 #include <cassert>
8 #include <string>
9 #include <map>
10 #include <sstream>
11 #include <algorithm>
12 #include <cmath>
13 #include <limits>
14 
15 #include <TFile.h>
16 #include <TObjString.h>
17 
19 
21 
22 namespace {
23 const float VALUE_OVERFLOW = std::numeric_limits<float>::max();
24 
25 template <typename TargetPtr, typename SourcePtr>
26 TargetPtr checked_cast(SourcePtr ptr) {
27  // Do we have ptr types
29  "attempt to cast to no ptr object");
31  "attempt to cast from no ptr object");
32 
33  // nullptr input
34  if (!ptr) {
35  throw std::runtime_error(
36  "Attempt to cast from nullptr in egammaLayerRecalibTool");
37  }
38 
39  // dynamic_cast and check
40  TargetPtr obj = dynamic_cast<TargetPtr>(ptr);
41  if (not obj) {
42  throw std::runtime_error("failed dynamic cast for " +
43  std::string(ptr->GetName()) +
44  " in egammaLayerRecalibTool");
45  }
46 
47  return obj;
48 }
49 
50 } // end anonymous namespace
51 
53  const int bin = m_histo->FindFixBin(input.eta);
54  if (m_histo->IsBinUnderflow(bin) or m_histo->IsBinOverflow(bin)) return VALUE_OVERFLOW;
55  return m_histo->GetBinContent(bin);
56 }
57 
59  const int bin = m_histo->FindFixBin(input.eta);
60  if (m_histo->IsBinUnderflow(bin) or m_histo->IsBinOverflow(bin)) return VALUE_OVERFLOW;
61  return m_histo->GetBinContent(bin) + m_histo->GetBinError(bin);
62 }
63 
65  const int bin = m_histo->FindFixBin(input.eta);
66  if (m_histo->IsBinUnderflow(bin) or m_histo->IsBinOverflow(bin)) return VALUE_OVERFLOW;
67  return m_histo->GetBinContent(bin) - m_histo->GetBinError(bin);
68 }
69 
71  const int bin = m_histo->FindFixBin(input.eta);
72  if (m_histo->IsBinUnderflow(bin) or m_histo->IsBinOverflow(bin)) return VALUE_OVERFLOW;
73  return m_histo->GetBinError(bin);
74 }
75 
77  const int bin = m_histo->FindFixBin(input.eta);
78  if (m_histo->IsBinUnderflow(bin) or m_histo->IsBinOverflow(bin)) return VALUE_OVERFLOW;
79  return -m_histo->GetBinError(bin);
80 }
81 
83  const int bin = m_histo.FindFixBin(input.eta, input.phi);
84  if (m_histo.IsBinUnderflow(bin) or m_histo.IsBinOverflow(bin)) return VALUE_OVERFLOW;
85  return m_histo.GetBinContent(bin);
86 }
87 
88 float GetAmountFixed::operator()(const StdCalibrationInputs & /*input*/ ) const {
89  return m_amount;
90 }
91 
93  return m_formula.Eval(input.eta, input.phi, input.RunNumber);
94 }
95 
97  return m_tool.getCorr(input.RunNumber, input.eta, input.phi);
98 }
99 
101  return m_toolEMECPS.getCorr(input.RunNumber, input.eta, input.phi);
102 }
103 
105  return m_tool->getCorr(0, input.RunNumber, input.averageInteractionsPerCrossing, input.eta);
106 }
107 
109  return m_tool->getCorr(1, input.RunNumber, input.averageInteractionsPerCrossing, input.eta);
110 }
111 
113  return m_tool->getCorr(2, input.RunNumber, input.averageInteractionsPerCrossing, input.eta);
114 }
115 
117  return m_tool->getCorr(3, input.RunNumber, input.averageInteractionsPerCrossing, input.eta);
118 }
119 
120 
122 {
123  if (amount == VALUE_OVERFLOW) return CP::CorrectionCode::OutOfValidityRange;
124  switch (m_base)
125  {
126  case SHIFT: shift_inputs(inputs, amount); return CP::CorrectionCode::Ok;
127  case SUBTRACT: shift_inputs(inputs, -amount); return CP::CorrectionCode::Ok;
128  case SCALE: scale_inputs(inputs, amount); return CP::CorrectionCode::Ok;
129  case ZEROBASED: scale_inputs(inputs, 1. + amount); return CP::CorrectionCode::Ok;
130  case ONEBASED: scale_inputs(inputs, amount); return CP::CorrectionCode::Ok;
131  case ONEBASED_ALPHA: scale_inputs(inputs, 1. / amount); return CP::CorrectionCode::Ok;
132  case ZEROBASED_ALPHA: scale_inputs(inputs, 1. / (1. + amount)); return CP::CorrectionCode::Ok;
133  default: return CP::CorrectionCode::Error;
134  };
135 }
136 
137 void ScaleE0::scale_inputs(StdCalibrationInputs & inputs, float amount) const { inputs.E0raw *= amount; }
138 void ScaleE1::scale_inputs(StdCalibrationInputs & inputs, float amount) const { inputs.E1raw *= amount; }
139 void ScaleE2::scale_inputs(StdCalibrationInputs & inputs, float amount) const { inputs.E2raw *= amount; }
140 void ScaleE3::scale_inputs(StdCalibrationInputs & inputs, float amount) const { inputs.E3raw *= amount; }
141 
142 void ScaleE0::shift_inputs(StdCalibrationInputs & inputs, float amount) const { inputs.E0raw += amount; }
143 void ScaleE1::shift_inputs(StdCalibrationInputs & inputs, float amount) const { inputs.E1raw += amount; }
144 void ScaleE2::shift_inputs(StdCalibrationInputs & inputs, float amount) const { inputs.E2raw += amount; }
145 void ScaleE3::shift_inputs(StdCalibrationInputs & inputs, float amount) const { inputs.E3raw += amount; }
146 
147 
149 {
150  const double Es1 = inputs.E1raw;
151  const double Es2 = inputs.E2raw;
152  if (Es1 == 0 and Es2 == 0) {
153  inputs.E1raw = -999;
154  inputs.E2raw = -999;
155  return;
156  }
157  const double sum = Es1 + Es2;
158  const double alpha = amount;
159  const double den = (alpha * Es1 + Es2);
160  inputs.E1raw = alpha * Es1 * sum / den;
161  inputs.E2raw = Es2 * sum / den;
162 }
163 
165 {
166  // not very useful, never used
167  throw std::runtime_error("not implemented");
168 }
169 
171 {
172  inputs.E1raw *= amount;
173  inputs.E2raw *= amount;
174  inputs.E3raw *= amount;
175 }
176 
178 {
179  inputs.E1raw += amount;
180  inputs.E2raw += amount;
181  inputs.E3raw += amount;
182 }
183 
185 {
186  inputs.E0raw *= amount;
187  inputs.E1raw *= amount;
188  inputs.E2raw *= amount;
189  inputs.E3raw *= amount;
190 }
191 
193 {
194  inputs.E0raw += amount;
195  inputs.E1raw += amount;
196  inputs.E2raw += amount;
197  inputs.E3raw += amount;
198 }
199 
200 std::string egammaLayerRecalibTool::resolve_alias(const std::string& tune) {
201 
202  if ("layer1_2012" == tune) return "layer1_2012_v5";
203  if ("layer1_alt_2012" == tune) return "layer1_alt_2012_v5";
204  if ("layer1_2011" == tune) return "layer1_2011_v5";
205  if ("layer1_alt_2011" == tune) return "layer1_alt_2011_v5";
206  if ("layer1_2010" == tune) return "layer1_2010_v5";
207  if ("ps_2012" == tune) return "ps_2012_v3";
208  if ("ps_2011" == tune) return "ps_2011_v3";
209  if ("ps_2010" == tune) return "ps_2010_v3";
210  if ("layer1_2012_up" == tune) return "layer1_2012_v5_up";
211  if ("layer1_2012_down" == tune) return "layer1_2012_v5_down";
212  if ("layer1_2012_errup" == tune) return "layer1_2012_v5_errup";
213  if ("layer1_2012_errdown" == tune) return "layer1_2012_v5_errdown";
214  if ("layer1_2011_up" == tune) return "layer1_2011_v5_up";
215  if ("layer1_2011_down" == tune) return "layer1_2011_v5_down";
216  if ("layer1_2011_errup" == tune) return "layer1_2011_v5_errup";
217  if ("layer1_2011_errdown" == tune) return "layer1_2011_v5_errdown";
218  if ("layer1_2010_up" == tune) return "layer1_2010_v5_up";
219  if ("layer1_2010_down" == tune) return "layer1_2010_v5_down";
220  if ("layer1_2010_errup" == tune) return "layer1_2010_v5_errup";
221  if ("layer1_2010_errdown" == tune) return "layer1_2010_v5_errdown";
222  if ("ps_2012_up" == tune) return "ps_2012_v3_up";
223  if ("ps_2012_down" == tune) return "ps_2012_v3_down";
224  if ("ps_2012_errup" == tune) return "ps_2012_v3_errup";
225  if ("ps_2012_errdown" == tune) return "ps_2012_v3_errdown";
226  if ("ps_2011_up" == tune) return "ps_2011_v3_up";
227  if ("ps_2011_down" == tune) return "ps_2011_v3_down";
228  if ("ps_2011_errup" == tune) return "ps_2011_v3_errup";
229  if ("ps_2011_errdown" == tune) return "ps_2011_v3_errdown";
230  if ("ps_2010_up" == tune) return "ps_2010_v3_up";
231  if ("ps_2010_down" == tune) return "ps_2010_v3_down";
232  if ("ps_2010_errup" == tune) return "ps_2010_v3_errup";
233  if ("ps_2010_errdown" == tune) return "ps_2010_v3_errdown";
234 
235  return tune;
236 }
237 
238 void egammaLayerRecalibTool::add_scale(const std::string& tuneIn)
239 {
240  ATH_MSG_INFO("using scale " << tuneIn);
241  std::string tune = resolve_alias(tuneIn);
242 
243  if (tune.empty()) { }
244  else if ("es2018_21.0_v0" == tune) {
245  add_scale("run2_alt_with_layer2_r21_v1");
246  }
247  else if ("es2017_21.0_v0" == tune) {
248  add_scale("run2_alt_with_layer2_r21_v0");
249  }
250  else if ("es2017_20.7_final" == tune) {
251  add_scale("pileup_20.7");
252  add_scale("run2_alt_with_layer2_modif");
253  }
254  else if ("es2017_20.7_improved" == tune) {
255  add_scale("pileup_20.7"); // new pileup correction Guillaume for 20.7
256  //TEMPORARY HACK REMOVED (two intermediate tags with this ES model use different layer corrections)
257  add_scale("2012_alt_with_layer2_modif"); // temporary old corrections from run1 + EMECPS HV
258  }
259  else if ("pileup_20.7" == tune) {
265  }
266  //Run 2
267  else if ("run2_alt_with_layer2_r21_v1"==tune) {
268  add_scale("layer2_alt_run2_r21_v1");
269  add_scale("ps_2016_r21_v0");
270  }
271  else if ("run2_alt_with_layer2_r21_v0"==tune) {
272  add_scale("layer2_alt_run2_r21_v0");
273  add_scale("ps_2016_r21_v0");
274  }
275  else if("run2_alt_with_layer2_modif" == tune) {
276  add_scale("ps_EMECHV1");
277  add_scale("layer2_alt_run2_v1");
278  add_scale("ps_2016");
279  }
280  // 2012
281  else if ("2012" == tune) {
282  add_scale("ps_HV1");
283  add_scale("layer1_2012");
284  add_scale("ps_2012");
285  }
286  else if("2012_with_layer2" == tune) {
287  add_scale("ps_HV1");
288  add_scale("layer2_2012_v5");
289  add_scale("ps_2012");
290  }
291  else if ("2012_alt" == tune) {
292  add_scale("ps_HV1");
293  add_scale("layer1_alt_2012");
294  add_scale("ps_2012");
295  }
296  else if("2012_alt_with_layer2" == tune) {
297  add_scale("ps_HV1");
298  add_scale("layer2_alt_2012_v5");
299  add_scale("ps_2012");
300  }
301  else if("2012_alt_with_layer2_modif" == tune) {
302  add_scale("ps_HV1");
303  add_scale("ps_EMECHV1");
304  add_scale("layer2_alt_2012_v5");
305  add_scale("ps_2012");
306  }
307  else if("2010_with_layer2" == tune) {
308  add_scale("layer2_2010_v5");
309  add_scale("ps_2010");
310  }
311  else if ("2012_layer1_up" == tune) {
312  add_scale("ps_HV1");
313  add_scale("layer1_2012_up");
314  add_scale("ps_2012");
315  }
316  else if ("2012_layer1_down" == tune) {
317  add_scale("ps_HV1");
318  add_scale("layer1_2012_down");
319  add_scale("ps_2012");
320  }
321  else if ("2012_layer1_errup" == tune) {
322  add_scale("layer1_2012_errup");
323  }
324  else if ("2012_layer1_errdown" == tune) {
325  add_scale("layer1_2012_errdown");
326  }
327  else if ("2012_ps_down" == tune) {
328  add_scale("ps_HV1");
329  add_scale("layer1_2012");
330  add_scale("ps_2012_down");
331  }
332  else if ("2012_ps_up" == tune) {
333  add_scale("ps_HV1");
334  add_scale("layer1_2012");
335  add_scale("ps_2012_up");
336  }
337  else if ("2012_ps_errdown" == tune) {
338  add_scale("ps_2012_errdown");
339  }
340  else if ("2012_ps_errup" == tune) {
341  add_scale("ps_2012_errup");
342  }
343  else if ("2012_up" == tune) {
344  add_scale("ps_HV1");
345  add_scale("layer1_2012_up");
346  add_scale("ps_2012_up");
347  }
348  else if ("2012_down" == tune) {
349  add_scale("ps_HV1");
350  add_scale("layer1_2012_down");
351  add_scale("ps_2012_down");
352  }
353  else if ("2012_errup" == tune) {
354  add_scale("layer1_2012_errup");
355  add_scale("ps_2012_errup");
356  }
357  else if ("2012_errdown" == tune) {
358  add_scale("layer1_2012_errdown");
359  add_scale("ps_2012_errdown");
360  }
361  // 2011
362  else if ("2011" == tune) {
363  add_scale("layer1_2011");
364  add_scale("ps_2011");
365  }
366  else if("2011_with_layer2" == tune) {
367  add_scale("layer2_2011_v5");
368  add_scale("ps_2011");
369  }
370  else if ("2011_alt" == tune) {
371  add_scale("layer1_alt_2011");
372  add_scale("ps_2011");
373  }
374  else if("2011_alt_with_layer2" == tune) {
375  add_scale("layer2_alt_2011_v5");
376  add_scale("ps_2011");
377  }
378  else if ("2011_layer1_up" == tune) {
379  add_scale("layer1_2011_up");
380  add_scale("ps_2011");
381  }
382  else if ("2011_layer1_down" == tune) {
383  add_scale("layer1_2011_down");
384  add_scale("ps_2011");
385  }
386  else if ("2011_layer1_errup" == tune) {
387  add_scale("layer1_2011_errup");
388  }
389  else if ("2011_layer1_errdown" == tune) {
390  add_scale("layer1_2011_errdown");
391  }
392  else if ("2011_ps_down" == tune) {
393  add_scale("layer1_2011");
394  add_scale("ps_2011_down");
395  }
396  else if ("2011_ps_up" == tune) {
397  add_scale("layer1_2011");
398  add_scale("ps_2011_up");
399  }
400  else if ("2011_ps_errdown" == tune) {
401  add_scale("ps_2011_errdown");
402  }
403  else if ("2011_ps_errup" == tune) {
404  add_scale("ps_2011_errup");
405  }
406  else if ("2011_up" == tune) {
407  add_scale("layer1_2011_up");
408  add_scale("ps_2011_up");
409  }
410  else if ("2011_down" == tune) {
411  add_scale("layer1_2011_down");
412  add_scale("ps_2011_down");
413  }
414  else if ("2011_errup" == tune) {
415  add_scale("layer1_2011_errup");
416  add_scale("ps_2011_errup");
417  }
418  else if ("2011_errdown" == tune) {
419  add_scale("layer1_2011_errdown");
420  add_scale("ps_2011_errdown");
421  }
422  // 2010
423  else if ("2010" == tune) {
424  add_scale("layer1_2010");
425  add_scale("ps_2010");
426  }
427  else if ("2010_layer1_up" == tune) {
428  add_scale("layer1_2010_up");
429  add_scale("ps_2010");
430  }
431  else if ("2010_layer1_down" == tune) {
432  add_scale("layer1_2010_down");
433  add_scale("ps_2010");
434  }
435  else if ("2010_layer1_errup" == tune) {
436  add_scale("layer1_2010_errup");
437  }
438  else if ("2010_layer1_errdown" == tune) {
439  add_scale("layer1_2010_errdown");
440  }
441  else if ("2010_ps_down" == tune) {
442  add_scale("layer1_2010");
443  add_scale("ps_2010_down");
444  }
445  else if ("2010_ps_up" == tune) {
446  add_scale("layer1_2010");
447  add_scale("ps_2010_up");
448  }
449  else if ("2010_ps_errdown" == tune) {
450  add_scale("ps_2010_errdown");
451  }
452  else if ("2010_ps_errup" == tune) {
453  add_scale("ps_2010_errup");
454  }
455  else if ("2010_up" == tune) {
456  add_scale("layer1_2010_up");
457  add_scale("ps_2010_up");
458  }
459  else if ("2010_down" == tune) {
460  add_scale("layer1_2010_down");
461  add_scale("ps_2010_down");
462  }
463  else if ("2010_errup" == tune) {
464  add_scale("layer1_2010_errup");
465  add_scale("ps_2010_errup");
466  }
467  else if ("2010_errdown" == tune) {
468  add_scale("layer1_2010_errdown");
469  add_scale("ps_2010_errdown");
470  }
471  else if ("ps_HV1" == tune) {
473  }
474  else if ("ps_EMECHV1" == tune) {
476  }
477  else if ("test1" == tune) {
478  TH1F h_presampler("h_presampler", "h_presampler", 10, -2.5, 2.5);
479  // just as an example, correct E0 by 0.1 * sign(eta)
480  // and E1 by 1%
481  for (int ibin = 1; ibin <= 5; ++ibin) {
482  h_presampler.SetBinContent(ibin, -0.1);
483  h_presampler.SetBinContent(ibin + 5, 0.1);
484  }
487  }
488  else if ("layer1_1" == tune) {
489  TFormula f("formula_layer1_1", "(abs(x)<1.425) ? 0.97 : 1");
491  }
492  else if ("layer1_2" == tune) {
493  TFormula f("formula_layer1_2", "(abs(x)<1.425) ? 0.97 : 1.05");
495  }
496  else if ("layer1_alt_2012_v5" == tune) {
497  const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root");
498  TFile f(file.c_str());
499  TH1* histo = checked_cast<TH1*>(f.Get("hE1E2ave_alt_2012"));
501  new GetAmountHisto1D(*histo));
502  }
503  else if ("layer1_2012_v5" == tune) {
504  const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root");
505  TFile f(file.c_str());
506  TH1* histo = checked_cast<TH1*>(f.Get("hE1E2ave_2012"));
508  new GetAmountHisto1D(*histo));
509  }
510  else if ("layer1_2012_v5_down" == tune) {
511  const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root");
512  TFile f(file.c_str());
513  TH1* histo = checked_cast<TH1*>(f.Get("hE1E2ave_2012"));
515  new GetAmountHisto1DUp(*histo));
516  }
517  else if ("layer1_2012_v5_up" == tune) {
518  const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root");
519  TFile f(file.c_str());
520  TH1* histo = checked_cast<TH1*>(f.Get("hE1E2ave_2012"));
523  }
524  else if ("layer1_2012_v5_errdown" == tune) {
525  const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root");
526  TFile f(file.c_str());
527  TH1* histo = checked_cast<TH1*>(f.Get("hE1E2ave_2012"));
530  }
531  else if ("layer1_2012_v5_errup" == tune) {
532  const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root");
533  TFile f(file.c_str());
534  TH1* histo = checked_cast<TH1*>(f.Get("hE1E2ave_2012"));
537  }
538  else if ("layer1_alt_2011_v5" == tune) {
539  const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root");
540  TFile f(file.c_str());
541  TH1* histo = checked_cast<TH1*>(f.Get("hE1E2ave_alt_2011"));
543  new GetAmountHisto1D(*histo));
544  }
545  else if ("layer1_2011_v5" == tune) {
546  const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root");
547  TFile f(file.c_str());
548  TH1* histo = checked_cast<TH1*>(f.Get("hE1E2ave_2011"));
550  new GetAmountHisto1D(*histo));
551  }
552  else if ("layer1_2011_v5_down" == tune) {
553  const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root");
554  TFile f(file.c_str());
555  TH1* histo = checked_cast<TH1*>(f.Get("hE1E2ave_2011"));
557  new GetAmountHisto1DUp(*histo));
558  }
559  else if ("layer1_2011_v5_up" == tune) {
560  const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root");
561  TFile f(file.c_str());
562  TH1* histo = checked_cast<TH1*>(f.Get("hE1E2ave_2011"));
565  }
566  else if ("layer1_2011_v5_errdown" == tune) {
567  const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root");
568  TFile f(file.c_str());
569  TH1* histo = checked_cast<TH1*>(f.Get("hE1E2ave_2011"));
572  }
573  else if ("layer1_2011_v5_errup" == tune) {
574  const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root");
575  TFile f(file.c_str());
576  TH1* histo = checked_cast<TH1*>(f.Get("hE1E2ave_2011"));
579  }
580  else if ("layer1_2010_v5" == tune) {
581  const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root");
582  TFile f(file.c_str());
583  TH1* histo = checked_cast<TH1*>(f.Get("hE1E2ave_2010"));
585  new GetAmountHisto1D(*histo));
586  }
587  else if ("layer1_2010_v5_down" == tune) {
588  const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root");
589  TFile f(file.c_str());
590  TH1* histo = checked_cast<TH1*>(f.Get("hE1E2ave_2010"));
592  new GetAmountHisto1DUp(*histo));
593  }
594  else if ("layer1_2010_v5_up" == tune) {
595  const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root");
596  TFile f(file.c_str());
597  TH1* histo = checked_cast<TH1*>(f.Get("hE1E2ave_2010"));
600  }
601  else if ("layer1_2010_v5_errdown" == tune) {
602  const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root");
603  TFile f(file.c_str());
604  TH1* histo = checked_cast<TH1*>(f.Get("hE1E2ave_2010"));
607  }
608  else if ("layer1_2010_v5_errup" == tune) {
609  const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root");
610  TFile f(file.c_str());
611  TH1* histo = checked_cast<TH1*>(f.Get("hE1E2ave_2010"));
614  }
615  else if("layer2_alt_run2_r21_v1"==tune) {
616  const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v6/egammaLayerRecalibTunes.root");
617  TFile f(file.c_str());
618  TH1* histo = checked_cast<TH1*>(f.Get("hE1E2_mu_run2_rel21_v1"));
620  new GetAmountHisto1D(*histo));
621  }
622  else if("layer2_alt_run2_r21_v0"==tune) {
623  const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v5/egammaLayerRecalibTunes.root");
624  TFile f(file.c_str());
625  TH1* histo = checked_cast<TH1*>(f.Get("hE1E2mu_2016_rel21_v1"));
627  new GetAmountHisto1D(*histo));
628  }
629  else if("layer2_alt_run2_v1" == tune) {
630  const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v3/egammaLayerRecalibTunes.root");
631  TFile f(file.c_str());
632  TH1* histo = checked_cast<TH1*>(f.Get("hE1E2mu_2016_v1"));
634  new GetAmountHisto1D(*histo));
635  }
636  else if("layer2_alt_2012_v5" == tune) {
637  const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root");
638  TFile f(file.c_str());
639  TH1* histo = checked_cast<TH1*>(f.Get("hE1E2ave_alt_2012"));
641  new GetAmountHisto1D(*histo));
642  }
643  else if("layer2_2012_v5" == tune) {
644  const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root");
645  TFile f(file.c_str());
646  TH1* histo = checked_cast<TH1*>(f.Get("hE1E2ave_2012"));
648  new GetAmountHisto1D(*histo));
649  }
650  else if("layer2_2012_v5_down" == tune) {
651  const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root");
652  TFile f(file.c_str());
653  TH1* histo = checked_cast<TH1*>(f.Get("hE1E2ave_2012"));
656  }
657  else if("layer2_2012_v5_up" == tune) {
658  const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root");
659  TFile f(file.c_str());
660  TH1* histo = checked_cast<TH1*>(f.Get("hE1E2ave_2012"));
662  new GetAmountHisto1DUp(*histo));
663  }
664  else if ("layer2_2012_v5_errdown" == tune) {
665  const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root");
666  TFile f(file.c_str());
667  TH1* histo = checked_cast<TH1*>(f.Get("hE1E2ave_2012"));
670  }
671  else if ("layer2_2012_v5_errup" == tune) {
672  const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root");
673  TFile f(file.c_str());
674  TH1* histo = checked_cast<TH1*>(f.Get("hE1E2ave_2012"));
677  }
678  else if("layer2_alt_2011_v5" == tune) {
679  const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root");
680  TFile f(file.c_str());
681  TH1* histo = checked_cast<TH1*>(f.Get("hE1E2ave_alt_2011"));
683  new GetAmountHisto1D(*histo));
684  }
685  else if("layer2_2011_v5" == tune) {
686  const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root");
687  TFile f(file.c_str());
688  TH1* histo = checked_cast<TH1*>(f.Get("hE1E2ave_2011"));
690  new GetAmountHisto1D(*histo));
691  }
692  else if("layer2_2011_v5_down" == tune) {
693  const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root");
694  TFile f(file.c_str());
695  TH1* histo = checked_cast<TH1*>(f.Get("hE1E2ave_2011"));
698  }
699  else if("layer2_2011_v5_up" == tune) {
700  const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root");
701  TFile f(file.c_str());
702  TH1* histo = checked_cast<TH1*>(f.Get("hE1E2ave_2011"));
704  new GetAmountHisto1DUp(*histo));
705  }
706  else if ("layer2_2011_v5_errdown" == tune) {
707  const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root");
708  TFile f(file.c_str());
709  TH1* histo = checked_cast<TH1*>(f.Get("hE1E2ave_2011"));
712  }
713  else if ("layer2_2011_v5_errup" == tune) {
714  const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root");
715  TFile f(file.c_str());
716  TH1* histo = checked_cast<TH1*>(f.Get("hE1E2ave_2011"));
719  }
720  else if("layer2_2010_v5" == tune) {
721  const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root");
722  TFile f(file.c_str());
723  TH1* histo = checked_cast<TH1*>(f.Get("hE1E2ave_2010"));
725  new GetAmountHisto1D(*histo));
726  }
727  else if("layer2_2010_v5_down" == tune) {
728  const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root");
729  TFile f(file.c_str());
730  TH1* histo = checked_cast<TH1*>(f.Get("hE1E2ave_2010"));
733  }
734  else if("layer2_2010_v5_up" == tune) {
735  const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root");
736  TFile f(file.c_str());
737  TH1* histo = checked_cast<TH1*>(f.Get("hE1E2ave_2010"));
739  new GetAmountHisto1DUp(*histo));
740  }
741  else if ("layer2_2010_v5_errdown" == tune) {
742  const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root");
743  TFile f(file.c_str());
744  TH1* histo = checked_cast<TH1*>(f.Get("hE1E2ave_2010"));
747  }
748  else if ("layer2_2010_v5_errup" == tune) {
749  const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root");
750  TFile f(file.c_str());
751  TH1* histo = checked_cast<TH1*>(f.Get("hE1E2ave_2010"));
754  }
755  else if ("ps_2016_r21_v0" == tune) {
756  const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v5/egammaLayerRecalibTunes.root");
757  TFile f(file.c_str());
758  TH1* histo_ps_tot_error = checked_cast<TH1*>(f.Get("hPS_2016_rel21"));
760  new GetAmountHisto1D(*histo_ps_tot_error));
761  }
762  else if ("ps_2016_v1" == tune) {
763  const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v4/egammaLayerRecalibTunes.root");
764  TFile f(file.c_str());
765  TH1* histo_ps_tot_error = checked_cast<TH1*>(f.Get("hPS_2016"));
767  new GetAmountHisto1D(*histo_ps_tot_error));
768  }
769  else if ("ps_2012_v3" == tune) {
770  const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root");
771  TFile f(file.c_str());
772  TH1* histo_ps_tot_error = checked_cast<TH1*>(f.Get("hPS_2012"));
774  new GetAmountHisto1D(*histo_ps_tot_error));
775  }
776  else if ("ps_2012_v3_down" == tune) {
777  const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root");
778  TFile f(file.c_str());
779  TH1* histo_ps_tot_error = checked_cast<TH1*>(f.Get("hPS_2012"));
781  new GetAmountHisto1DUp(*histo_ps_tot_error));
782  }
783  else if ("ps_2012_v3_up" == tune){
784  const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root");
785  TFile f(file.c_str());
786  TH1* histo_ps_tot_error = checked_cast<TH1*>(f.Get("hPS_2012"));
788  new GetAmountHisto1DDown(*histo_ps_tot_error));
789  }
790  else if ("ps_2012_v3_errdown" == tune){
791  const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root");
792  TFile f(file.c_str());
793  TH1* histo_ps_tot_error = checked_cast<TH1*>(f.Get("hPS_2012"));
795  new GetAmountHisto1DErrorUp(*histo_ps_tot_error));
796  }
797  else if ("ps_2012_v3_errup" == tune){
798  const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root");
799  TFile f(file.c_str());
800  TH1* histo_ps_tot_error = checked_cast<TH1*>(f.Get("hPS_2012"));
802  new GetAmountHisto1DErrorDown(*histo_ps_tot_error));
803  }
804  else if ("ps_2011_v3" == tune) {
805  const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root");
806  TFile f(file.c_str());
807  TH1* histo_ps_tot_error = checked_cast<TH1*>(f.Get("hPS_2011"));
809  new GetAmountHisto1D(*histo_ps_tot_error));
810  }
811  else if ("ps_2011_v3_down" == tune) {
812  const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root");
813  TFile f(file.c_str());
814  TH1* histo_ps_tot_error = checked_cast<TH1*>(f.Get("hPS_2011"));
816  new GetAmountHisto1DUp(*histo_ps_tot_error));
817  }
818  else if ("ps_2011_v3_up" == tune){
819  const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root");
820  TFile f(file.c_str());
821  TH1* histo_ps_tot_error = checked_cast<TH1*>(f.Get("hPS_2011"));
823  new GetAmountHisto1DDown(*histo_ps_tot_error));
824  }
825  else if ("ps_2011_v3_errdown" == tune){
826  const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root");
827  TFile f(file.c_str());
828  TH1* histo_ps_tot_error = checked_cast<TH1*>(f.Get("hPS_2011"));
830  new GetAmountHisto1DErrorUp(*histo_ps_tot_error));
831  }
832  else if ("ps_2011_v3_errup" == tune){
833  const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root");
834  TFile f(file.c_str());
835  TH1* histo_ps_tot_error = checked_cast<TH1*>(f.Get("hPS_2011"));
837  new GetAmountHisto1DErrorDown(*histo_ps_tot_error));
838  }
839  // 2010
840  else if ("ps_2010_v3" == tune) {
841  const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root");
842  TFile f(file.c_str());
843  TH1* histo_ps_tot_error = checked_cast<TH1*>(f.Get("hPS_2010"));
845  new GetAmountHisto1D(*histo_ps_tot_error));
846  }
847  else if ("ps_2010_v3_down" == tune) {
848  const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root");
849  TFile f(file.c_str());
850  TH1* histo_ps_tot_error = checked_cast<TH1*>(f.Get("hPS_2010"));
852  new GetAmountHisto1DUp(*histo_ps_tot_error));
853  }
854  else if ("ps_2010_v3_up" == tune) {
855  const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root");
856  TFile f(file.c_str());
857  TH1* histo_ps_tot_error = checked_cast<TH1*>(f.Get("hPS_2010"));
859  new GetAmountHisto1DDown(*histo_ps_tot_error));
860  }
861  else if ("ps_2010_v3_errdown" == tune){
862  const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root");
863  TFile f(file.c_str());
864  TH1* histo_ps_tot_error = checked_cast<TH1*>(f.Get("hPS_2010"));
866  new GetAmountHisto1DErrorUp(*histo_ps_tot_error));
867  }
868  else if ("ps_2010_v3_errup" == tune){
869  const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root");
870  TFile f(file.c_str());
871  TH1* histo_ps_tot_error = checked_cast<TH1*>(f.Get("hPS_2010"));
873  new GetAmountHisto1DErrorDown(*histo_ps_tot_error));
874  }
875  else {
876  throw std::runtime_error(tune+" is not a valid tune");
877  }
878 }
879 
880 egammaLayerRecalibTool::egammaLayerRecalibTool(const std::string& name, const std::string& tune)
881  : asg::AsgMessaging(name), m_tune(tune)
882 {
883  add_scale(tune);
884 }
885 
887  : egammaLayerRecalibTool("egammaLayerRecalibTool", tune) { }
888 
889 
891 {
892  m_modifiers.emplace_back(modifier, amount);
893 }
894 
896 {
898  for (const auto& modifier : m_modifiers) {
899  const float amount = (*modifier.second)(inputs);
900  const auto s = (*modifier.first)(inputs, amount);
901  ATH_MSG_DEBUG(" after E0|E1|E2|E3 = " << inputs.E0raw << "|" << inputs.E1raw << "|" << inputs.E2raw << "|" << inputs.E3raw);
902  if (s != CP::CorrectionCode::Ok) {
904  }
905  }
906  return status;
907 }
908 
910 {
911  const static SG::AuxElement::ConstAccessor<float> acc_Eadded_s2("Eadded_Lr2");
912  const static SG::AuxElement::ConstAccessor<float> acc_Eadded_s3("Eadded_Lr3");
913 
914  const xAOD::CaloCluster* cluster = particle.caloCluster();
915  if (!cluster) {
916  ATH_MSG_ERROR("egamma particle without CaloCluster");
918  }
919 
920  double addE2 = 0, addE3 = 0;
921  if (m_aodFixMissingCells) {
922  if (acc_Eadded_s2.isAvailable(particle))
923  { addE2 = acc_Eadded_s2(particle); }
924  else {
925  ATH_MSG_WARNING("Fix for missing cells required"
926  " but layer 2 info is not available");
927  }
928  if (acc_Eadded_s3.isAvailable(particle))
929  { addE3 = acc_Eadded_s3(particle); }
930  else {
931  ATH_MSG_WARNING("Fix for missing cells required"
932  " but layer 3 info is not available");
933  }
934  }
935 
937  event_info.averageInteractionsPerCrossing(),
938  event_info.runNumber(),
939  cluster->eta(),
940  cluster->phi(),
941  cluster->energyBE(0),
942  cluster->energyBE(1),
943  cluster->energyBE(2) + addE2,
944  cluster->energyBE(3) + addE3 };
945 
947 
948  static const SG::AuxElement::Decorator<double> deco_E0("correctedcl_Es0");
949  static const SG::AuxElement::Decorator<double> deco_E1("correctedcl_Es1");
950  static const SG::AuxElement::Decorator<double> deco_E2("correctedcl_Es2");
951  static const SG::AuxElement::Decorator<double> deco_E3("correctedcl_Es3");
952  static const SG::AuxElement::Decorator<std::string> deco_layer_correction("layer_correction");
953 
955  ATH_MSG_DEBUG("decorating cluster with corrected layer energies");
956  deco_E0(*cluster) = inputs.E0raw;
957  deco_E1(*cluster) = inputs.E1raw;
958  deco_E2(*cluster) = inputs.E2raw;
959  deco_E3(*cluster) = inputs.E3raw;
960  deco_layer_correction(*cluster) = m_tune;
961  return status;
962  }
963 
964  ATH_MSG_DEBUG("cannot correct layer energies: decorating particle with non-corrected layer energies");
965  // this is done for safety, since when a particle is decorated
966  // all the particle in the container are decorated
967  // it is not possible to distinguish between decorated / non-decorated
968  // since all are decorated
969  deco_E0(*cluster) = cluster->energyBE(0);
970  deco_E1(*cluster) = cluster->energyBE(1);
971  deco_E2(*cluster) = cluster->energyBE(2);
972  deco_E3(*cluster) = cluster->energyBE(3);
973  deco_layer_correction(*cluster) = m_tune;
974  return status;
975 
976 }
977 
978 
980 {
981  for (auto modifier : m_modifiers) {
982  delete modifier.first;
983  delete modifier.second;
984  }
985  m_modifiers.clear();
986 }
987 
988 
989 // helper
990 std::map<std::string, std::string> parse(const std::string& list)
991 {
992  std::cout << "list: '" << list << "'" << std::endl;
993  std::map<std::string, std::string> result;
994  TIter next(TString(list).Tokenize(","));
995  while (TObjString* sObj = (TObjString*) next())
996  {
997  const TString& item(sObj->GetString());
998  std::cout << "item: '" << item << "'" << std::endl;
999  TObjArray* item_list = TString(item).Tokenize(":");
1000  std::string key;
1001  std::string value;
1002  if (item_list->GetEntries() == 1) {
1003  key = "amount";
1004  value = static_cast<TObjString*>(item_list->At(0))->GetString().Data();
1005  }
1006  else if (item_list->GetEntries() == 2) {
1007  key = static_cast<TObjString*>(item_list->At(0))->GetString().Data();
1008  value = static_cast<TObjString*>(item_list->At(1))->GetString().Data();
1009  }
1010  else {
1011  std::cerr << "invalid string " << item << std::endl;
1012  }
1013  if (result.find(key) != result.end()) {
1014  std::cerr << "trying to insert two times key " << key << std::endl;
1015  assert(false);
1016  }
1017  result.insert(std::make_pair(key, value));
1018  }
1019  return result;
1020 }
1021 
1022 
1023 std::pair<std::string, egammaLayerRecalibTool*>
1024 egammaLayerRecalibTool::create(const std::string& type, const std::string& args)
1025 {
1026  std::map<std::string, std::string> args_map = parse(args);
1027  egammaLayerRecalibTool* tool = new egammaLayerRecalibTool("egammaLayerRecalibTool", "");
1028  std::string name = "";
1029  std::string amount_name = "";
1030  std::string type_name = "";
1031 
1032  GetAmountBase* amount_getter = nullptr;
1033  InputModifier* modifier = nullptr;
1034 
1035  if (args_map.find("amount") != args_map.end()) {
1036  std::string amount_str = args_map["amount"];
1037  bool perc = false;
1038  if (amount_str.back()=='%') {
1039  perc = true;
1040  amount_str.pop_back();
1041  }
1042  const float amount = TString(amount_str).Atof() * (perc ? 0.01 : 1);
1043 
1044  amount_getter = new GetAmountFixed(amount);
1045  std::stringstream amount_stream;
1046  amount_stream << amount;
1047  amount_name = amount_stream.str();
1048  std::replace(amount_name.begin(), amount_name.end(), '-', 'n');
1049  std::replace(amount_name.begin(), amount_name.end(), '.', 'p');
1050  }
1051  else if (args_map.find("name") != args_map.end()) {
1052  name = args_map["name"];
1053  }
1054  else if (args_map.find("histo") != args_map.end()) {
1055  int dim = 0;
1056  if (args_map.find("file") == args_map.end()) {
1057  std::cerr << "with histo you must specify file" << std::endl;
1058  assert(false);
1059  }
1060  if (args_map.find("formulax") != args_map.end()) dim = 1;
1061 
1062  if (dim == 0)
1063  {
1064  std::cerr << "with histo you must specify formulax" << std::endl;
1065  assert(false);
1066  }
1067  if (dim == 1) {
1068  TFile f(args_map["file"].c_str());
1069  std::cout << "opening histo " << args_map["histo"] << " from file " << args_map["file"] << std::endl;
1070  TH1F* histo = dynamic_cast<TH1F*>(f.Get(args_map["histo"].c_str()));
1071 
1072  if(histo){
1073  histo->SetDirectory(nullptr);
1074  amount_getter = new GetAmountHisto1D(*histo);
1075  }
1076  else{assert(false); }
1077  }
1078  else { assert(false); }
1079  }
1080  else {
1081  std::cerr << "cannot understand argument " << args << std::endl;
1082  assert(false);
1083  }
1084 
1085  if ("bias-E0" == type) { modifier = new ScaleE0(InputModifier::ZEROBASED); type_name = "E0"; }
1086  else if ("bias-E1" == type) { modifier = new ScaleE1(InputModifier::ZEROBASED); type_name = "E1"; }
1087  else if ("bias-E2" == type) { modifier = new ScaleE2(InputModifier::ZEROBASED); type_name = "E2"; }
1088  else if ("bias-E3" == type) { modifier = new ScaleE3(InputModifier::ZEROBASED); type_name = "E3"; }
1089  else if ("bias-E1overE2" == type) { modifier = new ScaleE1overE2(InputModifier::ZEROBASED); type_name = "E1overE2"; }
1090  else if ("bias-Eaccordion" == type) { modifier = new ScaleEaccordion(InputModifier::ZEROBASED); type_name = "Eaccordion"; }
1091  else if ("bias-Ecalorimeter" == type) { modifier = new ScaleEcalorimeter(InputModifier::ZEROBASED); type_name = "Ecalorimeter"; }
1092 
1093  if (not type_name.empty() and not amount_name.empty()) {
1094  name = type_name + "_" + amount_name;
1095  }
1096 
1097  if (name.empty()) {
1098  std::cerr << "you need to specify a name for the bias with type " << type << std::endl;
1099  }
1100 
1101  if (modifier and amount_getter) {
1102  tool->add_scale(modifier, amount_getter);
1103  }
1104  else{
1105  tool->add_scale(type);
1106  //release resources, if modifier false need to release amount_getter and vice versa
1107  //since they are not passed to the tool
1108  if(modifier) delete modifier;
1109  if(amount_getter) delete amount_getter;
1110  }
1111 
1112  return {name, tool};
1113 }
xAOD::CaloCluster_v1::phi
virtual double phi() const
The azimuthal angle ( ) of the particle.
Definition: CaloCluster_v1.cxx:256
InputModifier::SCALE
@ SCALE
Definition: egammaLayerRecalibTool.h:220
corr_HV_EMBPS::getCorr
float getCorr(int run, float eta, float phi) const
get correction factor to apply to raw EMBPS energy : corrected raw EMBPS energy = correction factor *...
Definition: corr_HV_EMBPS.cxx:45
replace
std::string replace(std::string s, const std::string &s2, const std::string &s3)
Definition: hcg.cxx:307
GetAmountHVPSGuillaume
Definition: egammaLayerRecalibTool.h:70
GetAmountPileupE3
Definition: egammaLayerRecalibTool.h:113
python.CaloRecoConfig.f
f
Definition: CaloRecoConfig.py:127
GetAmountHVPSGuillaume::m_tool
corr_HV_EMBPS m_tool
Definition: egammaLayerRecalibTool.h:73
Trk::ParticleSwitcher::particle
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses
Definition: ParticleHypothesis.h:76
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
yodamerge_tmp.dim
dim
Definition: yodamerge_tmp.py:239
get_generator_info.result
result
Definition: get_generator_info.py:21
GetAmountHisto1D::operator()
virtual float operator()(const StdCalibrationInputs &input) const
Definition: egammaLayerRecalibTool.cxx:52
max
#define max(a, b)
Definition: cfImp.cxx:41
ScaleE3::shift_inputs
virtual void shift_inputs(StdCalibrationInputs &, float amount) const
Definition: egammaLayerRecalibTool.cxx:145
egammaLayerRecalibTool::m_aodFixMissingCells
bool m_aodFixMissingCells
Definition: egammaLayerRecalibTool.h:357
egammaLayerRecalibTool::m_pileup_tool
corr_pileupShift * m_pileup_tool
Definition: egammaLayerRecalibTool.h:355
InputModifier::ZEROBASED
@ ZEROBASED
Definition: egammaLayerRecalibTool.h:220
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
InputModifier::SHIFT
@ SHIFT
Definition: egammaLayerRecalibTool.h:220
GetAmountPileupE2::operator()
virtual float operator()(const StdCalibrationInputs &inputs) const
Definition: egammaLayerRecalibTool.cxx:112
GetAmountBase
Definition: egammaLayerRecalibTool.h:61
NNPDF30NNLO.tune
tune
Definition: GeneratorFilters/share/common/NNPDF30NNLO.py:1
GetAmountPileupE0::m_tool
corr_pileupShift * m_tool
Definition: egammaLayerRecalibTool.h:90
GetAmountFixed::operator()
virtual float operator()(const StdCalibrationInputs &input) const
Definition: egammaLayerRecalibTool.cxx:88
parse
std::map< std::string, std::string > parse(const std::string &list)
Definition: egammaLayerRecalibTool.cxx:990
asg
Definition: DataHandleTestTool.h:28
GetAmountPileupE2::m_tool
corr_pileupShift * m_tool
Definition: egammaLayerRecalibTool.h:108
bin
Definition: BinsDiffFromStripMedian.h:43
egammaLayerRecalibTool::scale_inputs
CP::CorrectionCode scale_inputs(StdCalibrationInputs &inputs) const
apply layer calibration to the
Definition: egammaLayerRecalibTool.cxx:895
athena.value
value
Definition: athena.py:122
ScaleE0::shift_inputs
virtual void shift_inputs(StdCalibrationInputs &, float amount) const
Definition: egammaLayerRecalibTool.cxx:142
GetAmountHVEMECPS207::operator()
virtual float operator()(const StdCalibrationInputs &input) const
Definition: egammaLayerRecalibTool.cxx:100
GetAmountPileupE2
Definition: egammaLayerRecalibTool.h:104
xAOD::Egamma_v1
Definition: Egamma_v1.h:56
SG::ConstAccessor
Helper class to provide constant type-safe access to aux data.
Definition: ConstAccessor.h:54
egammaLayerRecalibTool::applyCorrection
CP::CorrectionCode applyCorrection(xAOD::Egamma &, const xAOD::EventInfo &event_info) const
Definition: egammaLayerRecalibTool.cxx:909
egammaLayerRecalibTool::egammaLayerRecalibTool
egammaLayerRecalibTool(const std::string &name, const std::string &tune)
Definition: egammaLayerRecalibTool.cxx:880
GetAmountPileupE1::operator()
virtual float operator()(const StdCalibrationInputs &inputs) const
Definition: egammaLayerRecalibTool.cxx:108
GetAmountHisto1DUp::operator()
virtual float operator()(const StdCalibrationInputs &input) const
Definition: egammaLayerRecalibTool.cxx:58
GetAmountFormula::operator()
virtual float operator()(const StdCalibrationInputs &input) const
Definition: egammaLayerRecalibTool.cxx:92
corr_pileupShift
Correction for pileup induced energy shit as function of mu per layer for 2016 data.
Definition: corr_pileupShift.h:13
InputModifier::shift_inputs
virtual void shift_inputs(StdCalibrationInputs &, float amount) const =0
ScaleE3
Definition: egammaLayerRecalibTool.h:266
ScaleE1overE2::scale_inputs
virtual void scale_inputs(StdCalibrationInputs &, float amount) const
Definition: egammaLayerRecalibTool.cxx:148
GetAmountHisto2D::m_histo
TH2F m_histo
Definition: egammaLayerRecalibTool.h:190
InputModifier::SUBTRACT
@ SUBTRACT
Definition: egammaLayerRecalibTool.h:220
postInclude.inputs
inputs
Definition: postInclude.SortInput.py:15
GetAmountFixed::m_amount
float m_amount
Definition: egammaLayerRecalibTool.h:201
GetAmountPileupE1::m_tool
corr_pileupShift * m_tool
Definition: egammaLayerRecalibTool.h:99
xAOD::EventInfo_v1::runNumber
uint32_t runNumber() const
The current event's run number.
ScaleE1::shift_inputs
virtual void shift_inputs(StdCalibrationInputs &, float amount) const
Definition: egammaLayerRecalibTool.cxx:143
InputModifier::ONEBASED_ALPHA
@ ONEBASED_ALPHA
Definition: egammaLayerRecalibTool.h:220
GetAmountHisto1DErrorDown
Definition: egammaLayerRecalibTool.h:177
ScaleE0
Definition: egammaLayerRecalibTool.h:236
PyPoolBrowser.item
item
Definition: PyPoolBrowser.py:129
CP::CorrectionCode::OutOfValidityRange
@ OutOfValidityRange
Input object is out of validity range.
Definition: CorrectionCode.h:37
CP::CorrectionCode::Error
@ Error
Some error happened during the object correction.
Definition: CorrectionCode.h:36
ScaleEcalorimeter
Definition: egammaLayerRecalibTool.h:296
xAOD::CaloCluster_v1
Description of a calorimeter cluster.
Definition: CaloCluster_v1.h:59
GetAmountHisto1DDown::operator()
virtual float operator()(const StdCalibrationInputs &input) const
Definition: egammaLayerRecalibTool.cxx:64
egammaLayerRecalibTool::m_modifiers
ModifiersList m_modifiers
Definition: egammaLayerRecalibTool.h:353
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
InputModifier::ONEBASED
@ ONEBASED
Definition: egammaLayerRecalibTool.h:220
convertTimingResiduals.sum
sum
Definition: convertTimingResiduals.py:55
corr_pileupShift::getCorr
float getCorr(int layer, int run, float mu, float eta) const
get shift to subtract to raw layer energy : corrected layer energy = raw energy - shift
Definition: corr_pileupShift.cxx:37
GetAmountPileupE0::operator()
virtual float operator()(const StdCalibrationInputs &inputs) const
Definition: egammaLayerRecalibTool.cxx:104
SG::Decorator
Helper class to provide type-safe access to aux data.
Definition: Decorator.h:58
fillPileUpNoiseLumi.next
next
Definition: fillPileUpNoiseLumi.py:53
xAOD::CaloCluster_v1::eta
virtual double eta() const
The pseudorapidity ( ) of the particle.
Definition: CaloCluster_v1.cxx:251
GetAmountPileupE1
Definition: egammaLayerRecalibTool.h:95
GetAmountPileupE3::m_tool
corr_pileupShift * m_tool
Definition: egammaLayerRecalibTool.h:117
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
GetAmountPileupE3::operator()
virtual float operator()(const StdCalibrationInputs &inputs) const
Definition: egammaLayerRecalibTool.cxx:116
GetAmountFormula
Definition: egammaLayerRecalibTool.h:124
GetAmountFixed
Definition: egammaLayerRecalibTool.h:195
PlotPulseshapeFromCool.input
input
Definition: PlotPulseshapeFromCool.py:106
egammaLayerRecalibTool::clear_corrections
void clear_corrections()
remove all the scale corrections
Definition: egammaLayerRecalibTool.cxx:979
ScaleE2::scale_inputs
virtual void scale_inputs(StdCalibrationInputs &, float amount) const
Definition: egammaLayerRecalibTool.cxx:139
file
TFile * file
Definition: tile_monitor.h:29
egammaLayerRecalibTool.h
TH1F::SetBinContent
void SetBinContent(int, double)
Definition: rootspy.cxx:327
InputModifier::ZEROBASED_ALPHA
@ ZEROBASED_ALPHA
Definition: egammaLayerRecalibTool.h:220
GetAmountHVEMECPS207
Definition: egammaLayerRecalibTool.h:78
ScaleE1
Definition: egammaLayerRecalibTool.h:246
TH2F::GetBinContent
double GetBinContent(int) const
Definition: rootspy.cxx:425
xAOD::EventInfo_v1::averageInteractionsPerCrossing
float averageInteractionsPerCrossing() const
Average interactions per crossing for all BCIDs - for out-of-time pile-up.
Definition: EventInfo_v1.cxx:397
PathResolver.h
InputModifier
Definition: egammaLayerRecalibTool.h:219
ScaleEaccordion::shift_inputs
virtual void shift_inputs(StdCalibrationInputs &, float amount) const
Definition: egammaLayerRecalibTool.cxx:177
egammaLayerRecalibTool::add_scale
void add_scale(InputModifier *modifier, GetAmountBase *amount)
add custom layer scale correction.
Definition: egammaLayerRecalibTool.cxx:890
ScaleE1::scale_inputs
virtual void scale_inputs(StdCalibrationInputs &, float amount) const
Definition: egammaLayerRecalibTool.cxx:138
GetAmountHisto1DErrorUp
Definition: egammaLayerRecalibTool.h:169
ScaleE3::scale_inputs
virtual void scale_inputs(StdCalibrationInputs &, float amount) const
Definition: egammaLayerRecalibTool.cxx:140
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
AtlCoolConsole.tool
tool
Definition: AtlCoolConsole.py:453
GetAmountPileupE0
Definition: egammaLayerRecalibTool.h:86
ScaleE2::shift_inputs
virtual void shift_inputs(StdCalibrationInputs &, float amount) const
Definition: egammaLayerRecalibTool.cxx:144
pool::Tokenize
void Tokenize(const std::string &str, std::vector< std::string > &tokens, const std::string &delimiters=" ")
GetAmountHisto1D
Definition: egammaLayerRecalibTool.h:134
InputModifier::scale_inputs
virtual void scale_inputs(StdCalibrationInputs &, float amount) const =0
item
Definition: ItemListSvc.h:43
make_hlt_rep.modifier
string modifier
Definition: make_hlt_rep.py:14
GetAmountHVPSGuillaume::operator()
virtual float operator()(const StdCalibrationInputs &input) const
Definition: egammaLayerRecalibTool.cxx:96
GetAmountHisto1DErrorDown::operator()
virtual float operator()(const StdCalibrationInputs &input) const
Definition: egammaLayerRecalibTool.cxx:76
xAOD::EventInfo_v1
Class describing the basic event information.
Definition: EventInfo_v1.h:43
PathResolverFindCalibFile
std::string PathResolverFindCalibFile(const std::string &logical_file_name)
Definition: PathResolver.cxx:431
egammaLayerRecalibTool
Definition: egammaLayerRecalibTool.h:306
CP::CorrectionCode::Ok
@ Ok
The correction was done successfully.
Definition: CorrectionCode.h:38
GetAmountHisto1DErrorUp::operator()
virtual float operator()(const StdCalibrationInputs &input) const
Definition: egammaLayerRecalibTool.cxx:70
ScaleEaccordion
Definition: egammaLayerRecalibTool.h:286
ScaleEcalorimeter::scale_inputs
virtual void scale_inputs(StdCalibrationInputs &, float amount) const
Definition: egammaLayerRecalibTool.cxx:184
StdCalibrationInputs
Name : egammaLayerRecalibTool.h Package : egammaLayerRecalibTool Author : R.
Definition: egammaLayerRecalibTool.h:47
ScaleE1overE2
Definition: egammaLayerRecalibTool.h:276
TH1F
Definition: rootspy.cxx:320
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
TH1
Definition: rootspy.cxx:268
egammaLayerRecalibTool::resolve_alias
static std::string resolve_alias(const std::string &tune)
Definition: egammaLayerRecalibTool.cxx:200
python.KeyStore.list
def list(self, key=None)
Definition: KeyStore.py:318
egammaLayerRecalibTool::create
static std::pair< std::string, egammaLayerRecalibTool * > create(const std::string &type, const std::string &args)
helper to create a tool from a string (useful for command line arguments)
Definition: egammaLayerRecalibTool.cxx:1024
ScaleE2
Definition: egammaLayerRecalibTool.h:256
CP::CorrectionCode
Return value from object correction CP tools.
Definition: CorrectionCode.h:31
xAOD::CaloCluster_v1::energyBE
float energyBE(const unsigned layer) const
Get the energy in one layer of the EM Calo.
Definition: CaloCluster_v1.cxx:630
ScaleE0::scale_inputs
virtual void scale_inputs(StdCalibrationInputs &, float amount) const
Definition: egammaLayerRecalibTool.cxx:137
InputModifier::m_base
NullPoint m_base
Definition: egammaLayerRecalibTool.h:231
ScaleEcalorimeter::shift_inputs
virtual void shift_inputs(StdCalibrationInputs &, float amount) const
Definition: egammaLayerRecalibTool.cxx:192
SG::ConstAccessor::isAvailable
bool isAvailable(const ELT &e) const
Test to see if this variable exists in the store.
merge.status
status
Definition: merge.py:17
corr_HV_EMECPS::getCorr
float getCorr(int run, float eta, float phi) const
get correction factor to apply to raw EMECPS energy : corrected raw EMECPS energy = correction factor...
Definition: corr_HV_EMECPS.cxx:41
ScaleEaccordion::scale_inputs
virtual void scale_inputs(StdCalibrationInputs &, float amount) const
Definition: egammaLayerRecalibTool.cxx:170
GetAmountHisto1DDown
Definition: egammaLayerRecalibTool.h:161
InputModifier::operator()
CP::CorrectionCode operator()(StdCalibrationInputs &, float amount) const
Definition: egammaLayerRecalibTool.cxx:121
GetAmountHisto1DUp
Definition: egammaLayerRecalibTool.h:153
egammaLayerRecalibTool::m_tune
std::string m_tune
Definition: egammaLayerRecalibTool.h:350
GetAmountHisto2D::operator()
virtual float operator()(const StdCalibrationInputs &input) const
Definition: egammaLayerRecalibTool.cxx:82
plotBeamSpotCompare.histo
histo
Definition: plotBeamSpotCompare.py:415
python.PyAthena.obj
obj
Definition: PyAthena.py:135
GetAmountHVEMECPS207::m_toolEMECPS
corr_HV_EMECPS m_toolEMECPS
Definition: egammaLayerRecalibTool.h:81
ScaleE1overE2::shift_inputs
virtual void shift_inputs(StdCalibrationInputs &, float amount) const
Definition: egammaLayerRecalibTool.cxx:164
GetAmountFormula::m_formula
TFormula m_formula
Definition: egammaLayerRecalibTool.h:129
GetAmountHisto1D::m_histo
std::unique_ptr< TH1 > m_histo
Definition: egammaLayerRecalibTool.h:148
keylayer_zslicemap.perc
perc
Definition: keylayer_zslicemap.py:62
python.CaloScaleNoiseConfig.args
args
Definition: CaloScaleNoiseConfig.py:80
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37