CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_10_patch2/src/CondTools/RunInfo/plugins/FillInfoESAnalyzer.cc

Go to the documentation of this file.
00001 #include <string>
00002 #include <iostream>
00003 #include <map>
00004 #include "FWCore/Framework/interface/EDAnalyzer.h"
00005 #include "FWCore/Framework/interface/ESHandle.h"
00006 #include "FWCore/Framework/interface/Event.h"
00007 #include "FWCore/Framework/interface/EventSetup.h"
00008 #include "FWCore/Framework/interface/MakerMacros.h"
00009 #include "CondFormats/RunInfo/interface/FillInfo.h"
00010 #include "CondFormats/DataRecord/interface/FillInfoRcd.h"
00011 
00012 namespace edmtest
00013 {
00014   class FillInfoESAnalyzer : public edm::EDAnalyzer
00015   {
00016   public:
00017     explicit  FillInfoESAnalyzer(edm::ParameterSet const& p) { 
00018       std::cout<<"FillInfoESAnalyzer"<<std::endl;
00019     }
00020     explicit  FillInfoESAnalyzer(int i) {
00021       std::cout<<"FillInfoESAnalyzer "<<i<<std::endl; 
00022     }
00023     virtual ~FillInfoESAnalyzer() {  
00024       std::cout<<"~FillInfoESAnalyzer "<<std::endl;
00025     }
00026     virtual void analyze(const edm::Event& e, const edm::EventSetup& c);
00027   };
00028    
00029   void
00030    FillInfoESAnalyzer::analyze(const edm::Event& e, const edm::EventSetup& context){
00031     std::cout<<"###FillInfoESAnalyzer::analyze"<<std::endl;
00032     std::cout <<" I AM IN RUN NUMBER "<<e.id().run() <<std::endl;
00033     std::cout <<" ---EVENT NUMBER "<<e.id().event() <<std::endl;
00034     edm::eventsetup::EventSetupRecordKey recordKey(edm::eventsetup::EventSetupRecordKey::TypeTag::findType("FillInfoRcd"));
00035     if( recordKey.type() == edm::eventsetup::EventSetupRecordKey::TypeTag()) {
00036       //record not found
00037       std::cout <<"Record \"FillInfoRcd"<<"\" does not exist "<<std::endl;
00038     }
00039     edm::ESHandle<FillInfo> sum;
00040     std::cout<<"got eshandle"<<std::endl;
00041     context.get<FillInfoRcd>().get(sum);
00042     std::cout<<"got context"<<std::endl;
00043     const FillInfo* summary=sum.product();
00044     std::cout<<"got FillInfo* "<< std::endl;
00045     std::cout<< "print  result" << std::endl;
00046     std::cout << *summary;
00047   }
00048   DEFINE_FWK_MODULE(FillInfoESAnalyzer);
00049 }
00050