Back to home page

Project CMSSW displayed by LXR

 
 

    


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

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