ATLAS Offline Software
CommonSmearingTool.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 // Framework include(s):
8 
9 // local include(s)
12 
15 
16 // ROOT include(s)
17 #include "TROOT.h"
18 #include "TF1.h"
19 #include "TClass.h"
20 #include "TKey.h"
21 
22 // tauRecTools include(s)
24 
25 using namespace TauAnalysisTools;
26 /*
27  This tool acts as a common tool to apply tau energy smearing and
28  uncertainties. By default, only nominal smearings without systematic
29  variations are applied. Unavailable systematic variations are ignored, meaning
30  that the tool only returns the nominal value. In case the one available
31  systematic is requested, the smeared scale factor is computed as:
32  - pTsmearing = pTsmearing_nominal +/- n * uncertainty
33 
34  where n is in general 1 (representing a 1 sigma smearing), but can be any
35  arbitrary value. In case multiple systematic variations are passed they are
36  added in quadrature. Note that it's currently only supported if all are up or
37  down systematics.
38 
39  The tool reads in root files including TH2 histograms which need to fulfill a
40  predefined structure:
41 
42  nominal smearing:
43  - sf_<workingpoint>_<prongness>p
44  uncertainties:
45  - <NP>_<up/down>_<workingpoint>_<prongness>p (for asymmetric uncertainties)
46  - <NP>_<workingpoint>_<prongness>p (for symmetric uncertainties)
47 
48  where the <workingpoint> (e.g. loose/medium/tight) fields may be
49  optional. <prongness> represents either 1 or 3, whereas 3 is currently used
50  for multiprong in general. The <NP> fields are names for the type of nuisance
51  parameter (e.g. STAT or SYST), note the tool decides whether the NP is a
52  recommended or only an available systematic based on the first character:
53  - uppercase -> recommended
54  - lowercase -> available
55  This magic happens here:
56  - CommonSmearingTool::generateSystematicSets()
57 
58  In addition the root input file can also contain objects of type TF1 that can
59  be used to provide kind of unbinned smearings or systematics. Currently there
60  is no usecase for tau energy smearing
61 
62  The files may also include TNamed objects which is used to define how x and
63  y-axes should be treated. By default the x-axis is given in units of tau-pT in
64  GeV and the y-axis is given as tau-eta. If there is for example a TNamed
65  object with name "Yaxis" and title "|eta|" the y-axis is treated in units of
66  absolute tau eta. All this is done in:
67  - void CommonSmearingTool::ReadInputs(TFile* fFile)
68 
69  Other tools for scale factors may build up on this tool and overwrite or add
70  particular functionality.
71 */
72 
73 //______________________________________________________________________________
74 CommonSmearingTool::CommonSmearingTool(const std::string& sName)
75  : asg::AsgMetadataTool( sName )
76  , m_sSystematicSet(nullptr)
77  , m_fX(&finalTauPt)
78  , m_fY(&finalTauEta)
79  , m_bIsData(false)
80  , m_bIsConfigured(false)
81  , m_tTauCombinedTES("TauCombinedTES", this)
82  , m_eCheckTruth(TauAnalysisTools::Unknown)
83 {
84  declareProperty("InputFilePath", m_sInputFilePath = "" );
85  declareProperty("SkipTruthMatchCheck", m_bSkipTruthMatchCheck = false );
86  declareProperty("ApplyFading", m_bApplyFading = true );
87  declareProperty("ApplyMVATESQualityCheck", m_bApplyMVATESQualityCheck = false );
88  declareProperty("ApplyInsituCorrection", m_bApplyInsituCorrection = true );
89 }
90 
91 /*
92  need to clear the map of histograms cause we have the ownership, not ROOT
93 */
95 {
96  for (auto& mEntry : m_mSF)
97  delete mEntry.second;
98 }
99 
100 /*
101  - Find the root files with smearing inputs on cvmfs using PathResolver
102  (more info here:
103  https://twiki.cern.ch/twiki/bin/viewauth/AtlasComputing/PathResolver)
104  - Call further functions to process and define NP strings and so on
105  - Configure to provide nominal smearings by default
106 */
108 {
109  ATH_MSG_INFO( "Initializing CommonSmearingTool" );
110 
111  // FIXME: do we expect initialize() to be called several times?
112  // only read in histograms once
113  if (m_mSF.empty())
114  {
115  std::string sInputFilePath = PathResolverFindCalibFile(m_sInputFilePath);
116  std::unique_ptr<TFile> fSF( TFile::Open(sInputFilePath.c_str()) );
117  if(fSF == nullptr) {
118  ATH_MSG_FATAL("Could not open file " << sInputFilePath.c_str());
119  return StatusCode::FAILURE;
120  }
121  ReadInputs(fSF.get(), m_mSF);
122  fSF->Close();
123  }
124 
126 
127  // load empty systematic variation by default
128  if (applySystematicVariation(CP::SystematicSet()) != StatusCode::SUCCESS )
129  return StatusCode::FAILURE;
130 
131  // TauCombinedTES tool must be set up when checking compatibility between calo TES and MVA TES
133  {
135  ATH_CHECK(m_tTauCombinedTES.setProperty("WeightFileName", "CombinedTES_R22_Round2.5_v2.root"));
137  }
138 
139  return StatusCode::SUCCESS;
140 }
141 
142 /*
143  Retrieve the smearing value and if requested the values for the NP's and add
144  this stuff in quadrature. Finally apply the correction to the tau pt of the
145  non-const tau.
146 */
147 //______________________________________________________________________________
149 {
150  // optional consistency check between calo-only pt ("ptTauEnergyScale") and MVA pt ("ptFinalCalib" i.e. "pt", MVA TES is the default calibration)
151  // not recommended until validated in R22: MVA TES always has better resolution than calo-only TES for true taus
152  // in practice this check mostly discards muons faking taus with large track momentum but little energy deposit in the calorimeter:
153  // when enforcing calo-only pt, the muon will likely fail the tau pt cut applied by TauSelectionTool
154 
155  // WARNING: overwriting ptFinalCalib would lead to irreproducibilities upon re-calibration (re-apply in-situ TES on already-calibrated PHYSLITE)
157  bool useCaloPt = false;
158  static const SG::ConstAccessor<float> accPtTauEnergyScale ("ptTauEnergyScale");
159  if(accPtTauEnergyScale.isAvailable(xTau)) {
160  const auto combinedTEStool = dynamic_cast<const TauCombinedTES*>(m_tTauCombinedTES.get());
161  useCaloPt = combinedTEStool->getUseCaloPtFlag(xTau);
162  if (useCaloPt) {
163  // only override pt, keep eta and phi from substructure as it has likely better angular resolution than calo-only
164  ATH_MSG_DEBUG("overriding MVA pt with calo pt");
165  xTau.setP4(xAOD::TauJetParameters::FinalCalib, xTau.ptTauEnergyScale(), xTau.eta(), xTau.phi(), xTau.m());
166  xTau.setP4(xTau.ptTauEnergyScale(), xTau.eta(), xTau.phi(), xTau.m());
167  }
168  }
169  static const SG::Accessor<char> accUseCaloPt("useCaloPt");
170  accUseCaloPt(xTau) = char(useCaloPt);
171  }
172 
173  // step out here if we run on data
174  if (m_bIsData)
175  return CP::CorrectionCode::Ok;
176 
177  // check which true state is requested
179  return CP::CorrectionCode::Ok;
180  }
181 
182  // skip taus which are not 1 or 3 prong
183  if( xTau.nTracks() != 1 && xTau.nTracks() != 3) {
184  return CP::CorrectionCode::Ok;
185  }
186 
187  // get prong extension for histogram name
188  std::string sProng = ConvertProngToString(xTau.nTracks());
189 
190  double dCorrection = 1.;
191  CP::CorrectionCode tmpCorrectionCode;
193  {
194  // get standard scale factor
195  tmpCorrectionCode = getValue("sf"+sProng,
196  xTau,
197  dCorrection);
198  // return correction code if histogram is not available
199  if (tmpCorrectionCode != CP::CorrectionCode::Ok)
200  return tmpCorrectionCode;
201  }
202 
203  // skip further process if systematic set is empty
204  if (!m_sSystematicSet->empty())
205  {
206  // get uncertainties summed in quadrature
207  double dTotalSystematic2 = 0.;
208  double dDirection = 0.;
209  for (auto& syst : *m_sSystematicSet)
210  {
211  // check if systematic is available
212  auto it = m_mSystematicsHistNames.find(syst.basename());
213 
214  // get uncertainty value
215  double dUncertaintySyst = 0.;
216  tmpCorrectionCode = getValue(it->second+sProng,
217  xTau,
218  dUncertaintySyst);
219  // return correction code if histogram is not available
220  if (tmpCorrectionCode != CP::CorrectionCode::Ok)
221  return tmpCorrectionCode;
222 
223  // needed for up/down decision
224  dDirection = syst.parameter();
225 
226  // scale uncertainty with direction, i.e. +/- n*sigma
227  dUncertaintySyst *= dDirection;
228 
229  // square uncertainty and add to total uncertainty
230  dTotalSystematic2 += dUncertaintySyst * dUncertaintySyst;
231  }
232 
233  // now use dDirection to use up/down uncertainty
234  dDirection = (dDirection > 0.) ? 1. : -1.;
235 
236  // finally apply uncertainty (eff * ( 1 +/- \sum )
237  dCorrection *= 1 + dDirection * std::sqrt(dTotalSystematic2);
238  }
239 
240  // finally apply correction
241  // in-situ TES is applied w.r.t. ptFinalCalib, use explicit calibration for pt to avoid irreproducibility upon re-calibration (PHYSLITE)
242  // not required for eta/phi/m that we don't correct (only ptFinalCalib and etaFinalCalib are stored in DAODs)
243  xTau.setP4( xTau.ptFinalCalib() * dCorrection,
244  xTau.eta(), xTau.phi(), xTau.m());
245  return CP::CorrectionCode::Ok;
246 }
247 
248 /*
249  Create a non-const copy of the passed const xTau object and apply the
250  correction to the non-const copy.
251  */
252 //______________________________________________________________________________
254  xAOD::TauJet*& xTauCopy ) const
255 {
256 
257  // A sanity check:
258  if( xTauCopy )
259  {
260  ATH_MSG_WARNING( "Non-null pointer received. "
261  "There's a possible memory leak!" );
262  }
263 
264  // Create a new object:
265  xTauCopy = new xAOD::TauJet();
266  xTauCopy->makePrivateStore( xTau );
267 
268  // Use the other function to modify this object:
269  return applyCorrection( *xTauCopy );
270 }
271 
272 /*
273  standard check if a systematic is available
274 */
275 //______________________________________________________________________________
277 {
279  return sys.find(systematic) != sys.end();
280 }
281 
282 /*
283  standard way to return systematics that are available (including recommended
284  systematics)
285 */
286 //______________________________________________________________________________
288 {
290 }
291 
292 /*
293  standard way to return systematics that are recommended
294 */
295 //______________________________________________________________________________
297 {
299 }
300 
301 /*
302  Configure the tool to use a systematic variation for further usage, until the
303  tool is reconfigured with this function. The passed systematic set is checked
304  for sanity:
305  - unsupported systematics are skipped
306  - only combinations of up or down supported systematics is allowed
307  - don't mix recommended systematics with other available systematics, cause
308  sometimes recommended are a quadratic sum of the other variations,
309  e.g. TOTAL=(SYST^2 + STAT^2)^0.5
310 */
311 //______________________________________________________________________________
313 {
314  // first check if we already know this systematic configuration
315  auto itSystematicSet = m_mSystematicSets.find(sSystematicSet);
316  if (itSystematicSet != m_mSystematicSets.end())
317  {
318  m_sSystematicSet = &itSystematicSet->first;
319  return StatusCode::SUCCESS;
320  }
321 
322  // sanity checks if systematic set is supported
323  double dDirection = 0.;
324  CP::SystematicSet sSystematicSetAvailable;
325  for (auto& sSyst : sSystematicSet)
326  {
327  // check if systematic is available
328  auto it = m_mSystematicsHistNames.find(sSyst.basename());
329  if (it == m_mSystematicsHistNames.end())
330  {
331  ATH_MSG_VERBOSE("unsupported systematic variation: "<< sSyst.basename()<<"; skipping this one");
332  continue;
333  }
334 
335  if (sSyst.parameter() * dDirection < 0)
336  {
337  ATH_MSG_ERROR("unsupported set of systematic variations, you should either use only \"UP\" or only \"DOWN\" systematics in one set!");
338  ATH_MSG_ERROR("systematic set will not be applied");
339  return StatusCode::FAILURE;
340  }
341  dDirection = sSyst.parameter();
342 
343  if ((m_sRecommendedSystematics.find(sSyst.basename()) != m_sRecommendedSystematics.end()) and sSystematicSet.size() > 1)
344  {
345  ATH_MSG_ERROR("unsupported set of systematic variations, you should not combine \"TAUS_{TRUE|FAKE}_SME_TOTAL\" with other systematic variations!");
346  ATH_MSG_ERROR("systematic set will not be applied");
347  return StatusCode::FAILURE;
348  }
349 
350  // finally add the systematic to the set of systematics to process
351  sSystematicSetAvailable.insert(sSyst);
352  }
353 
354  // store this calibration for future use, and make it current
355  m_sSystematicSet = &m_mSystematicSets.insert(std::pair<CP::SystematicSet,std::string>(sSystematicSetAvailable, sSystematicSet.name())).first->first;
356 
357  return StatusCode::SUCCESS;
358 }
359 
360 //=================================PRIVATE-PART=================================
361 /*
362  Executed at the beginning of each event, checks if the tool is used on data or MC.
363  This tool is mostly for MC (in-situ TES correction).
364  But the TES compatibility requirement is applied to both data and MC (when ApplyMVATESQualityCheck=true).
365 */
366 //______________________________________________________________________________
368 {
369  if (m_bIsConfigured)
370  return StatusCode::SUCCESS;
371 
372  const xAOD::EventInfo* xEventInfo = nullptr;
373  ATH_CHECK(evtStore()->retrieve(xEventInfo,"EventInfo"));
375  m_bIsConfigured = true;
376 
377  return StatusCode::SUCCESS;
378 }
379 
380 //______________________________________________________________________________
381 std::string CommonSmearingTool::ConvertProngToString(const int fProngness) const
382 {
383  return fProngness == 1 ? "_1p" : "_3p";
384 }
385 
386 //______________________________________________________________________________
387 template<class T>
388 void CommonSmearingTool::ReadInputs(TFile* fFile, std::map<std::string, T>& mMap)
389 {
390  // initialize function pointer
391  m_fX = &finalTauPt;
392  m_fY = &finalTauEta;
393 
394  TKey *kKey;
395  TIter itNext(fFile->GetListOfKeys());
396  while ((kKey = (TKey*)itNext()))
397  {
398  TClass *cClass = gROOT->GetClass(kKey->GetClassName());
399 
400  // parse file content for objects of type TNamed, check their title for
401  // known strings and reset funtion pointer
402  std::string sKeyName = kKey->GetName();
403  if (sKeyName == "Xaxis")
404  {
405  TNamed* tObj = (TNamed*)kKey->ReadObj();
406  std::string sTitle = tObj->GetTitle();
407  delete tObj;
408  if (sTitle == "P" || sTitle == "PFinalCalib")
409  {
410  m_fX = &finalTauP;
411  ATH_MSG_DEBUG("using full momentum for x-axis");
412  }
413  }
414  if (sKeyName == "Yaxis")
415  {
416  TNamed* tObj = (TNamed*)kKey->ReadObj();
417  std::string sTitle = tObj->GetTitle();
418  delete tObj;
419  if (sTitle == "track-eta")
420  {
422  ATH_MSG_DEBUG("using leading track eta for y-axis");
423  }
424  else if (sTitle == "|eta|")
425  {
426  m_fY = &finalTauAbsEta;
427  ATH_MSG_DEBUG("using absolute tau eta for y-axis");
428  }
429  }
430  if (!cClass->InheritsFrom("TH1"))
431  continue;
432  T tObj = (T)kKey->ReadObj();
433  tObj->SetDirectory(0);
434  mMap[sKeyName] = tObj;
435  }
436  ATH_MSG_INFO("data loaded from " << fFile->GetName());
437 }
438 
439 //______________________________________________________________________________
441 {
442  std::vector<std::string> vInputFilePath;
443  split(m_sInputFilePath,'/',vInputFilePath);
444  std::string sInputFileName = vInputFilePath.back();
445 
446  // creation of basic string for all NPs, e.g. "TAUS_TRUEHADTAU_SME_TES_"
447  std::vector<std::string> vSplitInputFilePath = {};
448  split(sInputFileName,'_',vSplitInputFilePath);
449  std::string sEfficiencyType = vSplitInputFilePath.at(0);
450  std::string sTruthType = vSplitInputFilePath.at(1);
451  std::transform(sEfficiencyType.begin(), sEfficiencyType.end(), sEfficiencyType.begin(), toupper);
452  std::transform(sTruthType.begin(), sTruthType.end(), sTruthType.begin(), toupper);
453  std::string sSystematicBaseString = "TAUS_" + sTruthType + "_SME_" + sEfficiencyType + "_";
454 
455  // set truth type to check for in truth matching
456  if (sTruthType=="TRUEHADTAU") m_eCheckTruth = TauAnalysisTools::TruthHadronicTau;
457  if (sTruthType=="TRUEELECTRON") m_eCheckTruth = TauAnalysisTools::TruthElectron;
458  if (sTruthType=="TRUEMUON") m_eCheckTruth = TauAnalysisTools::TruthMuon;
459  if (sTruthType=="TRUEJET") m_eCheckTruth = TauAnalysisTools::TruthJet;
460 
461  for (auto& mSF : m_mSF)
462  {
463  // parse for nuisance parameter in histogram name
464  std::vector<std::string> vSplitNP = {};
465  split(mSF.first,'_',vSplitNP);
466  std::string sNP;
467  std::string sNPUppercase;
468  if (vSplitNP.size() > 2)
469  {
470  sNP = vSplitNP.at(0)+'_'+vSplitNP.at(1);
471  sNPUppercase = vSplitNP.at(0) + '_' + vSplitNP.at(1);
472  } else {
473  sNP = vSplitNP.at(0);
474  sNPUppercase = vSplitNP.at(0);
475  }
476 
477  // skip nominal scale factors
478  if (sNP == "sf") continue;
479  // skip if non 1p histogram to avoid duplications (TODO: come up with a better solution)
480  if (mSF.first.find("_1p") == std::string::npos) continue;
481 
482  // test if NP starts with a capital letter indicating that this should be recommended
483  bool bIsRecommended = false;
484  if (isupper(sNP.at(0)))
485  bIsRecommended = true;
486 
487  // make sNP uppercase and build final NP entry name
488  std::transform(sNPUppercase.begin(), sNPUppercase.end(), sNPUppercase.begin(), toupper);
489  std::string sSystematicString = sSystematicBaseString + sNPUppercase;
490 
491  // add all found systematics to the AffectingSystematics
493  m_sAffectingSystematics.insert(CP::SystematicVariation (sSystematicString, -1));
494  // only add found uppercase systematics to the RecommendedSystematics
495  if (bIsRecommended)
496  {
499  }
500 
501  ATH_MSG_DEBUG("connected histogram base name " << sNP << " with systematic " << sSystematicString);
502  m_mSystematicsHistNames.insert({sSystematicString,sNP});
503  }
504 }
505 
506 //______________________________________________________________________________
508  const xAOD::TauJet& xTau,
509  double& dEfficiencyScaleFactor) const
510 {
511  TH1* hHist = m_mSF.at(sHistName);
512  if (hHist == nullptr)
513  {
514  ATH_MSG_ERROR("Histogram with name " << sHistName << " was not found in input file.");
516  }
517 
518  double dPt = m_fX(xTau);
519  double dEta = m_fY(xTau);
520 
521  // protect values from underflow bins
522  dPt = std::max(dPt,hHist->GetXaxis()->GetXmin());
523  dEta = std::max(dEta,hHist->GetYaxis()->GetXmin());
524  // protect values from overflow bins (times .999 to keep it inside last bin)
525  dPt = std::min(dPt,hHist->GetXaxis()->GetXmax() * .999);
526  dEta = std::min(dEta,hHist->GetYaxis()->GetXmax() * .999);
527 
528  int iBin = hHist->FindFixBin(dPt,dEta);
529  dEfficiencyScaleFactor = hHist->GetBinContent(iBin);
530 
531  if (m_bApplyFading)
532  {
533  std::string sTitle = hHist->GetTitle();
534  if (!sTitle.empty())
535  {
536  TF1 f("",sTitle.c_str(), 0, 1000);
537  if (sHistName.find("sf_") != std::string::npos)
538  dEfficiencyScaleFactor = (dEfficiencyScaleFactor -1.) *f.Eval(m_fX(xTau)) + 1.;
539  else
540  dEfficiencyScaleFactor *= f.Eval(m_fX(xTau));
541  }
542  }
543  return CP::CorrectionCode::Ok;
544 }
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
asg::AnaToolHandle::initialize
StatusCode initialize()
initialize the tool
TauAnalysisTools::CommonSmearingTool::ReadInputs
void ReadInputs(TFile *fFile, std::map< std::string, T > &mMap)
Definition: CommonSmearingTool.cxx:388
TauAnalysisTools
Definition: TruthCollectionMakerTau.h:16
TauAnalysisTools::CommonSmearingTool::recommendedSystematics
virtual CP::SystematicSet recommendedSystematics() const
returns: the list of all systematics this tool recommends to use
Definition: CommonSmearingTool.cxx:296
TauAnalysisTools::TruthElectron
@ TruthElectron
Definition: PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/Enums.h:100
python.CaloRecoConfig.f
f
Definition: CaloRecoConfig.py:127
TauCombinedTES::getUseCaloPtFlag
bool getUseCaloPtFlag(const xAOD::TauJet &tau) const
Whether to use calo pt, invoked by TauSmearing tool.
Definition: TauCombinedTES.cxx:185
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
max
#define max(a, b)
Definition: cfImp.cxx:41
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
xAOD::TauJet_v3::eta
virtual double eta() const
The pseudorapidity ( ) of the particle.
SG::Accessor< char >
TauAnalysisTools::TruthHadronicTau
@ TruthHadronicTau
Definition: PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/Enums.h:97
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
CP::SystematicSet::empty
bool empty() const
returns: whether the set is empty
Definition: SystematicSet.h:67
TruthParticleContainer.h
xAOD::TauJet_v3::m
virtual double m() const
The invariant mass of the particle.
TauCombinedTES
Definition: TauCombinedTES.h:19
xAOD::char
char
Definition: TrigDecision_v1.cxx:38
TauAnalysisTools::CommonSmearingTool::m_sSystematicSet
const CP::SystematicSet * m_sSystematicSet
Definition: CommonSmearingTool.h:84
xAOD::TauJet_v3::nTracks
size_t nTracks(TauJetParameters::TauTrackFlag flag=TauJetParameters::TauTrackFlag::classifiedCharged) const
Definition: TauJet_v3.cxx:526
skel.it
it
Definition: skel.GENtoEVGEN.py:423
asg
Definition: DataHandleTestTool.h:28
CP::SystematicSet
Class to wrap a set of SystematicVariations.
Definition: SystematicSet.h:31
TauAnalysisTools::CommonSmearingTool::m_sRecommendedSystematics
CP::SystematicSet m_sRecommendedSystematics
Definition: CommonSmearingTool.h:113
CP::SystematicSet::name
std::string name() const
returns: the systematics joined into a single string.
Definition: SystematicSet.cxx:278
SG::ConstAccessor< float >
TauAnalysisTools::finalTauPt
double finalTauPt(const xAOD::TauJet &xTau)
return MVA based tau pt in GeV
Definition: PhysicsAnalysis/TauID/TauAnalysisTools/Root/HelperFunctions.cxx:113
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
TauAnalysisTools::TruthJet
@ TruthJet
Definition: PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/Enums.h:101
CP::SystematicVariation
Definition: SystematicVariation.h:47
TauAnalysisTools::Unknown
@ Unknown
Definition: PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/Enums.h:96
ASG_MAKE_ANA_TOOL
#define ASG_MAKE_ANA_TOOL(handle, type)
create the tool in the given tool handle
Definition: AnaToolHandle.h:690
asg::AnaToolHandle::setProperty
StatusCode setProperty(const std::string &property, const T2 &value)
set the given property of the tool.
xAOD::EventInfo_v1::IS_SIMULATION
@ IS_SIMULATION
true: simulation, false: data
Definition: EventInfo_v1.h:151
xAOD::TauJet_v3::setP4
void setP4(double pt, double eta, double phi, double m)
Set methods for IParticle values.
Definition: TauJet_v3.cxx:172
mapkey::sys
@ sys
Definition: TElectronEfficiencyCorrectionTool.cxx:42
TauAnalysisTools::CommonSmearingTool::m_sInputFilePath
std::string m_sInputFilePath
Definition: CommonSmearingTool.h:101
TauAnalysisTools::CommonSmearingTool::applyCorrection
virtual CP::CorrectionCode applyCorrection(xAOD::TauJet &xTau) const
Apply the correction on a modifyable object.
Definition: CommonSmearingTool.cxx:148
AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:85
TauAnalysisTools::finalTauP
double finalTauP(const xAOD::TauJet &xTau)
return MVA based tau P in GeV
Definition: PhysicsAnalysis/TauID/TauAnalysisTools/Root/HelperFunctions.cxx:134
xAOD::TauJet_v3::phi
virtual double phi() const
The azimuthal angle ( ) of the particle.
TauAnalysisTools::CommonSmearingTool::~CommonSmearingTool
~CommonSmearingTool()
Definition: CommonSmearingTool.cxx:94
CP::CorrectionCode::Error
@ Error
Some error happened during the object correction.
Definition: CorrectionCode.h:36
xAOD::TauJet_v3::ptTauEnergyScale
double ptTauEnergyScale() const
TauAnalysisTools::CommonSmearingTool::m_eCheckTruth
TruthMatchedParticleType m_eCheckTruth
Definition: CommonSmearingTool.h:111
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
TauAnalysisTools::CommonSmearingTool::m_bApplyFading
bool m_bApplyFading
Definition: CommonSmearingTool.h:105
TauSmearingTool.h
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
TauAnalysisTools::CommonSmearingTool::applySystematicVariation
virtual StatusCode applySystematicVariation(const CP::SystematicSet &sSystematicSet)
configure this tool for the given list of systematic variations.
Definition: CommonSmearingTool.cxx:312
xAOD::TauJet_v3
Class describing a tau jet.
Definition: TauJet_v3.h:41
Amg::transform
Amg::Vector3D transform(Amg::Vector3D &v, Amg::Transform3D &tr)
Transform a point from a Trasformation3D.
Definition: GeoPrimitivesHelpers.h:156
TauAnalysisTools::CommonSmearingTool::m_sAffectingSystematics
CP::SystematicSet m_sAffectingSystematics
Definition: CommonSmearingTool.h:112
CP::SystematicSet::end
const_iterator end() const
description: const iterator to the end of the set
Definition: SystematicSet.h:59
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
xAOD::TauJet
TauJet_v3 TauJet
Definition of the current "tau version".
Definition: Event/xAOD/xAODTau/xAODTau/TauJet.h:17
TauAnalysisTools::CommonSmearingTool::m_tTauCombinedTES
asg::AnaToolHandle< ITauToolBase > m_tTauCombinedTES
Definition: CommonSmearingTool.h:109
TauAnalysisTools::CommonSmearingTool::getValue
virtual CP::CorrectionCode getValue(const std::string &sHistName, const xAOD::TauJet &xTau, double &dEfficiencyScaleFactor) const
Definition: CommonSmearingTool.cxx:507
TauCombinedTES.h
min
#define min(a, b)
Definition: cfImp.cxx:40
TauAnalysisTools::TruthMuon
@ TruthMuon
Definition: PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/Enums.h:99
TauAnalysisTools::CommonSmearingTool::isAffectedBySystematic
virtual bool isAffectedBySystematic(const CP::SystematicVariation &systematic) const
returns: whether this tool is affected by the given systematics
Definition: CommonSmearingTool.cxx:276
TauAnalysisTools::CommonSmearingTool::correctedCopy
virtual CP::CorrectionCode correctedCopy(const xAOD::TauJet &xTau, xAOD::TauJet *&xTauCopy) const
Create a corrected copy from a constant tau.
Definition: CommonSmearingTool.cxx:253
TauAnalysisTools::CommonSmearingTool::m_bIsData
bool m_bIsData
Definition: CommonSmearingTool.h:102
TauAnalysisTools::CommonSmearingTool::m_bApplyMVATESQualityCheck
bool m_bApplyMVATESQualityCheck
Definition: CommonSmearingTool.h:106
PathResolver.h
CP::SystematicSet::insert
void insert(const SystematicVariation &systematic)
description: insert a systematic into the set
Definition: SystematicSet.cxx:88
TauAnalysisTools::CommonSmearingTool::m_bIsConfigured
bool m_bIsConfigured
Definition: CommonSmearingTool.h:103
TauAnalysisTools::CommonSmearingTool::m_fX
double(* m_fX)(const xAOD::TauJet &xTau)
Definition: CommonSmearingTool.h:89
SG::AuxElement::makePrivateStore
void makePrivateStore()
Create a new (empty) private store for this object.
Definition: AuxElement.cxx:172
TauAnalysisTools::CommonSmearingTool::m_fY
double(* m_fY)(const xAOD::TauJet &xTau)
Definition: CommonSmearingTool.h:90
CommonSmearingTool.h
TauAnalysisTools::CommonSmearingTool::initialize
virtual StatusCode initialize()
Dummy implementation of the initialisation function.
Definition: CommonSmearingTool.cxx:107
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
TauAnalysisTools::CommonSmearingTool::m_mSF
std::map< std::string, TH1 * > m_mSF
Definition: CommonSmearingTool.h:82
CP::SystematicSet::find
iterator find(const SystematicVariation &sys) const
description: find an element in the set
Definition: SystematicSet.h:63
TauAnalysisTools::CommonSmearingTool::m_mSystematicSets
std::unordered_map< CP::SystematicSet, std::string > m_mSystematicSets
Definition: CommonSmearingTool.h:83
CP::CorrectionCode::Ok
@ Ok
The correction was done successfully.
Definition: CorrectionCode.h:38
TauAnalysisTools::CommonSmearingTool::m_bSkipTruthMatchCheck
bool m_bSkipTruthMatchCheck
Definition: CommonSmearingTool.h:104
TauAnalysisTools::CommonSmearingTool::beginEvent
virtual StatusCode beginEvent()
Function called when a new events is loaded.
Definition: CommonSmearingTool.cxx:367
TauAnalysisTools::finalTauAbsEta
double finalTauAbsEta(const xAOD::TauJet &xTau)
return MVA based absolute tau eta
Definition: PhysicsAnalysis/TauID/TauAnalysisTools/Root/HelperFunctions.cxx:127
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
TauAnalysisTools::tauLeadTrackEta
double tauLeadTrackEta(const xAOD::TauJet &xTau)
return leading charge tau track eta
Definition: PhysicsAnalysis/TauID/TauAnalysisTools/Root/HelperFunctions.cxx:141
TauAnalysisTools::getTruthParticleType
TruthMatchedParticleType getTruthParticleType(const xAOD::TauJet &xTau)
return TauJet match type
Definition: PhysicsAnalysis/TauID/TauAnalysisTools/Root/HelperFunctions.cxx:572
TauAnalysisTools::CommonSmearingTool::m_bApplyInsituCorrection
bool m_bApplyInsituCorrection
Definition: CommonSmearingTool.h:107
CP::CorrectionCode
Return value from object correction CP tools.
Definition: CorrectionCode.h:31
TauAnalysisTools::CommonSmearingTool::CommonSmearingTool
CommonSmearingTool(const std::string &sName)
Create a proper constructor for Athena.
Definition: CommonSmearingTool.cxx:74
TauAnalysisTools::CommonSmearingTool::generateSystematicSets
void generateSystematicSets()
Definition: CommonSmearingTool.cxx:440
TauAnalysisTools::CommonSmearingTool::m_mSystematicsHistNames
std::map< std::string, std::string > m_mSystematicsHistNames
Definition: CommonSmearingTool.h:86
TauAnalysisTools::CommonSmearingTool::ConvertProngToString
std::string ConvertProngToString(const int iProngness) const
Definition: CommonSmearingTool.cxx:381
SG::ConstAccessor::isAvailable
bool isAvailable(const ELT &e) const
Test to see if this variable exists in the store.
TauAnalysisTools::CommonSmearingTool::affectingSystematics
virtual CP::SystematicSet affectingSystematics() const
returns: the list of all systematics this tool can be affected by
Definition: CommonSmearingTool.cxx:287
ConstAccessor.h
Helper class to provide constant type-safe access to aux data.
TauGNNUtils::Variables::Track::dEta
bool dEta(const xAOD::TauJet &tau, const xAOD::TauTrack &track, double &out)
Definition: TauGNNUtils.cxx:525
xAOD::TauJetParameters::FinalCalib
@ FinalCalib
Definition: TauDefs.h:346
xAOD::TauJet_v3::ptFinalCalib
double ptFinalCalib() const
asg::AnaToolHandle::get
T * get()
access the tool
TauAnalysisTools::finalTauEta
double finalTauEta(const xAOD::TauJet &xTau)
return MVA based tau eta
Definition: PhysicsAnalysis/TauID/TauAnalysisTools/Root/HelperFunctions.cxx:120
xAOD::EventInfo_v1::eventType
bool eventType(EventType type) const
Check for one particular bitmask value.
TauAnalysisTools::split
void split(const std::string &sInput, const char cDelim, std::vector< std::string > &vOut)
Definition: PhysicsAnalysis/TauID/TauAnalysisTools/Root/HelperFunctions.cxx:23