Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:03:08

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