ATLAS Offline Software
Loading...
Searching...
No Matches
CommonEfficiencyTool.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef TAUANALYSISTOOLS_COMMONEFFICIENCYTOOL_H
6#define TAUANALYSISTOOLS_COMMONEFFICIENCYTOOL_H
7
8/*
9 author: Dirk Duschinger
10 mail: dirk.duschinger@cern.ch
11*/
12
13// Framework include(s):
14#include "AsgTools/AsgTool.h"
16
17// EDM include(s):
18#include "xAODTau/TauJet.h"
21
22// Local include(s):
26
27// ROOT include(s):
28#include "TFile.h"
29#include "TKey.h"
30
31namespace TauAnalysisTools
32{
33
34// forward declaration
36
38 : public virtual ITauEfficiencyCorrectionsTool
39 , public asg::AsgTool
40{
43
44public:
45
46 CommonEfficiencyTool(const std::string& sName);
47
49
50 virtual StatusCode initialize();
51
52 // CommonEfficiencyTool pure virtual public functionality
53 //__________________________________________________________________________
54
55 virtual CP::CorrectionCode getEfficiencyScaleFactor(const xAOD::TauJet& tau, double& dEfficiencyScaleFactor,
56 unsigned int iRunNumber = 0 );
57
59 unsigned int iRunNumber = 0 );
60
62 virtual bool isAffectedBySystematic( const CP::SystematicVariation& systematic ) const;
63
66
69
72 virtual StatusCode applySystematicVariation ( const CP::SystematicSet& sSystematicSet);
73
74 virtual bool isSupportedRunNumber( int /*iRunNumber*/ ) const
75 {
76 return true;
77 };
78
79protected:
80
81 std::string ConvertProngToString(const int iProngness) const;
82 std::string ConvertDecayModeToString(const int iDecayMode) const;
83
84 typedef std::tuple<TObject*,
85 CP::CorrectionCode (*)(const TObject* oObject,
86 double& dEfficiencyScaleFactor,
87 double dVars[] ) > tTupleObjectFunc;
88 typedef std::map<std::string, tTupleObjectFunc > tSFMAP;
89 // In gcc10 builds, cling gets confused by the type of m_mSF and produces
90 // an ugly warning message. Hide this from cling to suppress that
91 // (substitute another unique_ptr so that the class layout remains the same).
92#ifdef __CLING__
93 std::unique_ptr<int> m_dummy;
94#else
95 std::unique_ptr< tSFMAP > m_mSF;
96#endif
97
98 std::unordered_map < CP::SystematicSet, std::string > m_mSystematicSets;
100 std::map<std::string, int> m_mSystematics;
101 std::map<std::string, std::string> m_mSystematicsHistNames;
102
103 std::function<double(const xAOD::TauJet& xTau)> m_fX;
104 std::function<double(const xAOD::TauJet& xTau)> m_fY;
105
106 void ReadInputs(const TFile& fFile);
107 void addHistogramToSFMap(TKey* kKey, const std::string& sKeyName);
108
109 virtual CP::CorrectionCode getValue(const std::string& sHistName,
110 const xAOD::TauJet& xTau,
111 double& dEfficiencyScaleFactor) const;
112
113 static CP::CorrectionCode getValueTH1(const TObject* oObject,
114 double& dEfficiencyScaleFactor,
115 double dVars[]
116 );
117 static CP::CorrectionCode getValueTH2(const TObject* oObject,
118 double& dEfficiencyScaleFactor,
119 double dVars[]
120 );
121 static CP::CorrectionCode getValueTF1(const TObject* oObject,
122 double& dEfficiencyScaleFactor,
123 double dVars[]
124 );
125
127
128protected:
129
132
133 Gaudi::Property<std::string> m_sInputFilePath{this, "InputFilePath", ""};
134 Gaudi::Property<std::string> m_sVarName{this, "VarName", ""};
135 Gaudi::Property<std::string> m_sWP{this, "WP", ""};
136 Gaudi::Property<bool> m_bSkipTruthMatchCheck{this, "SkipTruthMatchCheck", false};
137 Gaudi::Property<int> m_iJetIDLevel{this, "JetIDLevel", static_cast<int>(JETIDNONE)};
138 Gaudi::Property<int> m_iEleIDLevel{this, "EleIDLevel", static_cast<int>(ELEIDNONE)};
139 Gaudi::Property<bool> m_bUseTauSubstructure{this, "UseTauSubstructure", false};
140 Gaudi::Property<bool> m_doTauTrig{this, "DoTauTrig", false};
141
142 std::string m_sInputFileName;
143 std::string m_sSFHistName;
145
147
150};
151} // namespace TauAnalysisTools
152
153#endif // TAUANALYSISTOOLS_COMMONEFFICIENCYTOOL_H
#define ASG_TOOL_CLASS(CLASSNAME, INT1)
Return value from object correction CP tools.
Class to wrap a set of SystematicVariations.
std::string ConvertDecayModeToString(const int iDecayMode) const
std::function< double(const xAOD::TauJet &xTau)> m_fY
virtual StatusCode applySystematicVariation(const CP::SystematicSet &sSystematicSet)
configure this tool for the given list of systematic variations.
virtual CP::CorrectionCode getValue(const std::string &sHistName, const xAOD::TauJet &xTau, double &dEfficiencyScaleFactor) const
CommonEfficiencyTool(const std::string &sName)
Create a proper constructor for Athena.
std::map< std::string, tTupleObjectFunc > tSFMAP
virtual bool isSupportedRunNumber(int) const
check if run number is supported in recommendations
Gaudi::Property< std::string > m_sInputFilePath
virtual CP::SystematicSet affectingSystematics() const
returns: the list of all systematics this tool can be affected by
virtual CP::SystematicSet recommendedSystematics() const
returns: the list of all systematics this tool recommends to use
static CP::CorrectionCode getValueTH1(const TObject *oObject, double &dEfficiencyScaleFactor, double dVars[])
std::tuple< TObject *, CP::CorrectionCode(*)(const TObject *oObject, double &dEfficiencyScaleFactor, double dVars[]) > tTupleObjectFunc
std::unordered_map< CP::SystematicSet, std::string > m_mSystematicSets
void addHistogramToSFMap(TKey *kKey, const std::string &sKeyName)
virtual CP::CorrectionCode getEfficiencyScaleFactor(const xAOD::TauJet &tau, double &dEfficiencyScaleFactor, unsigned int iRunNumber=0)
Declare the interface that the class provides.
static CP::CorrectionCode getValueTH2(const TObject *oObject, double &dEfficiencyScaleFactor, double dVars[])
virtual StatusCode initialize()
Dummy implementation of the initialisation function.
std::map< std::string, std::string > m_mSystematicsHistNames
virtual bool isAffectedBySystematic(const CP::SystematicVariation &systematic) const
returns: whether this tool is affected by the given systematics
std::function< double(const xAOD::TauJet &xTau)> m_fX
Gaudi::Property< std::string > m_sVarName
virtual CP::CorrectionCode applyEfficiencyScaleFactor(const xAOD::TauJet &xTau, unsigned int iRunNumber=0)
Decorate the tau with its efficiency.
std::map< std::string, int > m_mSystematics
static CP::CorrectionCode getValueTF1(const TObject *oObject, double &dEfficiencyScaleFactor, double dVars[])
std::string ConvertProngToString(const int iProngness) const
Base class for the dual-use tool implementation classes.
Definition AsgTool.h:47
TauJet_v3 TauJet
Definition of the current "tau version".