Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-09-07 04:53:55

0001 #include <string>
0002 #include <iostream>
0003 #include <map>
0004 #include "FWCore/Framework/interface/one/EDAnalyzer.h"
0005 #include "FWCore/Framework/interface/Event.h"
0006 #include "FWCore/Framework/interface/EventSetup.h"
0007 #include "FWCore/Framework/interface/MakerMacros.h"
0008 #include "CondFormats/RunInfo/interface/FillInfo.h"
0009 #include "CondFormats/DataRecord/interface/FillInfoRcd.h"
0010 
0011 namespace edmtest {
0012   class FillInfoESAnalyzer : public edm::one::EDAnalyzer<> {
0013   private:
0014     const edm::ESGetToken<FillInfo, FillInfoRcd> m_FillInfoToken;
0015 
0016   public:
0017     explicit FillInfoESAnalyzer(edm::ParameterSet const& p) : m_FillInfoToken(esConsumes()) {
0018       edm::LogPrint("FillInfoESAnalyzer") << "FillInfoESAnalyzer" << std::endl;
0019     }
0020     explicit FillInfoESAnalyzer(int i) {
0021       edm::LogPrint("FillInfoESAnalyzer") << "FillInfoESAnalyzer " << i << std::endl;
0022     }
0023     ~FillInfoESAnalyzer() override { edm::LogPrint("FillInfoESAnalyzer") << "~FillInfoESAnalyzer " << std::endl; }
0024     void analyze(const edm::Event& e, const edm::EventSetup& c) override;
0025   };
0026 
0027   void FillInfoESAnalyzer::analyze(const edm::Event& e, const edm::EventSetup& context) {
0028     edm::LogPrint("FillInfoESAnalyzer") << "###FillInfoESAnalyzer::analyze" << std::endl;
0029     edm::LogPrint("FillInfoESAnalyzer") << " I AM IN RUN NUMBER " << e.id().run() << std::endl;
0030     edm::LogPrint("FillInfoESAnalyzer") << " ---EVENT NUMBER " << e.id().event() << std::endl;
0031     edm::eventsetup::EventSetupRecordKey recordKey(
0032         edm::eventsetup::EventSetupRecordKey::TypeTag::findType("FillInfoRcd"));
0033     if (recordKey.type() == edm::eventsetup::EventSetupRecordKey::TypeTag()) {
0034       //record not found
0035       edm::LogPrint("FillInfoESAnalyzer") << "Record \"FillInfoRcd"
0036                                           << "\" does not exist " << std::endl;
0037     }
0038     edm::LogPrint("FillInfoESAnalyzer") << "got eshandle" << std::endl;
0039     edm::ESHandle<FillInfo> sum = context.getHandle(m_FillInfoToken);
0040     edm::LogPrint("FillInfoESAnalyzer") << "got context" << std::endl;
0041     const FillInfo* summary = sum.product();
0042     edm::LogPrint("FillInfoESAnalyzer") << "got FillInfo* " << std::endl;
0043     edm::LogPrint("FillInfoESAnalyzer") << "print  result" << std::endl;
0044     edm::LogPrint("FillInfoESAnalyzer") << *summary;
0045   }
0046   DEFINE_FWK_MODULE(FillInfoESAnalyzer);
0047 }  // namespace edmtest