Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-12-27 18:27:18

0001 #include "RecoBTag/PerformanceDB/interface/BtagPerformance.h"
0002 #include "FWCore/Framework/interface/EventSetup.h"
0003 #include "FWCore/Framework/interface/ESHandle.h"
0004 #include "FWCore/Framework/interface/ModuleFactory.h"
0005 #include "FWCore/Framework/interface/ESProducer.h"
0006 
0007 #include <iostream>
0008 #include <memory>
0009 #include <string>
0010 
0011 #include "RecoBTag/Records/interface/BTagPerformanceRecord.h"
0012 
0013 #include "FWCore/Framework/interface/ESProducer.h"
0014 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0015 #include <memory>
0016 
0017 using namespace edm;
0018 
0019 class BtagPerformanceESProducer : public edm::ESProducer {
0020 public:
0021   BtagPerformanceESProducer(const edm::ParameterSet& p);
0022   ~BtagPerformanceESProducer() override;
0023   std::unique_ptr<BtagPerformance> produce(const BTagPerformanceRecord&);
0024 
0025 private:
0026   edm::ESGetToken<PerformancePayload, PerformancePayloadRecord> payloadToken_;
0027   edm::ESGetToken<PerformanceWorkingPoint, PerformanceWPRecord> workingPointToken_;
0028 };
0029 
0030 BtagPerformanceESProducer::BtagPerformanceESProducer(const edm::ParameterSet& p) {
0031   std::string myname = p.getParameter<std::string>("ComponentName");
0032   auto mypl = p.getParameter<std::string>("PayloadName");
0033   auto mywp = p.getParameter<std::string>("WorkingPointName");
0034 
0035   auto c = setWhatProduced(this, myname);
0036   payloadToken_ = c.consumes(edm::ESInputTag("", mypl));
0037   workingPointToken_ = c.consumes(edm::ESInputTag("", mywp));
0038 }
0039 
0040 BtagPerformanceESProducer::~BtagPerformanceESProducer() {}
0041 
0042 std::unique_ptr<BtagPerformance> BtagPerformanceESProducer::produce(const BTagPerformanceRecord& iRecord) {
0043   auto const& pl = iRecord.get(payloadToken_);
0044   auto const& wp = iRecord.get(workingPointToken_);
0045   return std::make_unique<BtagPerformance>(pl, wp);
0046 }
0047 
0048 DEFINE_FWK_EVENTSETUP_MODULE(BtagPerformanceESProducer);