00001
00002
00003
00004
00005
00006
00007
00008 #ifndef MUONEFFICIENCYSCALEFACTORS_H_
00009 #define MUONEFFICIENCYSCALEFACTORS_H_
00010
00011 #include "MuonEfficiencyCorrections/IMuonEfficiencyScaleFactors.h"
00012 #include "MuonEfficiencyCorrections/MuonEfficiencyType.h"
00013 #include "MuonEfficiencyCorrections/EfficiencyScaleFactor.h"
00014 #include "MuonEfficiencyCorrections/EffiCollection.h"
00015
00016 #include <AsgTools/ToolHandle.h>
00017 #include <AsgTools/AsgTool.h>
00018
00019 #include <string>
00020
00021 #include <boost/unordered_map.hpp>
00022
00023 namespace CP {
00024 class MuonEfficiencyScaleFactors: public CP::IMuonEfficiencyScaleFactors, public asg::AsgTool {
00025 ASG_TOOL_CLASS2( MuonEfficiencyScaleFactors, CP::IMuonEfficiencyScaleFactors, CP::ISystematicsTool )
00026
00027 public:
00028 MuonEfficiencyScaleFactors(const std::string& name);
00029
00030 virtual ~MuonEfficiencyScaleFactors();
00031
00033 virtual StatusCode initialize();
00034
00036 virtual CorrectionCode getEfficiencyScaleFactor(const xAOD::Muon& mu, float& sf, const xAOD::EventInfo* info = 0) const;
00037 virtual CorrectionCode applyEfficiencyScaleFactor(const xAOD::Muon& mu, const xAOD::EventInfo* info = 0) const;
00039 virtual CorrectionCode getEfficiencyScaleFactorReplicas(const xAOD::Muon& mu, std::vector<float> & sf_err, const xAOD::EventInfo* info = 0) const;
00040 virtual CorrectionCode applyEfficiencyScaleFactorReplicas(const xAOD::Muon& mu, int nreplicas = 50, const xAOD::EventInfo* info = 0) const;
00041
00043 virtual bool isAffectedBySystematic(const SystematicVariation& systematic) const;
00044
00046 virtual SystematicSet affectingSystematics() const;
00047
00049 virtual SystematicSet recommendedSystematics() const;
00050
00051 virtual SystematicCode applySystematicVariation(const SystematicSet& systConfig);
00052
00054 virtual CorrectionCode getDataEfficiency(const xAOD::Muon& mu, float& eff, const xAOD::EventInfo* info = 0) const;
00055 virtual CorrectionCode applyDataEfficiency(const xAOD::Muon& mu, const xAOD::EventInfo* info = 0) const;
00056
00057 virtual CorrectionCode getDataEfficiencyReplicas(const xAOD::Muon& mu, std::vector<float> & sf_err, const xAOD::EventInfo* info = 0) const;
00058 virtual CorrectionCode applyDataEfficiencyReplicas(const xAOD::Muon& mu, int nreplicas = 50, const xAOD::EventInfo* info = 0) const;
00059
00061 virtual CorrectionCode getMCEfficiency(const xAOD::Muon& mu, float& eff, const xAOD::EventInfo* info = 0) const;
00062 virtual CorrectionCode applyMCEfficiency(const xAOD::Muon& mu, const xAOD::EventInfo* info = 0) const;
00063
00064 virtual CorrectionCode getMCEfficiencyReplicas(const xAOD::Muon& mu, std::vector<float> & sf_err, const xAOD::EventInfo* info = 0) const;
00065 virtual CorrectionCode applyMCEfficiencyReplicas(const xAOD::Muon& mu, int nreplicas = 50, const xAOD::EventInfo* info = 0) const;
00066
00067
00068 MuonEfficiencyScaleFactors(const MuonEfficiencyScaleFactors& tocopy);
00069
00070
00071 MuonEfficiencyScaleFactors & operator =(const MuonEfficiencyScaleFactors & tocopy);
00072
00073 private:
00074
00075 unsigned int getRandomRunNumber(const xAOD::EventInfo* info) const;
00077 bool LoadEffiSet(SystematicSet sys);
00078 bool LoadInputs();
00079
00081
00083 std::string filename_Central();
00084 std::string filename_Calo();
00085 std::string filename_HighEta();
00086 std::string filename_LowPt();
00087 std::string filename_LowPtCalo();
00088
00089
00090 std::string resolve_file_location(const std::string &filename);
00091
00092
00093 void CopyInformation(const MuonEfficiencyScaleFactors & tocopy);
00094
00095 StatusCode CreateDecorator(SG::AuxElement::Decorator<float>* &Dec, std::string &DecName, const std::string& defaultName);
00096 StatusCode CreateVecDecorator(SG::AuxElement::Decorator<std::vector<float>>* &Dec, std::string &DecName, const std::string& defaultName);
00097 StatusCode IsDecoratorNameUnique(std::string &name);
00098
00100 std::string m_wp;
00102
00103 boost::unordered_map<SystematicSet, EffiCollection*> m_sf_sets;
00104 EffiCollection *m_current_sf;
00105
00106 std::string m_custom_dir;
00107 std::string m_custom_file_Combined;
00108 std::string m_custom_file_Calo;
00109 std::string m_custom_file_HighEta;
00110 std::string m_custom_file_LowPt;
00111 std::string m_custom_file_LowPtCalo;
00112
00113
00114 std::string m_version_string;
00115 std::string m_sys_string;
00116
00117 std::map<CP::SystematicSet, CP::SystematicSet> m_filtered_sys_sets;
00118
00119 std::string m_efficiency_decoration_name_data;
00120 std::string m_efficiency_decoration_name_mc;
00121 std::string m_sf_decoration_name;
00122 std::string m_sf_replica_decoration_name;
00123 std::string m_eff_replica_decoration_name;
00124 std::string m_mc_eff_replica_decoration_name;
00125
00126
00127 std::string m_calibration_version;
00128
00129 std::string m_effType;
00130
00131
00132 double m_lowpt_threshold;
00133
00134 SG::AuxElement::Decorator<float>* m_effDec;
00135 SG::AuxElement::Decorator<float>* m_MCeffDec;
00136 SG::AuxElement::Decorator<float>* m_sfDec;
00137
00138 SG::AuxElement::Decorator<std::vector<float> >* m_sfrDec;
00139 SG::AuxElement::Decorator<std::vector<float> >* m_effrDec;
00140 SG::AuxElement::Decorator<std::vector<float> >* m_MCeffrDec;
00141
00142 CP::SystematicSet m_affectingSys;
00143
00144 bool m_init;
00145 CP::MuonEfficiencyType m_Type;
00146 };
00147
00148 }
00149
00150 #endif