ATLAS Offline Software
Loading...
Searching...
No Matches
CommonDiTauEfficiencyTool.h
Go to the documentation of this file.
1
11
12
13#ifndef TAUANALYSISTOOLS_COMMONDITAUEFFICIENCYTOOL_H
14#define TAUANALYSISTOOLS_COMMONDITAUEFFICIENCYTOOL_H
15
16
17// Framework include(s):
18#include "AsgTools/AsgTool.h"
20
21// EDM include(s):
22#include "xAODTau/DiTauJet.h"
23
24// Local include(s):
28
29// ROOT include(s):
30#include "TFile.h"
31#include "TKey.h"
32
33namespace TauAnalysisTools
34{
36double TruthLeadPt(const xAOD::DiTauJet& xDiTau);
38double TruthSubleadPt(const xAOD::DiTauJet& xDiTau);
40double TruthDeltaR(const xAOD::DiTauJet& xDiTau);
41
43 : public virtual IDiTauEfficiencyCorrectionsTool
44 , public asg::AsgTool
45{
48
49public:
50
51 CommonDiTauEfficiencyTool(const std::string& sName);
52
54
55 virtual StatusCode initialize();
56
64 virtual CP::CorrectionCode getEfficiencyScaleFactor(const xAOD::DiTauJet& xDiTau, double& dEfficiencyScaleFactor);
65
73
75 virtual bool isAffectedBySystematic( const CP::SystematicVariation& systematic ) const;
76
79
82
85 virtual StatusCode applySystematicVariation ( const CP::SystematicSet& sSystematicSet);
86
87 std::function<double(const xAOD::DiTauJet& xDiTau)> m_fXDiTau;
88 std::function<double(const xAOD::DiTauJet& xDiTau)> m_fYDiTau;
89 std::function<double(const xAOD::DiTauJet& xDiTau)> m_fZDiTau;
90
91protected:
92
93 void ReadInputs(std::unique_ptr<TFile> &fFile);
94 void addHistogramToSFMap(TKey* kKey, const std::string& sKeyName);
95
96 typedef std::tuple<TObject*,
97 CP::CorrectionCode (*)(const TObject* oObject,
98 double& dEfficiencyScaleFactor,
99 double dVars[] ) > tTupleObjectFunc;
100 typedef std::map<std::string, tTupleObjectFunc > tSFMAP;
101 // In gcc10 builds, cling gets confused by the type of m_mSF and produces
102 // an ugly warning message. Hide this from cling to suppress that
103 // (substitute another unique_ptr so that the class layout remains the same).
104#ifdef __CLING__
105 std::unique_ptr<int> m_dummy;
106#else
107 std::unique_ptr< tSFMAP > m_mSF;
108#endif
109
110 std::unordered_map < CP::SystematicSet, std::string > m_mSystematicSets;
112 std::map<std::string, std::string> m_mSystematicsHistNames;
113
122 virtual CP::CorrectionCode getValue(const std::string& sHistName,
123 const xAOD::DiTauJet& xDiTau,
124 double& dEfficiencyScaleFactor) const;
125
126 static CP::CorrectionCode getValueTH1(const TObject* oObject,
127 double& dEfficiencyScaleFactor,
128 double dVars[]
129 );
130 static CP::CorrectionCode getValueTH2(const TObject* oObject,
131 double& dEfficiencyScaleFactor,
132 double dVars[]
133 );
134
141
144
145 Gaudi::Property<std::string> m_sInputFilePath{this, "InputFilePath", ""};
146 Gaudi::Property<std::string> m_sWP{this, "WP", ""};
147 Gaudi::Property<std::string> m_sVarName{this, "VarName", ""};
148
149 std::string m_sInputFileName;
150 std::string m_sSFHistName;
151
153
154};
155} // namespace TauAnalysisTools
156
157#endif // TAUANALYSISTOOLS_COMMONDITAUEFFICIENCYTOOL_H
#define ASG_TOOL_CLASS(CLASSNAME, INT1)
recommended ditau efficiency correction scale factors and uncertainties
Return value from object correction CP tools.
Class to wrap a set of SystematicVariations.
virtual StatusCode applySystematicVariation(const CP::SystematicSet &sSystematicSet)
configure this tool for the given list of systematic variations.
std::function< double(const xAOD::DiTauJet &xDiTau)> m_fZDiTau
std::tuple< TObject *, CP::CorrectionCode(*)(const TObject *oObject, double &dEfficiencyScaleFactor, double dVars[]) > tTupleObjectFunc
std::function< double(const xAOD::DiTauJet &xDiTau)> m_fXDiTau
void addHistogramToSFMap(TKey *kKey, const std::string &sKeyName)
virtual StatusCode initialize()
Dummy implementation of the initialisation function.
CommonDiTauEfficiencyTool(const std::string &sName)
Create a proper constructor for Athena.
std::unordered_map< CP::SystematicSet, std::string > m_mSystematicSets
std::map< std::string, std::string > m_mSystematicsHistNames
virtual CP::CorrectionCode applyEfficiencyScaleFactor(const xAOD::DiTauJet &xDiTau)
Get the Efficiency Scale Factor of ditau jet.
void generateSystematicSets()
generate a set of relevant systematic variations to be applied
std::map< std::string, tTupleObjectFunc > tSFMAP
static CP::CorrectionCode getValueTH2(const TObject *oObject, double &dEfficiencyScaleFactor, double dVars[])
virtual CP::CorrectionCode getValue(const std::string &sHistName, const xAOD::DiTauJet &xDiTau, double &dEfficiencyScaleFactor) const
Get the scale factor from a particular recommendations histogram.
virtual CP::CorrectionCode getEfficiencyScaleFactor(const xAOD::DiTauJet &xDiTau, double &dEfficiencyScaleFactor)
Get the Efficiency Scale Factor of ditau jet.
bool m_bSFIsAvailableDiTau
true if scale factor name is already decorated
virtual CP::SystematicSet affectingSystematics() const
returns: the list of all systematics this tool can be affected by
virtual bool isAffectedBySystematic(const CP::SystematicVariation &systematic) const
returns: whether this tool is affected by the given systematics
void ReadInputs(std::unique_ptr< TFile > &fFile)
static CP::CorrectionCode getValueTH1(const TObject *oObject, double &dEfficiencyScaleFactor, double dVars[])
bool m_bSFIsAvailableCheckedDiTau
true if cale factor name is already decorated has already been checked
std::function< double(const xAOD::DiTauJet &xDiTau)> m_fYDiTau
virtual CP::SystematicSet recommendedSystematics() const
returns: the list of all systematics this tool recommends to use
Base class for the dual-use tool implementation classes.
Definition AsgTool.h:47
double TruthSubleadPt(const xAOD::DiTauJet &xDiTau)
return the truth vis pT of the subleading pT matched particle.
double TruthDeltaR(const xAOD::DiTauJet &xDiTau)
return the dR of between the leading and subleading pT matched particle.
double TruthLeadPt(const xAOD::DiTauJet &xDiTau)
return the truth vis pT of the leading pT matched particle.
DiTauJet_v1 DiTauJet
Definition of the current version.
Definition DiTauJet.h:17