ATLAS Offline Software
DiTauSmearingTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 // EDM include(s):
7 
8 // Local include(s):
11 
12 namespace TauAnalysisTools
13 {
14 
15 DiTauSmearingTool::DiTauSmearingTool( const std::string& sName )
16  : asg::AsgTool( sName )
17  , m_tCommonDiTauSmearingTool(sName+"_CommonDiTauSmearingTool", this)
18  , m_sInputFilePath("")
19 {
20  declareProperty( "RecommendationTag", m_sRecommendationTag = "2019-winter" );
21  declareProperty( "SkipTruthMatchCheck", m_bSkipTruthMatchCheck = false );
22 }
23 
25 {
26  // Greet the user:
27  ATH_MSG_INFO( "Initializing DiTauSmearingTool" );
28 
30  ATH_MSG_WARNING("Truth match check will be skipped. This is ONLY FOR TESTING PURPOSE!");
31 
32  std::string sDirectory = "TauAnalysisTools/"+std::string(sSharedFilesVersion)+"/Smearing/";
33 
34  if (m_sRecommendationTag == "2019-winter")
35  {
36  if (m_sInputFilePath.empty())
37  m_sInputFilePath = sDirectory+"TES_TrueHadDiTau_2019-winter.root";
39  ATH_CHECK(m_tCommonDiTauSmearingTool.setProperty("InputFilePath", m_sInputFilePath));
40  ATH_CHECK(m_tCommonDiTauSmearingTool.setProperty("SkipTruthMatchCheck", m_bSkipTruthMatchCheck));
41  ATH_CHECK(m_tCommonDiTauSmearingTool.setProperty("OutputLevel", this->msg().level()));
42  }
43  else
44  {
45  ATH_MSG_FATAL("unknown recommendation tag "<<m_sRecommendationTag);
46  return StatusCode::FAILURE;
47  }
48 
50 
51  // Add the affecting systematics to the global registry
53  if (!registry.registerSystematics(*this))
54  {
55  ATH_MSG_ERROR ("Unable to register the systematics");
56  return StatusCode::FAILURE;
57  }
58 
59  return StatusCode::SUCCESS;
60 }
61 
63 {
64  return m_tCommonDiTauSmearingTool->applyCorrection(xDiTau);
65 }
66 
69 {
70  return m_tCommonDiTauSmearingTool->correctedCopy(input, output);
71 }
72 
75 {
76  return m_tCommonDiTauSmearingTool->isAffectedBySystematic( systematic );
77 }
78 
81 {
82  return m_tCommonDiTauSmearingTool->affectingSystematics();
83 }
84 
87 {
88  return m_tCommonDiTauSmearingTool->recommendedSystematics();
89 }
90 
92 {
93  return m_tCommonDiTauSmearingTool->applySystematicVariation( sSystematicSet );
94 }
95 
96 
97 } // namespace TauAnalysisTools
98 
python.Dso.registry
registry
Definition: Control/AthenaServices/python/Dso.py:159
TauAnalysisTools
Definition: TruthCollectionMakerTau.h:16
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
TauAnalysisTools::DiTauSmearingTool::applyCorrection
virtual CP::CorrectionCode applyCorrection(xAOD::DiTauJet &xDiTau) override
Apply the correction on a modifyable object.
Definition: DiTauSmearingTool.cxx:62
TauAnalysisTools::CommonDiTauSmearingTool
Definition: CommonDiTauSmearingTool.h:37
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
TauAnalysisTools::DiTauSmearingTool::applySystematicVariation
virtual StatusCode applySystematicVariation(const CP::SystematicSet &systConfig) override
effects: configure this tool for the given list of systematic variations.
Definition: DiTauSmearingTool.cxx:91
asg
Definition: DataHandleTestTool.h:28
TauAnalysisTools::DiTauSmearingTool::recommendedSystematics
virtual CP::SystematicSet recommendedSystematics() const override
returns: the list of all systematics this tool recommends to use
Definition: DiTauSmearingTool.cxx:86
CP::SystematicSet
Class to wrap a set of SystematicVariations.
Definition: SystematicSet.h:31
CP::SystematicVariation
Definition: SystematicVariation.h:47
ASG_MAKE_ANA_TOOL
#define ASG_MAKE_ANA_TOOL(handle, type)
create the tool in the given tool handle
Definition: AnaToolHandle.h:690
TauAnalysisTools::DiTauSmearingTool::m_bSkipTruthMatchCheck
bool m_bSkipTruthMatchCheck
Definition: DiTauSmearingTool.h:63
TauAnalysisTools::DiTauSmearingTool::correctedCopy
virtual CP::CorrectionCode correctedCopy(const xAOD::DiTauJet &input, xAOD::DiTauJet *&output) override
Create a corrected copy from a constant ditau.
Definition: DiTauSmearingTool.cxx:67
TauAnalysisTools::DiTauSmearingTool::affectingSystematics
virtual CP::SystematicSet affectingSystematics() const override
returns: the list of all systematics this tool can be affected by
Definition: DiTauSmearingTool.cxx:80
SharedFilesVersion.h
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
SystematicRegistry.h
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
PlotPulseshapeFromCool.input
input
Definition: PlotPulseshapeFromCool.py:106
DiTauSmearingTool.h
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
TauAnalysisTools::DiTauSmearingTool::m_tCommonDiTauSmearingTool
asg::AnaToolHandle< IDiTauSmearingTool > m_tCommonDiTauSmearingTool
Definition: DiTauSmearingTool.h:60
TauAnalysisTools::DiTauSmearingTool::m_sRecommendationTag
std::string m_sRecommendationTag
Definition: DiTauSmearingTool.h:62
merge.output
output
Definition: merge.py:17
TauAnalysisTools::DiTauSmearingTool::initialize
virtual StatusCode initialize() override
Function initialising the tool.
Definition: DiTauSmearingTool.cxx:24
TauAnalysisTools::DiTauSmearingTool::m_sInputFilePath
std::string m_sInputFilePath
Definition: DiTauSmearingTool.h:61
TauAnalysisTools::DiTauSmearingTool::DiTauSmearingTool
DiTauSmearingTool(const std::string &sName)
Create a proper constructor for Athena.
Definition: DiTauSmearingTool.cxx:15
TauAnalysisTools::DiTauSmearingTool::isAffectedBySystematic
virtual bool isAffectedBySystematic(const CP::SystematicVariation &systematic) const override
returns: whether this tool is affected by the given systematis
Definition: DiTauSmearingTool.cxx:74
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
CP::SystematicRegistry
This module implements the central registry for handling systematic uncertainties with CP tools.
Definition: SystematicRegistry.h:25
CP::CorrectionCode
Return value from object correction CP tools.
Definition: CorrectionCode.h:31
xAOD::DiTauJet_v1
Definition: DiTauJet_v1.h:31
CP::SystematicRegistry::getInstance
static SystematicRegistry & getInstance()
Get the singleton instance of the registry for the curren thread.
Definition: SystematicRegistry.cxx:25