00001 #ifndef JETRESOLUTION_JERSMEARINGTOOL_H 00002 #define JETRESOLUTION_JERSMEARINGTOOL_H 00003 00004 // Framework includes 00005 #include "AsgTools/AsgTool.h" 00006 #include "AsgTools/ToolHandle.h" 00007 #include "PATInterfaces/CorrectionTool.h" 00008 00009 // EDM includes 00010 #include "xAODJet/JetContainer.h" 00011 00012 // Local includes 00013 #include "JetResolution/IJERSmearingTool.h" 00014 #include "JetResolution/IJERTool.h" 00015 00016 // Other includes 00017 #include "TRandom3.h" 00018 00019 00029 class JERSmearingTool : public asg::AsgTool, 00030 public IJERSmearingTool, 00031 public CP::CorrectionTool<xAOD::JetContainer> 00032 { 00033 00035 ASG_TOOL_CLASS( JERSmearingTool, IJERSmearingTool ) 00036 00037 public: 00038 00040 JERSmearingTool(const std::string& name); 00042 JERSmearingTool(const JERSmearingTool& other); 00043 00045 JERSmearingTool& operator=(const JERSmearingTool&) = delete; 00046 00049 00051 virtual StatusCode initialize(); 00052 00054 00057 00059 virtual CP::CorrectionCode applyCorrection(xAOD::Jet& jet); 00060 00062 virtual CP::CorrectionCode correctedCopy(const xAOD::Jet& input, 00063 xAOD::Jet*& output) 00064 { 00065 return CP::CorrectionTool<xAOD::JetContainer>:: 00066 correctedCopy(input, output); 00067 } 00068 00071 virtual void setRandomSeed(long int seed) 00072 { m_userSeed = seed; } 00073 00075 00078 00080 virtual bool isAffectedBySystematic 00081 (const CP::SystematicVariation& systematic) const; 00082 00084 virtual CP::SystematicSet affectingSystematics() const; 00085 00087 virtual CP::SystematicSet recommendedSystematics() const; 00088 00090 virtual CP::SystematicCode applySystematicVariation 00091 (const CP::SystematicSet& systematics); 00092 00094 00095 protected: 00096 00098 double getSmearingFactorNom(const xAOD::Jet* jet); 00099 00101 double getSmearingFactorSys(const xAOD::Jet* jet); 00102 00104 double getSmearingFactor(const xAOD::Jet* jet, double sigma); 00105 00106 private: 00107 00109 ToolHandle<IJERTool> m_jerTool; 00111 std::string m_jerToolName; 00112 00114 bool m_applyNominalSmearing; 00115 00117 bool m_isMC; 00118 00120 std::string m_sysMode; 00121 00123 TRandom3 m_rand; 00125 long int m_userSeed; 00126 00131 typedef std::unordered_map<CP::SystematicSet, CP::SystematicSet> SysFiterMap_t; 00132 SysFiterMap_t m_sysFilterMap; 00133 00135 const CP::SystematicSet* m_sysConfig; 00136 00137 }; // class JERSmearingTool 00138 00139 #endif