00001 #ifndef TAUANALYSISTOOLS_COMMONEFFICIENCYTOOL_H
00002 #define TAUANALYSISTOOLS_COMMONEFFICIENCYTOOL_H
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #include "AsgTools/AsgTool.h"
00016
00017
00018 #include "xAODTau/TauJet.h"
00019 #include "xAODTruth/TruthParticle.h"
00020 #include "PATInterfaces/CorrectionCode.h"
00021
00022
00023 #include "TauAnalysisTools/Enums.h"
00024 #include "TauAnalysisTools/ITauEfficiencyCorrectionsTool.h"
00025 #include "TauAnalysisTools/HelperFunctions.h"
00026
00027
00028 #include "TROOT.h"
00029 #include "TClass.h"
00030 #include "TFile.h"
00031 #include "TH1F.h"
00032 #include "TF1.h"
00033 #include "TKey.h"
00034
00035 namespace TauAnalysisTools
00036 {
00037
00038
00039 class TauEfficiencyCorrectionsTool;
00040
00041 class CommonEfficiencyTool
00042 : public virtual ITauEfficiencyCorrectionsTool
00043 , public asg::AsgTool
00044 {
00046 ASG_TOOL_CLASS( CommonEfficiencyTool, TauAnalysisTools::ITauEfficiencyCorrectionsTool )
00047
00048 public:
00049
00050 CommonEfficiencyTool(std::string sName);
00051
00052 ~CommonEfficiencyTool();
00053
00054 virtual StatusCode initialize();
00055
00056
00057
00058
00059 virtual CP::CorrectionCode getEfficiencyScaleFactor(const xAOD::TauJet& tau, double& dEfficiencyScaleFactor);
00060 virtual CP::CorrectionCode applyEfficiencyScaleFactor(const xAOD::TauJet& xTau);
00061
00063 virtual bool isAffectedBySystematic( const CP::SystematicVariation& systematic ) const;
00064
00066 virtual CP::SystematicSet affectingSystematics() const;
00067
00069 virtual CP::SystematicSet recommendedSystematics() const;
00070
00074 virtual CP::SystematicCode applySystematicVariation ( const CP::SystematicSet& sSystematicSet);
00075
00076 virtual bool isSupportedRunNumber( int iRunNumber )
00077 {
00078 (void) iRunNumber;
00079 return true;
00080 };
00081
00082 protected:
00083
00084 std::string ConvertProngToString(const int& iProngness);
00085
00086 typedef std::tuple<TObject*,
00087 CP::CorrectionCode (*)(const TObject* oObject,
00088 double& dEfficiencyScaleFactor,
00089 double dPt,
00090 double dEta) > tTupleObjectFunc;
00091 typedef std::map<std::string, tTupleObjectFunc > tSFMAP;
00092 tSFMAP* m_mSF;
00093
00094 std::unordered_map < CP::SystematicSet, std::string > m_mSystematicSets;
00095 const CP::SystematicSet* m_sSystematicSet;
00096 std::map<std::string, int> m_mSystematics;
00097 std::map<std::string, std::string> m_mSystematicsHistNames;
00098
00099
00100 double (*m_fX)(const xAOD::TauJet& xTau);
00101 double (*m_fY)(const xAOD::TauJet& xTau);
00102
00103 void ReadInputs(TFile* fFile);
00104 void addHistogramToSFMap(TKey* kKey, const std::string& sKeyName);
00105
00106 virtual CP::CorrectionCode getValue(const std::string& sHistName,
00107 const xAOD::TauJet& xTau,
00108 double& dEfficiencyScaleFactor) const;
00109
00110 static CP::CorrectionCode getValueTH2F(const TObject* oObject,
00111 double& dEfficiencyScaleFactor,
00112 double dPt,
00113 double dEta
00114 );
00115 static CP::CorrectionCode getValueTH2D(const TObject* oObject,
00116 double& dEfficiencyScaleFactor,
00117 double dPt,
00118 double dEta
00119 );
00120 static CP::CorrectionCode getValueTF1(const TObject* oObject,
00121 double& dEfficiencyScaleFactor,
00122 double dPt,
00123 double dEta
00124 );
00125
00126 e_TruthMatchedParticleType checkTruthMatch(const xAOD::TauJet& xTau) const;
00127 void generateSystematicSets();
00128
00129 protected:
00130
00131 CP::SystematicSet m_sAffectingSystematics;
00132 CP::SystematicSet m_sRecommendedSystematics;
00133
00134 std::string m_sInputFilePath;
00135 std::string m_sInputFileName;
00136 std::string m_sWP;
00137 std::string m_sVarName;
00138 std::string m_sSFHistName;
00139 bool m_bSkipTruthMatchCheck;
00140 bool m_bUseHighPtUncert;
00141 bool m_bNoMultiprong;
00142 bool m_bUseInclusiveEta;
00143 int m_iIDLevel;
00144 int m_iEVLevel;
00145 int m_iOLRLevel;
00146 int m_iContSysType;
00147
00148 e_TruthMatchedParticleType m_eCheckTruth;
00149
00150 bool m_bSFIsAvailable;
00151 bool m_bSFIsAvailableChecked;
00152 bool m_bPtTauEtaCalibIsAvailable;
00153 bool m_bPtTauEtaCalibIsAvailableIsChecked;
00154 };
00155 }
00156
00157 #endif // TAUANALYSISTOOLS_COMMONEFFICIENCYTOOL_H