Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-09-16 03:23:37

0001 #include "CondCore/PopCon/interface/PopConAnalyzer.h"
0002 #include "CondTools/Ecal/interface/EcalChannelStatusHandler.h"
0003 #include "FWCore/Framework/interface/MakerMacros.h"
0004 
0005 class ExTestEcalChannelStatusAnalyzer : public popcon::PopConAnalyzer<popcon::EcalChannelStatusHandler> {
0006 public:
0007   typedef popcon::EcalChannelStatusHandler SourceHandler;
0008 
0009   ExTestEcalChannelStatusAnalyzer(const edm::ParameterSet& pset)
0010       : popcon::PopConAnalyzer<popcon::EcalChannelStatusHandler>(pset),
0011         m_populator(pset),
0012         m_source(pset.getParameter<edm::ParameterSet>("Source")),
0013         ecalElectronicsMappingToken_(esConsumes()) {}
0014 
0015 private:
0016   void analyze(const edm::Event& ev, const edm::EventSetup& iSetup) override {
0017     ecalElectronicsMap = &iSetup.getData(ecalElectronicsMappingToken_);
0018   }
0019 
0020   void endJob() override {
0021     m_source.setElectronicsMap(ecalElectronicsMap);
0022     write();
0023   }
0024 
0025   void write() { m_populator.write(m_source); }
0026 
0027 private:
0028   popcon::PopCon m_populator;
0029   SourceHandler m_source;
0030   const EcalElectronicsMapping* ecalElectronicsMap;
0031   edm::ESGetToken<EcalElectronicsMapping, EcalMappingRcd> ecalElectronicsMappingToken_;
0032 };
0033 
0034 //define this as a plug-in
0035 DEFINE_FWK_MODULE(ExTestEcalChannelStatusAnalyzer);