Back to home page

Project CMSSW displayed by LXR

 
 

    


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

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