00001 #ifndef MUONEFFICIENCYCORRECTION_MUONSFTESTHELPER_H 00002 #define MUONEFFICIENCYCORRECTION_MUONSFTESTHELPER_H 00003 00004 // EDM include(s): 00005 #include "xAODMuon/Muon.h" 00006 #include "MuonEfficiencyCorrections/MuonEfficiencyScaleFactors.h" 00007 00008 //Helper class to test the Muon efficiency SFs plus their systematics 00009 00010 namespace TestMuonSF { 00011 void WriteHistogram(TFile* File, TH1* &Histo); 00012 00013 class MuonSFTestHelper { 00014 public: 00015 MuonSFTestHelper(const std::string& Name); 00016 StatusCode initialize(); 00017 template<typename T> StatusCode setProperty(const std::string &Name, T Value) { 00018 return m_Tool.setProperty(Name, Value); 00019 } 00020 CP::CorrectionCode TestSF(const xAOD::Muon& mu); 00021 bool WriteHistosToFile(TFile* file); 00022 void PrintSFs(bool B); 00023 void FillHistos(bool B); 00024 ~MuonSFTestHelper(); 00025 00026 CP::SystematicCode GetMCEfficiency(float &eff, const CP::SystematicSet &Set) const; 00027 CP::SystematicCode GetEfficiency(float &eff, const CP::SystematicSet &Set) const; 00028 CP::SystematicCode GetScaleFactor(float &eff, const CP::SystematicSet &Set) const; 00029 00030 const CP::MuonEfficiencyScaleFactors& GetTool() const; 00031 00032 protected: 00033 void CreateHistogram(CP::SystematicSet& Set); 00034 00035 CP::MuonEfficiencyScaleFactors m_Tool; 00036 CP::SystematicSet m_Nominal; 00037 std::vector<CP::SystematicSet*> m_Syst; 00038 struct TestScaleFactors { 00039 TH1* SF; 00040 TH1* eff; 00041 TH1* mceff; 00042 TH1* relSystSF; 00043 TH1* relSystEff; 00044 TH1* relSystmcEff; 00045 float sf_Value; 00046 float efficiency_Value; 00047 float mcefficiency_Value; 00048 }; 00049 std::map<CP::SystematicSet*, TestScaleFactors> m_Histos; 00050 bool m_init; 00051 bool m_Print; 00052 bool m_FillHistos; 00053 }; 00054 class MuonSFReleaseComparer { 00055 public: 00056 MuonSFReleaseComparer(MuonSFTestHelper& Rel1, MuonSFTestHelper& Rel2); 00057 StatusCode initialize(); 00058 CP::CorrectionCode TestSF(const xAOD::Muon& mu); 00059 bool WriteHistosToFile(TFile* file); 00060 ~MuonSFReleaseComparer(); 00061 protected: 00062 void CreateHistogram(const CP::SystematicSet &Set); 00063 00064 MuonSFTestHelper& m_Rel1; 00065 MuonSFTestHelper& m_Rel2; 00066 00067 struct ComparingHistos { 00068 TH1* SF; 00069 TH1* eff; 00070 }; 00071 std::map<CP::SystematicSet, ComparingHistos> m_Histos; 00072 00073 }; 00074 00075 } 00076 00077 #endif