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 "CondTools/Hcal/interface/HcalSiPMCharacteristicsHandler.h"
0003 #include "FWCore/Framework/interface/MakerMacros.h"
0004 
0005 class HcalSiPMCharacteristicsPopConAnalyzer : public popcon::PopConAnalyzer<HcalSiPMCharacteristicsHandler> {
0006 public:
0007   typedef HcalSiPMCharacteristicsHandler SourceHandler;
0008 
0009   HcalSiPMCharacteristicsPopConAnalyzer(const edm::ParameterSet& pset)
0010       : popcon::PopConAnalyzer<HcalSiPMCharacteristicsHandler>(pset),
0011         m_populator(pset),
0012         m_source(pset.getParameter<edm::ParameterSet>("Source")),
0013         m_tok(esConsumes<HcalSiPMCharacteristics, HcalSiPMCharacteristicsRcd>()) {}
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 HcalSiPMCharacteristics(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<HcalSiPMCharacteristics, HcalSiPMCharacteristicsRcd> m_tok;
0033 
0034   HcalSiPMCharacteristics* myDBObject;
0035 };
0036 
0037 DEFINE_FWK_MODULE(HcalSiPMCharacteristicsPopConAnalyzer);