00001 #ifndef MUONEFFICIENCYCORRECTION_SYSTHANDLER_H
00002 #define MUONEFFICIENCYCORRECTION_SYSTHANDLER_H
00003
00004
00005 #include "xAODMuon/Muon.h"
00006
00007 #ifdef ROOTCORE
00008 # include "xAODRootAccess/Init.h"
00009 # include "xAODRootAccess/TEvent.h"
00010 #endif // ROOTCORE
00011
00012
00013 #include "xAODEventInfo/EventInfo.h"
00014 #include "xAODMuon/MuonContainer.h"
00015
00016 #include <PATInterfaces/CorrectionCode.h>
00017 #include <MuonEfficiencyCorrections/HistHandler.h>
00018 #include <MuonEfficiencyCorrections/MuonEfficiencyType.h>
00019 #include <PATInterfaces/ISystematicsTool.h>
00020
00021
00022 #include <TFile.h>
00023 #include <TDirectory.h>
00024 #include <TH1.h>
00025 #include <TF1.h>
00026
00027
00028 #include <string>
00029 #include <iostream>
00030 #include <exception>
00031 #include <map>
00032 #include <cmath>
00033
00034 namespace CP {
00035
00036
00037 class IKinematicSystHandler {
00038 public:
00039 virtual CorrectionCode GetKineDependent(const xAOD::Muon &mu, float& Eff) const = 0;
00040 virtual void SetSystematicWeight(float SystWeight) = 0;
00041 virtual bool initialize() = 0;
00042 virtual ~IKinematicSystHandler() {
00043 }
00044 typedef float (IKinematicSystHandler::*KinVariable)(const xAOD::Muon &mu) const;
00045 KinVariable GetMuonVariableToUse(const std::string &name);
00046
00047 float Eta(const xAOD::Muon &mu) const;
00048 float Pt(const xAOD::Muon &mu) const;
00049 float PtGeV(const xAOD::Muon &mu) const;
00050 float AbsEta(const xAOD::Muon &mu) const;
00051
00052 };
00053
00054 class PtDependentSystHandler: public IKinematicSystHandler {
00055 public:
00056 virtual CorrectionCode GetKineDependent(const xAOD::Muon &mu, float& Eff) const;
00057 virtual void SetSystematicWeight(float SystWeight);
00058
00059 virtual bool initialize();
00060 PtDependentSystHandler(HistHandler* HistHandler);
00061 virtual ~PtDependentSystHandler();
00062 protected:
00063 HistHandler* m_Handler;
00064 float m_SystWeight;
00065 };
00066 class BadMuonVetoSystHandler: public IKinematicSystHandler {
00067 public:
00068 virtual CorrectionCode GetKineDependent(const xAOD::Muon &mu, float& Eff) const;
00069 virtual void SetSystematicWeight(float SystWeight);
00070
00071 virtual bool initialize();
00072 BadMuonVetoSystHandler(TDirectory* InDir);
00073 virtual ~BadMuonVetoSystHandler();
00074
00075 protected:
00076 CP::CorrectionCode FindAppropiatePolynomial(const xAOD::Muon& mu, TF1* &Poly) const;
00077 std::string GetNextProperty(std::string &sstr);
00078
00079 typedef std::pair<float, float> Ranges;
00080 std::map<Ranges, TF1*> m_SystPolynomials;
00081
00082 KinVariable m_FirstVar;
00083 KinVariable m_SecondVar;
00084 float m_SystWeight;
00085
00086 };
00087
00088 }
00089
00090 #endif