Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:21:37

0001 #ifndef JERESProducer_h
0002 #define JERESProducer_h
0003 
0004 //
0005 // Author: S├ębastien Brochet
0006 //
0007 
0008 #include <string>
0009 #include <memory>
0010 
0011 #include "FWCore/Framework/interface/ModuleFactory.h"
0012 #include "FWCore/Framework/interface/ESProducer.h"
0013 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0014 
0015 #include "CondFormats/DataRecord/interface/JetResolutionRcd.h"
0016 #include "CondFormats/DataRecord/interface/JetResolutionScaleFactorRcd.h"
0017 #include "JetMETCorrections/Modules/interface/JetResolution.h"
0018 
0019 class JetResolutionESProducer : public edm::ESProducer {
0020 private:
0021   edm::ESGetToken<JME::JetResolutionObject, JetResolutionRcd> token_;
0022 
0023 public:
0024   JetResolutionESProducer(edm::ParameterSet const& fConfig) {
0025     auto label = fConfig.getParameter<std::string>("label");
0026     token_ = setWhatProduced(this, label).consumes(edm::ESInputTag{"", label});
0027   }
0028 
0029   ~JetResolutionESProducer() override {}
0030 
0031   std::unique_ptr<JME::JetResolution> produce(JetResolutionRcd const& iRecord) {
0032     return std::make_unique<JME::JetResolution>(iRecord.get(token_));
0033   }
0034 };
0035 
0036 class JetResolutionScaleFactorESProducer : public edm::ESProducer {
0037 private:
0038   edm::ESGetToken<JME::JetResolutionObject, JetResolutionScaleFactorRcd> token_;
0039 
0040 public:
0041   JetResolutionScaleFactorESProducer(edm::ParameterSet const& fConfig) {
0042     auto label = fConfig.getParameter<std::string>("label");
0043     token_ = setWhatProduced(this, label).consumes(edm::ESInputTag{"", label});
0044   }
0045 
0046   ~JetResolutionScaleFactorESProducer() override {}
0047 
0048   std::unique_ptr<JME::JetResolutionScaleFactor> produce(JetResolutionScaleFactorRcd const& iRecord) {
0049     return std::make_unique<JME::JetResolutionScaleFactor>(iRecord.get(token_));
0050   }
0051 };
0052 #endif