ATLAS Offline Software
Loading...
Searching...
No Matches
CommonDiTauEfficiencyTool.h
Go to the documentation of this file.
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
32class TKey;
33
34
35namespace ADD_CMODE(TauAnalysisTools)
36{
38double TruthLeadPt(const xAOD::DiTauJet& xDiTau);
40double TruthSubleadPt(const xAOD::DiTauJet& xDiTau);
42double TruthDeltaR(const xAOD::DiTauJet& xDiTau);
43
44class CommonDiTauEfficiencyTool
45 : public virtual IDiTauEfficiencyCorrectionsTool
46 , public asg::AsgTool
47{
49 ASG_TOOL_CLASS( CommonDiTauEfficiencyTool, TauAnalysisTools::IDiTauEfficiencyCorrectionsTool )
50
51public:
52
53 CommonDiTauEfficiencyTool(const std::string& sName);
54
55 ~CommonDiTauEfficiencyTool();
56
57 virtual StatusCode initialize();
58
66 virtual CP::CorrectionCode getEfficiencyScaleFactor(const xAOD::DiTauJet& xDiTau, double& dEfficiencyScaleFactor);
67
74 virtual CP::CorrectionCode applyEfficiencyScaleFactor(const xAOD::DiTauJet& xDiTau);
75
77 virtual bool isAffectedBySystematic( const CP::SystematicVariation& systematic ) const;
78
80 virtual CP::SystematicSet affectingSystematics() const;
81
83 virtual CP::SystematicSet recommendedSystematics() const;
84
87 virtual StatusCode applySystematicVariation ( const CP::SystematicSet& sSystematicSet);
88
89 std::function<double(const xAOD::DiTauJet& xDiTau)> m_fXDiTau;
90 std::function<double(const xAOD::DiTauJet& xDiTau)> m_fYDiTau;
91 std::function<double(const xAOD::DiTauJet& xDiTau)> m_fZDiTau;
92
93protected:
94
95 void ReadInputs(std::unique_ptr<TFile> &fFile);
96 void addHistogramToSFMap(TKey* kKey, const std::string& sKeyName);
97
98 typedef std::tuple<TObject*,
99 CP::CorrectionCode (*)(const TObject* oObject,
100 double& dEfficiencyScaleFactor,
101 double dVars[] ) > tTupleObjectFunc;
102 typedef std::map<std::string, tTupleObjectFunc > tSFMAP;
103 // In gcc10 builds, cling gets confused by the type of m_mSF and produces
104 // an ugly warning message. Hide this from cling to suppress that
105 // (substitute another unique_ptr so that the class layout remains the same).
106#ifdef __CLING__
107 std::unique_ptr<int> m_dummy;
108#else
109 std::unique_ptr< tSFMAP > m_mSF;
110#endif
111
112 std::unordered_map < CP::SystematicSet, std::string > m_mSystematicSets;
113 const CP::SystematicSet* m_sSystematicSet;
114 std::map<std::string, std::string> m_mSystematicsHistNames;
115
124 virtual CP::CorrectionCode getValue(const std::string& sHistName,
125 const xAOD::DiTauJet& xDiTau,
126 double& dEfficiencyScaleFactor) const;
127
128 static CP::CorrectionCode getValueTH1(const TObject* oObject,
129 double& dEfficiencyScaleFactor,
130 double dVars[]
131 );
132 static CP::CorrectionCode getValueTH2(const TObject* oObject,
133 double& dEfficiencyScaleFactor,
134 double dVars[]
135 );
136
138 void generateSystematicSets();
140 bool m_bSFIsAvailableDiTau;
142 bool m_bSFIsAvailableCheckedDiTau;
143
144 CP::SystematicSet m_sAffectingSystematics;
145 CP::SystematicSet m_sRecommendedSystematics;
146
147 Gaudi::Property<bool> m_bSkipTruthMatchCheck{this, "SkipTruthMatchCheck", false};
148 Gaudi::Property<std::string> m_sInputFilePath{this, "InputFilePath", ""};
149 Gaudi::Property<std::string> m_sWP{this, "WP", ""};
150 Gaudi::Property<std::string> m_sVarName{this, "VarName", ""};
151
152 std::string m_sInputFileName;
153 std::string m_sSFHistName;
154
156
157};
158} // namespace ADD_CMODE(TauAnalysisTools)
159
160#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.
Base class for the dual-use tool implementation classes.
Definition AsgTool.h:47
DiTauJet_v1 DiTauJet
Definition of the current version.
Definition DiTauJet.h:17
void initialize()