ATLAS Offline Software
AsgElectronEfficiencyCorrectionTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3  */
4 
10 // Include this class's header
13 // Library includes
14 #include <algorithm>
15 #include <cfloat>
16 #include <iostream>
17 #include <string>
18 #include <utility>
19 // xAOD includes
20 #include "xAODEgamma/Electron.h"
22 // PAT includes
23 #ifndef XAOD_STANDALONE
25 #endif
27 #include "PATCore/PATCoreEnums.h"
30 // ROOT includes
31 #include "TH2F.h"
32 #include "TSystem.h"
33 
34 namespace {
35 // Helper function Calculate and return at the spot
37 HelperFunc(double& sf, const double input)
38 {
39  sf = sf + input;
41 }
42 }
43 
44 namespace correlationModel {
45 enum model
46 {
48  MCTOYS = 1,
49  FULL = 2,
51  TOTAL = 4,
52  SYST = 5
53 };
54 }
55 AsgElectronEfficiencyCorrectionTool::AsgElectronEfficiencyCorrectionTool(
56  const std::string& myname)
57  : asg::AsgMetadataTool(myname)
58  , m_affectedSys()
59  , m_appliedSystematics(nullptr)
60  , m_correlation_model(correlationModel::SIMPLIFIED)
61  , m_sysSubstring("")
62  , m_dataType(PATCore::ParticleDataType::Full)
63  , m_nCorrSyst(0)
64  , m_nUncorrSyst(0)
65  , m_UncorrRegions(nullptr)
66  , m_nSimpleUncorrSyst(0)
67  , m_toysBasename{}
68  , m_corrVarUp{}
69  , m_corrVarDown{}
70  , m_uncorrVarUp{}
71  , m_uncorrVarDown{}
72 {
73  // Create an instance of the underlying ROOT tool
74  m_rootTool = std::make_unique<Root::TElectronEfficiencyCorrectionTool>(
75  ("T" + (this->name())).c_str());
76  // Declare the needed properties
77  declareProperty(
78  "CorrectionFileNameList",
79  m_corrFileNameList,
80  "List of file names that store the correction factors for simulation.");
81  declareProperty("MapFilePath",
82  m_mapFile = "ElectronEfficiencyCorrection/2015_2025/rel22.2/"
83  "2024_Consolidated_Prerecom_v1/map1.txt",
84  "Full path to the map file");
85  declareProperty(
86  "RecoKey", m_recoKey = "", "Key associated with reconstruction");
87  declareProperty(
88  "IdKey", m_idKey = "", "Key associated with identification working point");
89  declareProperty(
90  "IsoKey", m_isoKey = "", "Key associated with isolation working point");
91  declareProperty(
92  "TriggerKey", m_trigKey = "", "Key associated with trigger working point");
93  declareProperty("ForceDataType",
94  m_dataTypeOverwrite = -1,
95  "Force the DataType of the electron to specified value (to "
96  "circumvent problem of incorrect DataType for forward "
97  "electrons in some old releases)");
98  declareProperty(
99  "ResultPrefix", m_resultPrefix = "", "The prefix string for the result");
100  declareProperty("ResultName", m_resultName = "", "The string for the result");
101  declareProperty("CorrelationModel",
102  m_correlation_model_name = "SIMPLIFIED",
103  "Uncertainty correlation model. At the moment TOTAL, FULL, "
104  "SIMPLIFIED, SYST, MCTOYS and COMBMCTOYS are implemented. "
105  "SIMPLIFIED is the default option.");
106  declareProperty("NumberOfToys",
107  m_number_of_toys = 100,
108  "Number of ToyMC replica, affecting MCTOYS and COMBMCTOYS "
109  "correlation models only.");
110  declareProperty("MCToySeed",
111  m_seed_toys = 0,
112  "Seed for ToyMC replica, affecting MCTOYS and COMBMCTOYS "
113  "correlation models only.");
114  declareProperty("MCToyScale",
115  m_scale_toys = 1,
116  "Scales Toy systematics up by this factor, affecting MCTOYS "
117  "and COMBMCTOYS correlation models only.");
118  declareProperty(
119  "UncorrEtaBinsUser",
120  m_uncorrSimplfEtaBinsUser = { 0.0, 1.37, 4.9 },
121  "Custom Eta/Pt binning for the SIMPLIFIED correlation model.");
122  declareProperty(
123  "UncorrEtBinsUser",
124  m_uncorrSimplfEtBinsUser = { 4000,
125  7000,
126  10000,
127  15000,
128  20000,
129  25000,
130  30000,
131  60000,
132  80000,
133  13600000 },
134  "Custom Eta/Pt binning for the SIMPLIFIED correlation model.");
135  declareProperty("EventInfoCollectionName",
136  m_eventInfoCollectionName = "EventInfo",
137  "The EventInfo Collection Name");
138  declareProperty("UseRandomRunNumber", m_useRandomRunNumber = true);
139  declareProperty("DefaultRandomRunNumber", m_defaultRandomRunNumber = 999999);
140 }
141 
143 {
144  if (m_UncorrRegions) {
145  delete m_UncorrRegions;
146  }
147 }
148 
151 {
152  // Forward the message level
153  m_rootTool->msg().setLevel(this->msg().level());
154 
155  if (m_corrFileNameList.empty() && m_recoKey.empty() && m_idKey.empty() &&
156  m_trigKey.empty() && m_isoKey.empty()) {
157  ATH_MSG_ERROR("CorrectionFileNameList as well as SFKeys are empty! Please "
158  "configure it properly...");
159  return StatusCode::FAILURE;
160  }
161  /*
162  * When metadata are available
163  * m_dataType will be whatever the metadata says i.e Full or Fast
164  * Its default value is Full.
165  * The user can overwrite all these ,using a flag,
166  * and force a specific dataType
167  */
168  if (m_dataTypeOverwrite != -1) {
169  if (m_dataTypeOverwrite !=
170  static_cast<int>(PATCore::ParticleDataType::Full) &&
172  static_cast<int>(PATCore::ParticleDataType::Fast)) {
173  ATH_MSG_ERROR("Unsupported Particle Data Type Overwrite"
175  return StatusCode::FAILURE;
176  }
177  m_dataType =
179  }
180  // Find the relevant input files
181  // Fill the vector with filename using keys if the user
182  // has not passed the full filename as a property
183  if (m_corrFileNameList.empty()) {
184  if (getFile(m_recoKey, m_idKey, m_isoKey, m_trigKey).isFailure()) {
185  ATH_MSG_ERROR("No Root file input specified, and not available map file");
186  return StatusCode::FAILURE;
187  }
188  }
189  // Resolve the paths to the input files for the full Geant4 simualtion
190  // corrections
191  for (auto& ifile : m_corrFileNameList) {
192 
194  if (filename.empty()) {
195  ATH_MSG_ERROR("Could NOT resolve file name " << ifile);
196  return StatusCode::FAILURE;
197  } else {
198  ATH_MSG_DEBUG(" Path found = " << filename);
199  }
200  m_rootTool->addFileName(filename);
201  // Determine the systematics substring according to the name of the input
202  // file
203  if (ifile.find("efficiencySF.") != std::string::npos) {
204  m_sysSubstring = "Trigger_";
205  }
206  if (ifile.find("efficiencySF.offline") != std::string::npos) {
207  m_sysSubstring = "ID_";
208  }
209  if (ifile.find("efficiencySF.offline.RecoTrk") != std::string::npos) {
210  m_sysSubstring = "Reco_";
211  }
212  if (ifile.find("efficiencySF.offline.Fwd") != std::string::npos) {
213  m_sysSubstring = "FwdID_";
214  }
215  if (ifile.find("efficiencySF.Isolation") != std::string::npos) {
216  m_sysSubstring = "Iso_";
217  }
218  if (ifile.find("efficiency.") != std::string::npos) {
219  m_sysSubstring = "TriggerEff_";
220  }
221  if (ifile.find("efficiencySF.ChargeID") != std::string::npos) {
222  m_sysSubstring = "ChargeIDSel_";
223  }
224  if (m_sysSubstring.empty()) {
225  ATH_MSG_ERROR("Could NOT find systematics Substring file name "
226  << m_sysSubstring);
227  return StatusCode::FAILURE;
228  }
229  }
230  //
231  // Find the proper correlation Model
232  if (m_correlation_model_name == "COMBMCTOYS") {
234  } else if (m_correlation_model_name == "MCTOYS") {
236  } else if (m_correlation_model_name == "FULL") {
238  } else if (m_correlation_model_name == "SIMPLIFIED") {
240  // a few checks on the binning that the user might have specified
241  if (m_uncorrSimplfEtaBinsUser.empty() || m_uncorrSimplfEtBinsUser.empty() ||
242  m_uncorrSimplfEtBinsUser.size() < 2 ||
243  m_uncorrSimplfEtaBinsUser.size() < 2) {
244  ATH_MSG_ERROR("Something went wrong when specifying bins for the "
245  "SIMPLIFIED correlation model ");
246  return StatusCode::FAILURE;
247  }
248  } else if (m_correlation_model_name == "TOTAL") {
250  } else if (m_correlation_model_name == "SYST") {
252  } else {
253  ATH_MSG_ERROR("Unknown correlation model " + m_correlation_model_name);
254  return StatusCode::FAILURE;
255  }
256  ATH_MSG_DEBUG("Correlation model: " + m_correlation_model_name
257  << " Enum " << m_correlation_model);
258 
259  // Histogram of simplified uncorrelated regions
261  m_UncorrRegions = new TH2F("UncorrRegions",
262  "UncorrRegions",
263  m_uncorrSimplfEtBinsUser.size() - 1,
265  m_uncorrSimplfEtaBinsUser.size() - 1,
267  m_UncorrRegions->SetDirectory(nullptr);
268 
269  // bins not entries here
271  (m_uncorrSimplfEtBinsUser.size() - 1);
272  }
273  // Finish the preaparation of the underlying tool
274  if (m_seed_toys != 0) {
275  m_rootTool->setSeed(m_seed_toys);
276  }
277  //
279  m_rootTool->bookCombToyMCScaleFactors(m_number_of_toys);
280  }
281  //
283  m_rootTool->bookToyMCScaleFactors(m_number_of_toys);
284  }
285  // We need to initialize the underlying ROOT TSelectorTool
286  if (0 == m_rootTool->initialize()) {
288  "Could not initialize the TElectronEfficiencyCorrectionTool!");
289  return StatusCode::FAILURE;
290  }
291 
292  // get Nsyst
293  m_nCorrSyst = m_rootTool->getNSyst();
294  std::map<float, std::vector<float>> tmp;
295  m_nUncorrSyst = m_rootTool->getNbins(tmp);
296  // copy over to vector for better access
297  for (const auto& i : tmp) {
298  m_pteta_bins.emplace_back(i.first, i.second);
299  }
300 
301  // Check if the input contains uncorr/stat necessary
302  // to run non-total systematic model
304  m_rootTool->uncorrEmpty(m_dataType) ) {
305  ATH_MSG_ERROR("Called correlation model "+m_correlation_model_name+
306  " but input does not contain necessary histograms.");
307  return StatusCode::FAILURE;
308  }
309 
310  // Initialize the systematics
311  if (InitSystematics() != StatusCode::SUCCESS) {
312  ATH_MSG_ERROR("(InitSystematics() != StatusCode::SUCCESS)");
313  return StatusCode::FAILURE;
314  }
315  // Add the recommended systematics to the registry
316  if (registerSystematics() != StatusCode::SUCCESS) {
317  ATH_MSG_ERROR("(registerSystematics() != StatusCode::SUCCESS)");
318  return StatusCode::FAILURE;
319  }
320  // Configure for nominal systematics
321  if (applySystematicVariation(CP::SystematicSet()) != StatusCode::SUCCESS) {
322  ATH_MSG_ERROR("Could not configure for nominal settings");
323  return StatusCode::FAILURE;
324  }
325  return StatusCode::SUCCESS;
326 }
327 
330  const xAOD::Electron& inputObject,
331  double& efficiencyScaleFactor) const
332 {
333 
334  efficiencyScaleFactor = 1;
335  // Retrieve the proper random Run Number
336  unsigned int runNumber = m_defaultRandomRunNumber;
337  if (m_useRandomRunNumber) {
338  const xAOD::EventInfo* eventInfo =
340  if (!eventInfo) {
341  ATH_MSG_ERROR("Could not retrieve EventInfo object!");
343  }
344  static const SG::AuxElement::Accessor<unsigned int> randomrunnumber(
345  "RandomRunNumber");
346  if (!randomrunnumber.isAvailable(*eventInfo)) {
348  "Pileup tool not run before using ElectronEfficiencyTool! SFs do not "
349  "reflect PU distribution in data");
351  }
352  runNumber = randomrunnumber(*(eventInfo));
353  }
354  //
355  // Get the result
356  //
357  double cluster_eta(-9999.9);
358 
359  const xAOD::CaloCluster* cluster = inputObject.caloCluster();
360  if (!cluster) {
361  ATH_MSG_ERROR("ERROR no cluster associated to the Electron \n");
363  }
364 
365  // we need to use different variables for central and forward electrons
366  static const SG::AuxElement::ConstAccessor<uint16_t> accAuthor("author");
367  if (accAuthor.isAvailable(inputObject) &&
368  accAuthor(inputObject) == xAOD::EgammaParameters::AuthorFwdElectron) {
369  cluster_eta = cluster->eta();
370  } else {
371  cluster_eta = cluster->etaBE(2);
372  }
373 
374  // use et from cluster because it is immutable under syst variations of
375  // electron energy scale
376  const double energy = cluster->e();
377  const double parEta = inputObject.eta();
378  const double coshEta = std::cosh(parEta);
379  double et = (coshEta != 0.) ? energy / coshEta : 0.;
380  // allow for a 5% margin at the lowest pT bin boundary (i.e. increase et by 5%
381  // for sub-threshold electrons). This assures that electrons that pass the
382  // threshold only under syst variations of energy get a scale factor assigned.
383  auto itr_pt = m_pteta_bins.begin();
384  if (itr_pt != m_pteta_bins.end() && et < itr_pt->first) {
385  et = et * 1.05;
386  }
387  return getEfficiencyScaleFactor(et, cluster_eta, runNumber,
388  efficiencyScaleFactor);
389 }
390 
393  const double et, /*in MeV*/
394  const double cluster_eta, /*cluster*/
395  const unsigned int runNumber,
396  double& efficiencyScaleFactor) const
397 {
398  // We pass only one variation per time
399  // The applied systematic is always one systematic.
400  // Either is relevant and acquires a value
401  // or stays 0.
402  double sys(0);
403 
404  // Let's try to figure already what we are to do
405  bool doSFOnly = appliedSystematics().empty();
406  bool doToys = (m_correlation_model == correlationModel::MCTOYS ||
408  bool isTotal = (m_correlation_model == correlationModel::TOTAL);
409  bool isFull = (m_correlation_model == correlationModel::FULL);
410  bool isSimplified = (m_correlation_model == correlationModel::SIMPLIFIED);
411 
412  // Lets see if we have an uncorrelated syst variation passed
413  int unCorrSign = 0;
414  // or a correlated one
415  int indexCorrelated = -999;
416  int correlatedSign = 0;
417  if (!(doSFOnly || doToys || isTotal) && (isFull || isSimplified)) {
418  const auto& sysName = appliedSystematics().begin()->name();
419  bool isUncorr = (sysName.find("UncorrUnc") != std::string::npos);
420  int currentUncorReg = -999;
421  if (isUncorr) {
422  // Can we find an uncorrelated region?
423  if (isFull) {
424  currentUncorReg = currentUncorrSystRegion(cluster_eta, et);
425  } else if (isSimplified) {
426  currentUncorReg = currentSimplifiedUncorrSystRegion(cluster_eta, et);
427  }
428  if (currentUncorReg < 0) {
430  }
431  // And use it to if we got the "right" syst variation
432  if (appliedSystematics().matchSystematic(
433  m_uncorrVarDown[currentUncorReg])) {
434  unCorrSign = -1;
435  } else if (appliedSystematics().matchSystematic(
436  m_uncorrVarUp[currentUncorReg])) {
437  unCorrSign = 1;
438  }
439  } else if (m_nCorrSyst != 0) {//if we have 0 we do not care ...
440  if (sysName.find("CorrUnc") != std::string::npos) {
441  // given the name convention we
442  const auto varNumEnd = sysName.rfind("__");
443  const auto varNumBegin = sysName.rfind("NP") + 2;
444  const int varIndex =
445  std::stoi(sysName.substr(varNumBegin, (varNumEnd - varNumBegin)));
446  if (appliedSystematics().matchSystematic(m_corrVarUp[varIndex])) {
447  indexCorrelated = varIndex;
448  correlatedSign = 1;
449  } else if (appliedSystematics().matchSystematic(
450  m_corrVarDown[varIndex])) {
451  indexCorrelated = varIndex;
452  correlatedSign = -1;
453  }
454  } // find CorrUncertainty in name
455  } // not Uncorr and we have CorrSyst
456  } // Not (SF or toys or total)
457 
458  // Now lets do the call
459  // For now we more or less calculate on demand only
460  // the Correlated and the toys we can see if we want
461  // top opt also the "TOTAL"
463  const int status =
464  m_rootTool->calculate(m_dataType, runNumber, cluster_eta, et, /* in MeV */
465  result, isTotal);
466 
467  // if status 0 something went wrong
468  if (!status) {
469  efficiencyScaleFactor = 1;
471  }
472  // At this point we have the SF
473  efficiencyScaleFactor = result.SF;
474  //And if all we need we can return
475  if (doSFOnly) {
476  return CP::CorrectionCode::Ok;
477  }
478 
479  // First the logic if the user requested toys
480  if (doToys) {
482  toy.second = m_scale_toys;
483  sys = result.toys[toy.first - 1] * m_scale_toys;
484  // return here for Toy variations
485  efficiencyScaleFactor = sys;
486  return CP::CorrectionCode::Ok;
487  }
488  // The "TOTAL" single uncertainty uncorrelated+correlated
489  else if (isTotal) {
490  sys = result.Total;
491  if (appliedSystematics().matchSystematic(m_uncorrVarUp[0])) {
492  return HelperFunc(efficiencyScaleFactor, sys);
493  }
494  if (appliedSystematics().matchSystematic(m_uncorrVarDown[0])) {
495  return HelperFunc(efficiencyScaleFactor, -1 * sys);
496  }
497  }
498  // Then the uncorrelated part for the SiMPLIFIED/FULL models
499  else if (unCorrSign!=0) {
500  sys = unCorrSign * result.UnCorr;
501  return HelperFunc(efficiencyScaleFactor, sys);
502  }
503 
504  // If we reach this point
505  // it means we need to do the correlated part
506  // for the FULL/SIMPLIFIED models.
507  // First if there are not correlated systematic
508  if (m_nCorrSyst == 0) {
509 
510  if (appliedSystematics().matchSystematic(m_corrVarUp[0])) {
511  sys = std::sqrt(result.Total * result.Total -
512  result.UnCorr * result.UnCorr); // total
513  // -stat
514  return HelperFunc(efficiencyScaleFactor, sys);
515  }
516  if (appliedSystematics().matchSystematic(m_corrVarDown[0])) {
517  sys = -1 * std::sqrt(result.Total * result.Total -
518  result.UnCorr * result.UnCorr); // total
519  // -stat
520  return HelperFunc(efficiencyScaleFactor, sys);
521  }
522  }
523  //or if we had
524  if (correlatedSign != 0) {
525  sys = correlatedSign * result.Corr[indexCorrelated];
526  return HelperFunc(efficiencyScaleFactor, sys);
527  }
528  return CP::CorrectionCode::Ok;
529 }
530 
533  const xAOD::Electron& inputObject) const
534 {
535  double efficiencyScaleFactor = 1.0;
537  getEfficiencyScaleFactor(inputObject, efficiencyScaleFactor);
539  m_resultName + "SF");
540  dec(inputObject) = efficiencyScaleFactor;
541  return result;
542 }
543 
544 /*
545  * Systematics Interface
546  */
548 bool
550  const CP::SystematicVariation& systematic) const
551 {
552  if (systematic.empty()) {
553  return false;
554  }
558  return (sys.begin()->ensembleContains(systematic));
559  } else {
560  return (sys.find(systematic) != sys.end());
561  }
562 }
566 {
567  return m_affectedSys;
568 }
569 // Register the systematics with the registry and add them to the recommended
570 // list
573 {
575 
576  if (registry.registerSystematics(*this) != StatusCode::SUCCESS) {
578  "Failed to add systematic to list of recommended systematics.");
579  return StatusCode::FAILURE;
580  }
581  return StatusCode::SUCCESS;
582 }
586 {
587  return affectingSystematics();
588 }
592  const CP::SystematicSet& systConfig)
593 {
594  // First, check if this configuration exists in the filtered map/registy
595  auto itr = m_systFilter.find(systConfig);
596 
597  if (itr != m_systFilter.end()) {
598  CP::SystematicSet& mySysConf = itr->second;
599  m_appliedSystematics = &mySysConf;
600  }
601  // if not, we should register it, after it passes sanity checks
602  else {
603  // If it's a new input set, we need to filter it
604  CP::SystematicSet affectingSys = affectingSystematics();
605  CP::SystematicSet filteredSys;
607  systConfig, affectingSys, filteredSys)) {
609  "Unsupported combination of systematic variations passed to the tool!");
610  return StatusCode::FAILURE;
611  }
612  // Does filtered make sense, only one per time
613  if (filteredSys.size() > 1) {
615  "More than one systematic variation passed at the same time");
616  return StatusCode::FAILURE;
617  }
618 
619  if (filteredSys.empty() && !systConfig.empty()) {
620  ATH_MSG_DEBUG("systematics : ");
621  for (const auto& syst : systConfig) {
622  ATH_MSG_DEBUG(syst.name());
623  }
624  ATH_MSG_DEBUG(" Not supported ");
625  }
626  // insert to the registy
627  itr = m_systFilter.insert(std::make_pair(systConfig, filteredSys)).first;
628  // And return directly
629  CP::SystematicSet& mySysConf = itr->second;
630  m_appliedSystematics = &mySysConf;
631  }
632  return StatusCode::SUCCESS;
633 }
634 
635 /*
636  * Helper Methods
637  */
640 {
641  const std::string prefix = "EL_EFF_" + m_sysSubstring;
642  const std::string prefixUncorr = prefix + m_correlation_model_name + "_";
643  // Toys
645  m_toysBasename = prefix + "COMBMCTOY";
649  m_toysBasename = prefix + "MCTOY";
652  // Correlated for the different models (1 or Full set)
654  if (m_nCorrSyst == 0) {
655  auto varUp = CP::SystematicVariation(prefix + "CorrUncertainty", 1);
656  auto varDown = CP::SystematicVariation(prefix + "CorrUncertainty", -1);
657  m_corrVarUp.push_back(varUp);
658  m_corrVarDown.push_back(varDown);
659  m_affectedSys.insert(varUp);
660  m_affectedSys.insert(varDown);
661  } else
662  for (int i = 0; i < m_nCorrSyst; ++i) {
663  auto varUp =
664  CP::SystematicVariation(prefix + Form("CorrUncertaintyNP%d", i), 1);
665  auto varDown =
666  CP::SystematicVariation(prefix + Form("CorrUncertaintyNP%d", i), -1);
667  m_corrVarUp.push_back(varUp);
668  m_corrVarDown.push_back(varDown);
669  m_affectedSys.insert(varUp);
670  m_affectedSys.insert(varDown);
671  }
672  }
673  // Different tratement for the uncorrelated per model
675  auto varUp = CP::SystematicVariation(prefixUncorr + "1NPCOR_PLUS_UNCOR", 1);
676  auto varDown =
677  CP::SystematicVariation(prefixUncorr + "1NPCOR_PLUS_UNCOR", -1);
678  m_uncorrVarUp.push_back(varUp);
679  m_uncorrVarDown.push_back(varDown);
680  m_affectedSys.insert(varUp);
681  m_affectedSys.insert(varDown);
683  for (int i = 0; i < m_nUncorrSyst; ++i) {
684  auto varUp = CP::SystematicVariation(
685  prefixUncorr + Form("UncorrUncertaintyNP%d", i), 1);
686  auto varDown = CP::SystematicVariation(
687  prefixUncorr + Form("UncorrUncertaintyNP%d", i), -1);
688  m_uncorrVarUp.push_back(varUp);
689  m_uncorrVarDown.push_back(varDown);
690  m_affectedSys.insert(varUp);
691  m_affectedSys.insert(varDown);
692  }
694  for (int i = 0; i < m_nSimpleUncorrSyst; ++i) {
695  auto varUp = CP::SystematicVariation(
696  prefixUncorr + Form("UncorrUncertaintyNP%d", i), 1);
697  auto varDown = CP::SystematicVariation(
698  prefixUncorr + Form("UncorrUncertaintyNP%d", i), -1);
699  m_uncorrVarUp.push_back(varUp);
700  m_uncorrVarDown.push_back(varDown);
701  m_affectedSys.insert(varUp);
702  m_affectedSys.insert(varDown);
703  }
704  }
705  return StatusCode::SUCCESS;
706 }
707 
708 int
710  const double cluster_eta,
711  const double et) const
712 {
713  int ptbin = std::as_const(*m_UncorrRegions).GetXaxis()->FindBin(et) - 1;
714  if (ptbin < 0 ||
715  ptbin >= std::as_const(*m_UncorrRegions).GetXaxis()->GetNbins()) {
717  " Found electron with Et = "
718  << et / 1000. << " GeV, where you specified boundaries of ["
719  << std::as_const(*m_UncorrRegions).GetXaxis()->GetBinLowEdge(1) << ","
720  << std::as_const(*m_UncorrRegions)
721  .GetXaxis()
722  ->GetBinUpEdge(
723  std::as_const(*m_UncorrRegions).GetXaxis()->GetNbins())
724  << "] for the SIMPLIFIED correlation model ");
725  return -1;
726  }
727  int etabin =
728  std::as_const(*m_UncorrRegions).GetYaxis()->FindBin(std::abs(cluster_eta)) -
729  1;
730  if (etabin < 0 ||
731  etabin >= std::as_const(*m_UncorrRegions).GetYaxis()->GetNbins()) {
733  " Found electron with |eta| = "
734  << std::abs(cluster_eta) << ", where you specified boundaries of ["
735  << std::as_const(*m_UncorrRegions).GetYaxis()->GetBinLowEdge(1) << ","
736  << std::as_const(*m_UncorrRegions)
737  .GetYaxis()
738  ->GetBinUpEdge(
739  std::as_const(*m_UncorrRegions).GetYaxis()->GetNbins())
740  << "] for the SIMPLIFIED correlation model ");
741  return -1;
742  }
743  int reg = ((etabin)*m_UncorrRegions->GetNbinsX() + ptbin);
744  return reg;
745 }
746 
747 int
749  const double cluster_eta,
750  const double et) const
751 {
752  int etabin = 0;
753  int reg = 0;
754  bool found = false;
755  float cluster_eta_electron = 0;
756  auto itr_ptBEGIN = m_pteta_bins.begin();
757  auto itr_ptEND = m_pteta_bins.end();
758  for (; itr_ptBEGIN != itr_ptEND; ++itr_ptBEGIN) {
759  auto itr_ptBEGINplusOne = itr_ptBEGIN;
760  ++itr_ptBEGINplusOne;
761  // Find the pt bin : Larger or equal from the current and the next one is
762  // the last or the next one is larger.
763  if (et >= itr_ptBEGIN->first &&
764  (itr_ptBEGINplusOne == itr_ptEND || et < itr_ptBEGINplusOne->first)) {
765  if ((itr_ptBEGIN->second).at(0) >= 0) {
766  cluster_eta_electron = std::abs(cluster_eta);
767  } else {
768  cluster_eta_electron = (cluster_eta);
769  };
770  for (unsigned int etab = 0; etab < ((itr_ptBEGIN->second).size());
771  ++etab) {
772  unsigned int etabnext = etab + 1;
773  // Find the eta bin : Larger or equal from the current and the next one
774  // is the last or the next one is larger:.
775  if ((cluster_eta_electron) >= (itr_ptBEGIN->second).at(etab) &&
776  (etabnext == itr_ptBEGIN->second.size() ||
777  cluster_eta_electron < itr_ptBEGIN->second.at(etabnext))) {
778  found = true;
779  break;
780  }
781  // We did not find it. Increment eta and continue looking
782  etabin++;
783  }
784  }
785  if (found) {
786  break;
787  }
788  // Add the full size of the "passed" eta row
789  reg += (itr_ptBEGIN->second).size();
790  }
791  if (!found) {
792  ATH_MSG_WARNING("No index for the uncorrelated systematic was found, "
793  "returning the maximum index");
794  return m_nCorrSyst;
795  }
796  reg = reg + etabin;
797  return reg;
798 }
799 
800 int
802  const xAOD::Electron& inputObject) const
803 {
804  int currentSystRegion = -999;
805  double cluster_eta(-9999.9);
806  double et(0.0);
807 
808  et = inputObject.pt();
809  const xAOD::CaloCluster* cluster = inputObject.caloCluster();
810  if (!cluster) {
811  ATH_MSG_ERROR("ERROR no cluster associated to the Electron \n");
812  return currentSystRegion;
813  }
814  cluster_eta = cluster->etaBE(2);
815  switch (m_correlation_model) {
817  currentSystRegion = currentSimplifiedUncorrSystRegion(cluster_eta, et);
818  break;
819  }
820  case correlationModel::FULL: {
821  currentSystRegion = currentUncorrSystRegion(cluster_eta, et);
822  break;
823  }
824  default: {
825  // not there for the other models
826  break;
827  }
828  }
829  return currentSystRegion;
830 }
831 
835  const std::string& idkey,
836  const std::string& isokey,
837  const std::string& trigkey)
838 {
839 
840  std::string mapFileName = PathResolverFindCalibFile(m_mapFile);
841  std::string key =
842  ElRecomFileHelpers::convertToOneKey(recokey, idkey, isokey, trigkey);
843  std::string value = ElRecomFileHelpers::getValueByKey(mapFileName, key);
844 
845  if (!value.empty()) {
846  m_corrFileNameList.push_back(value);
847  } else {
848  if (mapFileName.empty()) {
850  "Map file does not exist, Please set the path and version properly..");
851  } else {
853  "Key "
854  << key
855  << " does not exist in the map file, Please configure it properly..");
856  }
857  return StatusCode::FAILURE;
858  }
859 
860  ATH_MSG_DEBUG("Full File Name is " + value);
861  return StatusCode::SUCCESS;
862 }
863 /*
864  * Metadata methods.
865  * The tool operates in MC .
866  * The default type is Full sim.
867  *
868  * The user can override the MC type
869  * in which case we avoid doing anything.
870  *
871  * The typical scenario is :
872  * For every IncidentType::BeginInputFile we can check for metadata
873  * and try to employ them in determining the simulation Flavor.
874  * If we found metadata
875  * set m_metadata_retrieved= True else set it to False
876  *
877  * EndInputFile should not do something
878  *
879  * The beginEvent should kick in only if the beginInputFile has
880  * failed to find metadata and the user has no preference.
881  * Asg/base class has our back in cases where the 1st beginEvent
882  * happens before the 1st beginInputFile.
883  * For now we can not do something meaningfull in this method
884  * for this tool so can stay as a skeleton for the future
885  */
888 {
889 
890  // User forced a particular dataType
891  if (m_dataTypeOverwrite != -1)
892  return StatusCode::SUCCESS;
893 
894  PATCore::ParticleDataType::DataType dataType_metadata;
895  const StatusCode status = get_simType_from_metadata(dataType_metadata);
896  // Metadata got retrieved
897  if (status == StatusCode::SUCCESS) {
898  m_metadata_retrieved = true;
899  ATH_MSG_DEBUG("metadata from new file: "
900  << (dataType_metadata == PATCore::ParticleDataType::Data
901  ? "data"
902  : (dataType_metadata == PATCore::ParticleDataType::Full
903  ? "full simulation"
904  : "fast simulation")));
905 
906  if (dataType_metadata != PATCore::ParticleDataType::Data) {
907  if (m_dataTypeOverwrite == -1) {
908  m_dataType = dataType_metadata;
909  } else {
911  "Applying SF corrections to data while they make sense only for MC");
912  }
913  }
914  } else { // not able to retrieve metadata
915  m_metadata_retrieved = false;
916  ATH_MSG_DEBUG("not able to retrieve metadata");
917  }
918  return StatusCode::SUCCESS;
919 }
920 
923 {
924 
925  if (m_dataTypeOverwrite != -1)
926  return StatusCode::SUCCESS;
928  return StatusCode::SUCCESS;
929 
930  m_metadata_retrieved = true;
931  return StatusCode::SUCCESS;
932 }
933 
937 {
938 
939 #ifndef XAOD_STANDALONE
940  // Determine MC/Data
941  std::string dataType("");
943  "/TagInfo", "project_name", dataType, inputMetaStore()))
944  .isSuccess()) {
945  if (!(dataType == "IS_SIMULATION")) {
947  ATH_MSG_DEBUG("Running on data");
948  return StatusCode::SUCCESS;
949  }
950  // Determine Fast/FullSim
951  if (dataType == "IS_SIMULATION") {
952  std::string simType("");
953  ATH_CHECK(AthAnalysisHelper::retrieveMetadata("/Simulation/Parameters",
954  "SimulationFlavour",
955  simType,
956  inputMetaStore()));
957  std::transform(simType.begin(), simType.end(), simType.begin(), ::toupper);
958  result = (simType.find("ATLFAST") == std::string::npos)
961  return StatusCode::SUCCESS;
962  }
963  }
964 #endif
965  // Here's how things will work dual use, when file metadata is available in
966  // files
967  if (inputMetaStore()->contains<xAOD::FileMetaData>("FileMetaData")) {
968  const xAOD::FileMetaData* fmd = nullptr;
969  ATH_CHECK(inputMetaStore()->retrieve(fmd, "FileMetaData"));
970 
971  std::string simType("");
972  const bool s = fmd->value(xAOD::FileMetaData::simFlavour, simType);
973  if (!s) {
974  ATH_MSG_DEBUG("no sim flavour from metadata: must be data");
976  return StatusCode::SUCCESS;
977  } else {
978  ATH_MSG_DEBUG("sim type = " + simType);
979  std::transform(simType.begin(), simType.end(), simType.begin(), ::toupper);
980  result = (simType.find("ATLFAST") == std::string::npos)
983  return StatusCode::SUCCESS;
984  }
985  } else { // no metadata in the file
986  ATH_MSG_DEBUG("no metadata found in the file");
987  return StatusCode::FAILURE;
988  }
989 }
990 
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
AsgElectronEfficiencyCorrectionTool::getFile
virtual StatusCode getFile(const std::string &recokey, const std::string &idkey, const std::string &isokey, const std::string &trigkey)
Gets the correction filename from map.
Definition: AsgElectronEfficiencyCorrectionTool.cxx:834
python.Dso.registry
registry
Definition: Control/AthenaServices/python/Dso.py:159
AsgElectronEfficiencyCorrectionTool::m_correlation_model
int m_correlation_model
Definition: AsgElectronEfficiencyCorrectionTool.h:154
CaloCondBlobAlgs_fillNoiseFromASCII.sysName
sysName
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:93
AsgElectronEfficiencyCorrectionTool::applySystematicVariation
virtual StatusCode applySystematicVariation(const CP::SystematicSet &systConfig) override final
Configure this tool for the given systematics.
Definition: AsgElectronEfficiencyCorrectionTool.cxx:591
et
Extra patterns decribing particle interation process.
CP::SystematicSet::getToyVariationByBaseName
std::pair< unsigned, float > getToyVariationByBaseName(const std::string &basename) const
the toy variation for the given basename
Definition: SystematicSet.cxx:201
AsgElectronEfficiencyCorrectionTool::m_corrFileNameList
std::vector< std::string > m_corrFileNameList
The list of file names.
Definition: AsgElectronEfficiencyCorrectionTool.h:166
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
AsgElectronEfficiencyCorrectionTool::recommendedSystematics
virtual CP::SystematicSet recommendedSystematics() const override final
returns: the list of all systematics this tool recommends to use
Definition: AsgElectronEfficiencyCorrectionTool.cxx:585
get_generator_info.result
result
Definition: get_generator_info.py:21
AsgElectronEfficiencyCorrectionTool::m_idKey
std::string m_idKey
Definition: AsgElectronEfficiencyCorrectionTool.h:161
AsgElectronEfficiencyCorrectionTool::m_appliedSystematics
CP::SystematicSet * m_appliedSystematics
Currently applied systematics.
Definition: AsgElectronEfficiencyCorrectionTool.h:150
AsgElectronEfficiencyCorrectionTool::m_rootTool
std::unique_ptr< Root::TElectronEfficiencyCorrectionTool > m_rootTool
Pointer to the underlying ROOT based tool.
Definition: AsgElectronEfficiencyCorrectionTool.h:141
AsgElectronEfficiencyCorrectionTool::m_mapFile
std::string m_mapFile
Definition: AsgElectronEfficiencyCorrectionTool.h:157
AsgElectronEfficiencyCorrectionTool::InitSystematics
StatusCode InitSystematics()
initialize the systematics
Definition: AsgElectronEfficiencyCorrectionTool.cxx:639
correlationModel::FULL
@ FULL
Definition: AsgElectronEfficiencyCorrectionTool.cxx:49
xAOD::et
et
Definition: TrigEMCluster_v1.cxx:25
SG::Accessor
Helper class to provide type-safe access to aux data.
Definition: Control/AthContainers/AthContainers/Accessor.h:68
AsgElectronEfficiencyCorrectionTool::m_uncorrSimplfEtaBinsUser
std::vector< float > m_uncorrSimplfEtaBinsUser
Definition: AsgElectronEfficiencyCorrectionTool.h:205
CP::SystematicSet::size
size_t size() const
returns: size of the set
Definition: SystematicSet.h:71
CP::SystematicSet::empty
bool empty() const
returns: whether the set is empty
Definition: SystematicSet.h:67
PATCore::ParticleDataType::Fast
@ Fast
Definition: PATCoreEnums.h:22
asg
Definition: DataHandleTestTool.h:28
ElRecomFileHelpers.h
AsgElectronEfficiencyCorrectionTool::m_useRandomRunNumber
bool m_useRandomRunNumber
Definition: AsgElectronEfficiencyCorrectionTool.h:181
CP::SystematicSet
Class to wrap a set of SystematicVariations.
Definition: SystematicSet.h:31
correlationModel::SYST
@ SYST
Definition: AsgElectronEfficiencyCorrectionTool.cxx:52
AsgElectronEfficiencyCorrectionTool::currentUncorrSystRegion
int currentUncorrSystRegion(const double cluster_eta, const double et) const
Definition: AsgElectronEfficiencyCorrectionTool.cxx:748
downloadSingle.dataType
string dataType
Definition: downloadSingle.py:18
asg::AsgMetadataTool::inputMetaStore
MetaStorePtr_t inputMetaStore() const
Accessor for the input metadata store.
Definition: AsgMetadataTool.cxx:88
AsgElectronEfficiencyCorrectionTool::initialize
virtual StatusCode initialize() override final
Gaudi Service Interface method implementations.
Definition: AsgElectronEfficiencyCorrectionTool.cxx:150
AsgElectronEfficiencyCorrectionTool::registerSystematics
StatusCode registerSystematics()
Definition: AsgElectronEfficiencyCorrectionTool.cxx:572
athena.value
value
Definition: athena.py:124
SG::ConstAccessor
Helper class to provide constant type-safe access to aux data.
Definition: ConstAccessor.h:55
AsgElectronEfficiencyCorrectionTool::m_resultName
std::string m_resultName
The string for the result.
Definition: AsgElectronEfficiencyCorrectionTool.h:172
AsgElectronEfficiencyCorrectionTool.h
xAOD::EgammaParameters::AuthorFwdElectron
const uint16_t AuthorFwdElectron
Electron reconstructed by the Forward cluster-based algorithm.
Definition: EgammaDefs.h:30
AsgElectronEfficiencyCorrectionTool::m_correlation_model_name
std::string m_correlation_model_name
Definition: AsgElectronEfficiencyCorrectionTool.h:153
CP::SystematicVariation
Definition: SystematicVariation.h:47
python.TrigEgammaMonitorHelper.TH2F
def TH2F(name, title, nxbins, bins_par2, bins_par3, bins_par4, bins_par5=None, bins_par6=None, path='', **kwargs)
Definition: TrigEgammaMonitorHelper.py:45
PATCore::ParticleDataType::Data
@ Data
Definition: PATCoreEnums.h:22
mapkey::sys
@ sys
Definition: TElectronEfficiencyCorrectionTool.cxx:42
AsgElectronEfficiencyCorrectionTool::m_defaultRandomRunNumber
int m_defaultRandomRunNumber
Definition: AsgElectronEfficiencyCorrectionTool.h:182
AsgElectronEfficiencyCorrectionTool::beginInputFile
virtual StatusCode beginInputFile() override final
Function called when a new input file is opened.
Definition: AsgElectronEfficiencyCorrectionTool.cxx:887
AsgElectronEfficiencyCorrectionTool::m_dataType
PATCore::ParticleDataType::DataType m_dataType
Definition: AsgElectronEfficiencyCorrectionTool.h:185
PATCore::ParticleDataType::DataType
DataType
Definition: PATCoreEnums.h:22
python.iconfTool.models.loaders.level
level
Definition: loaders.py:20
xAOD::FileMetaData_v1::value
bool value(MetaDataType type, std::string &val) const
Get a pre-defined string value out of the object.
Definition: FileMetaData_v1.cxx:195
AsgElectronEfficiencyCorrectionTool::m_isoKey
std::string m_isoKey
Definition: AsgElectronEfficiencyCorrectionTool.h:162
xAOD::FileMetaData_v1::simFlavour
@ simFlavour
Fast or Full sim [string].
Definition: FileMetaData_v1.h:76
PATCore::ParticleDataType::Full
@ Full
Definition: PATCoreEnums.h:22
xAOD::CaloCluster_v1::etaBE
float etaBE(const unsigned layer) const
Get the eta in one layer of the EM Calo.
Definition: CaloCluster_v1.cxx:644
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
correlationModel::MCTOYS
@ MCTOYS
Definition: AsgElectronEfficiencyCorrectionTool.cxx:48
AsgElectronEfficiencyCorrectionTool::m_uncorrSimplfEtBinsUser
std::vector< float > m_uncorrSimplfEtBinsUser
Definition: AsgElectronEfficiencyCorrectionTool.h:206
AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:85
CP::CorrectionCode::OutOfValidityRange
@ OutOfValidityRange
Input object is out of validity range.
Definition: CorrectionCode.h:37
Root::TElectronEfficiencyCorrectionTool::Result
Definition: TElectronEfficiencyCorrectionTool.h:42
CP::CorrectionCode::Error
@ Error
Some error happened during the object correction.
Definition: CorrectionCode.h:36
xAOD::CaloCluster_v1
Description of a calorimeter cluster.
Definition: CaloCluster_v1.h:59
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
ParticleGun_FastCalo_ChargeFlip_Config.energy
energy
Definition: ParticleGun_FastCalo_ChargeFlip_Config.py:78
AsgElectronEfficiencyCorrectionTool::m_toysBasename
std::string m_toysBasename
Definition: AsgElectronEfficiencyCorrectionTool.h:213
SG::Decorator
Helper class to provide type-safe access to aux data.
Definition: Decorator.h:59
xAOD::CaloCluster_v1::eta
virtual double eta() const
The pseudorapidity ( ) of the particle.
Definition: CaloCluster_v1.cxx:251
lumiFormat.i
int i
Definition: lumiFormat.py:85
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
AsgElectronEfficiencyCorrectionTool::m_uncorrVarDown
std::vector< CP::SystematicVariation > m_uncorrVarDown
Definition: AsgElectronEfficiencyCorrectionTool.h:217
PlotPulseshapeFromCool.input
input
Definition: PlotPulseshapeFromCool.py:106
PATCoreEnums.h
xAOD::Egamma_v1::caloCluster
const xAOD::CaloCluster * caloCluster(size_t index=0) const
Pointer to the xAOD::CaloCluster/s that define the electron candidate.
Definition: Egamma_v1.cxx:388
AsgElectronEfficiencyCorrectionTool::m_nCorrSyst
int m_nCorrSyst
Definition: AsgElectronEfficiencyCorrectionTool.h:200
Amg::transform
Amg::Vector3D transform(Amg::Vector3D &v, Amg::Transform3D &tr)
Transform a point from a Trasformation3D.
Definition: GeoPrimitivesHelpers.h:156
AsgElectronEfficiencyCorrectionTool::m_recoKey
std::string m_recoKey
Definition: AsgElectronEfficiencyCorrectionTool.h:160
AsgElectronEfficiencyCorrectionTool::appliedSystematics
virtual const CP::SystematicSet & appliedSystematics() const override final
returns: the currently applied systematics
Definition: AsgElectronEfficiencyCorrectionTool.h:102
checkCorrelInHIST.prefix
dictionary prefix
Definition: checkCorrelInHIST.py:391
AsgElectronEfficiencyCorrectionTool::m_number_of_toys
int m_number_of_toys
Definition: AsgElectronEfficiencyCorrectionTool.h:191
AsgElectronEfficiencyCorrectionTool::m_resultPrefix
std::string m_resultPrefix
The prefix string for the result.
Definition: AsgElectronEfficiencyCorrectionTool.h:169
AsgElectronEfficiencyCorrectionTool::systUncorrVariationIndex
virtual int systUncorrVariationIndex(const xAOD::Electron &inputObject) const override final
Definition: AsgElectronEfficiencyCorrectionTool.cxx:801
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
AsgElectronEfficiencyCorrectionTool::m_seed_toys
int m_seed_toys
Definition: AsgElectronEfficiencyCorrectionTool.h:194
AsgElectronEfficiencyCorrectionTool::applyEfficiencyScaleFactor
virtual CP::CorrectionCode applyEfficiencyScaleFactor(const xAOD::Electron &inputObject) const override final
Definition: AsgElectronEfficiencyCorrectionTool.cxx:532
AsgElectronEfficiencyCorrectionTool::m_nUncorrSyst
int m_nUncorrSyst
Definition: AsgElectronEfficiencyCorrectionTool.h:201
DeMoUpdate.tmp
string tmp
Definition: DeMoUpdate.py:1167
correlationModel::COMBMCTOYS
@ COMBMCTOYS
Definition: AsgElectronEfficiencyCorrectionTool.cxx:47
xAOD::FileMetaData_v1
Class holding file-level metadata about an xAOD file.
Definition: FileMetaData_v1.h:34
AsgElectronEfficiencyCorrectionTool::m_scale_toys
double m_scale_toys
Definition: AsgElectronEfficiencyCorrectionTool.h:197
AsgElectronEfficiencyCorrectionTool::m_dataTypeOverwrite
int m_dataTypeOverwrite
Force the data type to a given value.
Definition: AsgElectronEfficiencyCorrectionTool.h:188
AsgElectronEfficiencyCorrectionTool::m_corrVarDown
std::vector< CP::SystematicVariation > m_corrVarDown
Definition: AsgElectronEfficiencyCorrectionTool.h:215
PathResolver.h
AsgElectronEfficiencyCorrectionTool::~AsgElectronEfficiencyCorrectionTool
virtual ASG_TOOL_CLASS(AsgElectronEfficiencyCorrectionTool, IAsgElectronEfficiencyCorrectionTool) public ~AsgElectronEfficiencyCorrectionTool() override final
Standard destructor.
Definition: AsgElectronEfficiencyCorrectionTool.cxx:142
CP::SystematicSet::insert
void insert(const SystematicVariation &systematic)
description: insert a systematic into the set
Definition: SystematicSet.cxx:88
correlationModel::SIMPLIFIED
@ SIMPLIFIED
Definition: AsgElectronEfficiencyCorrectionTool.cxx:50
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
AsgElectronEfficiencyCorrectionTool::getEfficiencyScaleFactor
virtual CP::CorrectionCode getEfficiencyScaleFactor(const xAOD::Electron &inputObject, double &efficiencyScaleFactor) const override final
Definition: AsgElectronEfficiencyCorrectionTool.cxx:329
AsgElectronEfficiencyCorrectionTool::m_systFilter
std::unordered_map< CP::SystematicSet, CP::SystematicSet > m_systFilter
Systematics filter map.
Definition: AsgElectronEfficiencyCorrectionTool.h:144
ParticleDataType
Information about type of data used to fill particle.
Definition: Event/EventKernel/EventKernel/IParticle.h:35
AsgElectronEfficiencyCorrectionTool::m_eventInfoCollectionName
std::string m_eventInfoCollectionName
The Event info collection name.
Definition: AsgElectronEfficiencyCorrectionTool.h:178
AsgElectronEfficiencyCorrectionTool::get_simType_from_metadata
StatusCode get_simType_from_metadata(PATCore::ParticleDataType::DataType &result) const
Definition: AsgElectronEfficiencyCorrectionTool.cxx:935
AsgElectronEfficiencyCorrectionTool::m_trigKey
std::string m_trigKey
Definition: AsgElectronEfficiencyCorrectionTool.h:163
AsgElectronEfficiencyCorrectionTool::affectingSystematics
virtual CP::SystematicSet affectingSystematics() const override final
returns: the list of all systematics this tool can be affected by
Definition: AsgElectronEfficiencyCorrectionTool.cxx:565
xAOD::Electron_v1
Definition: Electron_v1.h:34
AsgElectronEfficiencyCorrectionTool::isAffectedBySystematic
virtual bool isAffectedBySystematic(const CP::SystematicVariation &systematic) const override final
returns: whether this tool is affected by the given systematis
Definition: AsgElectronEfficiencyCorrectionTool.cxx:549
EventInfo.h
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
AsgElectronEfficiencyCorrectionTool::m_uncorrVarUp
std::vector< CP::SystematicVariation > m_uncorrVarUp
Definition: AsgElectronEfficiencyCorrectionTool.h:216
AthAnalysisHelper.h
DeMoAtlasDataLoss.runNumber
string runNumber
Definition: DeMoAtlasDataLoss.py:64
CP::CorrectionCode::Ok
@ Ok
The correction was done successfully.
Definition: CorrectionCode.h:38
correlationModel
Definition: AsgElectronEfficiencyCorrectionTool.cxx:44
AsgElectronEfficiencyCorrectionTool::beginEvent
virtual StatusCode beginEvent() override final
Function called when a new events is loaded.
Definition: AsgElectronEfficiencyCorrectionTool.cxx:922
FileMetaData.h
ElRecomFileHelpers::convertToOneKey
std::string convertToOneKey(const std::string &recokey, const std::string &idkey, const std::string &isokey, const std::string &trigkey)
Definition: ElRecomFileHelpers.cxx:38
CondAlgsOpts.found
int found
Definition: CondAlgsOpts.py:101
mapkey::sf
@ sf
Definition: TElectronEfficiencyCorrectionTool.cxx:38
AsgElectronEfficiencyCorrectionTool::m_nSimpleUncorrSyst
int m_nSimpleUncorrSyst
Definition: AsgElectronEfficiencyCorrectionTool.h:210
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
CP::SystematicVariation::empty
bool empty() const
returns: whether this is an empty systematic, i.e.
Definition: SystematicVariation.cxx:294
CP::SystematicRegistry
This module implements the central registry for handling systematic uncertainties with CP tools.
Definition: SystematicRegistry.h:25
correlationModel::model
model
Definition: AsgElectronEfficiencyCorrectionTool.cxx:46
AsgElectronEfficiencyCorrectionTool::m_affectedSys
CP::SystematicSet m_affectedSys
Affected systematic, should be done only once.
Definition: AsgElectronEfficiencyCorrectionTool.h:147
CP::SystematicSet::begin
const_iterator begin() const
description: const iterator to the beginning of the set
Definition: SystematicSet.h:55
DeMoScan.first
bool first
Definition: DeMoScan.py:536
AsgElectronEfficiencyCorrectionTool::m_corrVarUp
std::vector< CP::SystematicVariation > m_corrVarUp
Definition: AsgElectronEfficiencyCorrectionTool.h:214
AsgElectronEfficiencyCorrectionTool::m_UncorrRegions
TH2F * m_UncorrRegions
Definition: AsgElectronEfficiencyCorrectionTool.h:209
AthCommonMsg< AlgTool >::msg
MsgStream & msg() const
Definition: AthCommonMsg.h:24
CP::CorrectionCode
Return value from object correction CP tools.
Definition: CorrectionCode.h:31
CaloCellTimeCorrFiller.filename
filename
Definition: CaloCellTimeCorrFiller.py:24
xAOD::Egamma_v1::pt
virtual double pt() const override final
The transverse momentum ( ) of the particle.
Definition: Egamma_v1.cxx:65
AsgElectronEfficiencyCorrectionTool::m_pteta_bins
std::vector< std::pair< float, std::vector< float > > > m_pteta_bins
Definition: AsgElectronEfficiencyCorrectionTool.h:202
ParticleDataType::Full
@ Full
Definition: Event/EventKernel/EventKernel/IParticle.h:36
SG::ConstAccessor< T, AuxAllocator_t< T > >::isAvailable
bool isAvailable(const ELT &e) const
Test to see if this variable exists in the store.
xAOD::Egamma_v1::eta
virtual double eta() const override final
The pseudorapidity ( ) of the particle.
Definition: Egamma_v1.cxx:70
AsgElectronEfficiencyCorrectionTool::m_sysSubstring
std::string m_sysSubstring
Definition: AsgElectronEfficiencyCorrectionTool.h:175
merge.status
status
Definition: merge.py:17
AsgElectronEfficiencyCorrectionTool::m_metadata_retrieved
bool m_metadata_retrieved
To check if the metadata can be retrieved.
Definition: AsgElectronEfficiencyCorrectionTool.h:138
Electron.h
LArCellNtuple.ifile
string ifile
Definition: LArCellNtuple.py:133
PATCore
Information about type of data used to fill particle.
Definition: PATCoreEnums.h:19
ElRecomFileHelpers::getValueByKey
std::string getValueByKey(const std::string &mapFile, const std::string &key)
Definition: ElRecomFileHelpers.cxx:75
CP::SystematicVariation::makeToyEnsemble
static SystematicVariation makeToyEnsemble(const std::string &basename)
constructor for toy systematics ensemble
Definition: SystematicVariation.cxx:258
xAOD::CaloCluster_v1::e
virtual double e() const
The total energy of the particle.
Definition: CaloCluster_v1.cxx:265
CP::SystematicSet::filterForAffectingSystematics
static StatusCode filterForAffectingSystematics(const SystematicSet &systConfig, const SystematicSet &affectingSystematics, SystematicSet &filteredSystematics)
description: filter the systematics for the affected systematics returns: success guarantee: strong f...
Definition: SystematicSet.cxx:213
correlationModel::TOTAL
@ TOTAL
Definition: AsgElectronEfficiencyCorrectionTool.cxx:51
AuxElement.h
Base class for elements of a container that can have aux data.
CP::SystematicRegistry::getInstance
static SystematicRegistry & getInstance()
Get the singleton instance of the registry for the curren thread.
Definition: SystematicRegistry.cxx:25
AthAnalysisHelper::retrieveMetadata
static std::string retrieveMetadata(const std::string &folder, const std::string &key, const ServiceHandle< StoreGateSvc > &inputMetaStore)
method that always returns as a string you can use from, e.g, pyROOT with evt = ROOT....
Definition: AthAnalysisHelper.h:254
AsgElectronEfficiencyCorrectionTool::currentSimplifiedUncorrSystRegion
int currentSimplifiedUncorrSystRegion(const double cluster_eta, const double et) const
Definition: AsgElectronEfficiencyCorrectionTool.cxx:709
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37