Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:52:11

0001 #include "CondCore/PopCon/interface/PopConAnalyzer.h"
0002 #include "CondTools/Hcal/interface/HcalFrontEndMapHandler.h"
0003 #include "FWCore/Framework/interface/MakerMacros.h"
0004 
0005 class HcalFrontEndMapPopConAnalyzer : public popcon::PopConAnalyzer<HcalFrontEndMapHandler> {
0006 public:
0007   typedef HcalFrontEndMapHandler SourceHandler;
0008 
0009   HcalFrontEndMapPopConAnalyzer(const edm::ParameterSet& pset)
0010       : popcon::PopConAnalyzer<HcalFrontEndMapHandler>(pset),
0011         m_populator(pset),
0012         m_source(pset.getParameter<edm::ParameterSet>("Source")),
0013         m_tok(esConsumes<HcalFrontEndMap, HcalFrontEndMapRcd>()) {}
0014 
0015 private:
0016   void endJob() override {
0017     m_source.initObject(myDBObject);
0018     write();
0019   }
0020 
0021   void analyze(const edm::Event& ev, const edm::EventSetup& esetup) override {
0022     //Using ES to get the data:
0023 
0024     myDBObject = new HcalFrontEndMap(esetup.getData(m_tok));
0025   }
0026 
0027   void write() { m_populator.write(m_source); }
0028 
0029 private:
0030   popcon::PopCon m_populator;
0031   SourceHandler m_source;
0032   edm::ESGetToken<HcalFrontEndMap, HcalFrontEndMapRcd> m_tok;
0033 
0034   HcalFrontEndMap* myDBObject;
0035 };
0036 
0037 DEFINE_FWK_MODULE(HcalFrontEndMapPopConAnalyzer);