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
00026 public:
00027 MuonEfficiencyScaleFactors(const std::string& name);
00028
00029 virtual ~MuonEfficiencyScaleFactors();
00030
00031 ASG_TOOL_CLASS2( MuonEfficiencyScaleFactors, CP::IMuonEfficiencyScaleFactors, CP::ISystematicsTool )
00032
00033
00034 virtual StatusCode initialize();
00035
00037 virtual CorrectionCode getEfficiencyScaleFactor(const xAOD::Muon& mu, float& sf, const xAOD::EventInfo* info = 0) const;
00038 virtual CorrectionCode applyEfficiencyScaleFactor(const xAOD::Muon& mu, const xAOD::EventInfo* info = 0) const;
00040 virtual CorrectionCode getEfficiencyScaleFactorReplicas(const xAOD::Muon& mu, std::vector<float> & sf_err, const xAOD::EventInfo* info = 0) const;
00041 virtual CorrectionCode applyEfficiencyScaleFactorReplicas(const xAOD::Muon& mu, int nreplicas = 50, const xAOD::EventInfo* info = 0) const;
00042
00044 virtual bool isAffectedBySystematic(const SystematicVariation& systematic) const;
00045
00047 virtual SystematicSet affectingSystematics() const;
00048
00050 virtual SystematicSet recommendedSystematics() const;
00051
00052 virtual SystematicCode applySystematicVariation(const SystematicSet& systConfig);
00053
00055 virtual CorrectionCode getDataEfficiency(const xAOD::Muon& mu, float& eff, const xAOD::EventInfo* info = 0) const;
00056 virtual CorrectionCode applyDataEfficiency(const xAOD::Muon& mu, const xAOD::EventInfo* info = 0) const;
00057
00058 virtual CorrectionCode getDataEfficiencyReplicas(const xAOD::Muon& mu, std::vector<float> & sf_err, const xAOD::EventInfo* info = 0) const;
00059 virtual CorrectionCode applyDataEfficiencyReplicas(const xAOD::Muon& mu, int nreplicas = 50, const xAOD::EventInfo* info = 0) const;
00060
00062 virtual CorrectionCode getMCEfficiency(const xAOD::Muon& mu, float& eff, const xAOD::EventInfo* info = 0) const;
00063 virtual CorrectionCode applyMCEfficiency(const xAOD::Muon& mu, const xAOD::EventInfo* info = 0) const;
00064
00065 virtual CorrectionCode getMCEfficiencyReplicas(const xAOD::Muon& mu, std::vector<float> & sf_err, const xAOD::EventInfo* info = 0) const;
00066 virtual CorrectionCode applyMCEfficiencyReplicas(const xAOD::Muon& mu, int nreplicas = 50, const xAOD::EventInfo* info = 0) const;
00067
00068
00069 MuonEfficiencyScaleFactors(const MuonEfficiencyScaleFactors& tocopy);
00070
00071
00072 MuonEfficiencyScaleFactors & operator =(const MuonEfficiencyScaleFactors & tocopy);
00073
00074 private:
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
00104 boost::unordered_map<SystematicSet, EffiCollection*> m_sf_sets;
00105
00106 EffiCollection *m_current_sf;
00107
00108 std::string m_custom_dir;
00109 std::string m_custom_file_Combined;
00110 std::string m_custom_file_Calo;
00111 std::string m_custom_file_HighEta;
00112 std::string m_custom_file_LowPt;
00113 std::string m_custom_file_LowPtCalo;
00114
00115
00116 std::string m_version_string;
00117 std::string m_sys_string;
00118
00119 std::map<CP::SystematicSet, CP::SystematicSet> m_filtered_sys_sets;
00120
00121 std::string m_efficiency_decoration_name_data;
00122 std::string m_efficiency_decoration_name_mc;
00123 std::string m_sf_decoration_name;
00124 std::string m_sf_replica_decoration_name;
00125 std::string m_eff_replica_decoration_name;
00126 std::string m_mc_eff_replica_decoration_name;
00127
00128
00129 std::string m_calibration_version;
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 bool m_seperateSystBins;
00146 CP::MuonEfficiencyType m_Type;
00147 };
00148
00149 }
00150
00151 #endif