00001 #include "FWCore/Framework/interface/EDAnalyzer.h" 00002 #include "FWCore/Framework/interface/Event.h" 00003 #include "FWCore/Framework/interface/EventSetup.h" 00004 #include "FWCore/ParameterSet/interface/ParameterSet.h" 00005 #include "FWCore/Framework/interface/ESHandle.h" 00006 #include "FWCore/Utilities/interface/Exception.h" 00007 #include "CondFormats/DQMObjects/interface/DQMSummary.h" 00008 #include "CondFormats/DataRecord/interface/DQMSummaryRcd.h" 00009 #include "FWCore/Framework/interface/MakerMacros.h" 00010 #include <iostream> 00011 00012 namespace edmtest { 00013 class DQMSummaryEventSetupAnalyzer: public edm::EDAnalyzer { 00014 public: 00015 explicit DQMSummaryEventSetupAnalyzer(const edm::ParameterSet & pset); 00016 explicit DQMSummaryEventSetupAnalyzer(int i); 00017 virtual ~DQMSummaryEventSetupAnalyzer(); 00018 virtual void analyze(const edm::Event& event, const edm::EventSetup& setup); 00019 }; 00020 00021 DQMSummaryEventSetupAnalyzer::DQMSummaryEventSetupAnalyzer(const edm::ParameterSet & pset) { 00022 std::cout << "DQMSummaryEventSetupAnalyzer" << std::endl; 00023 } 00024 00025 DQMSummaryEventSetupAnalyzer::DQMSummaryEventSetupAnalyzer(int i) { 00026 std::cout << "DQMSummaryEventSetupAnalyzer" << i << std::endl; 00027 } 00028 00029 DQMSummaryEventSetupAnalyzer::~DQMSummaryEventSetupAnalyzer() { 00030 std::cout << "~DQMSummaryEventSetupAnalyzer" << std::endl; 00031 } 00032 00033 void DQMSummaryEventSetupAnalyzer::analyze(const edm::Event& event, const edm::EventSetup& setup) { 00034 std::cout << "### DQMSummaryEventSetupAnalyzer::analyze" << std::endl; 00035 std::cout << "--- RUN NUMBER: " << event.id().run() << std::endl; 00036 std::cout << "--- EVENT NUMBER: " << event.id().event() << std::endl; 00037 edm::eventsetup::EventSetupRecordKey recordKey(edm::eventsetup::EventSetupRecordKey::TypeTag::findType("DQMSummaryRcd")); 00038 if(recordKey.type() == edm::eventsetup::EventSetupRecordKey::TypeTag()) { 00039 throw cms::Exception ("Record not found") << "Record \"DQMSummaryRcd" 00040 << "\" does not exist!" << std::endl; 00041 } 00042 edm::ESHandle<DQMSummary> sum; 00043 std::cout << "got EShandle" << std::endl; 00044 setup.get<DQMSummaryRcd>().get(sum); 00045 std::cout <<"got the Event Setup" << std::endl; 00046 const DQMSummary* summary = sum.product(); 00047 std::cout <<"got DQMSummary* "<< std::endl; 00048 std::cout<< "print result" << std::endl; 00049 summary->printAllValues(); 00050 } 00051 00052 DEFINE_FWK_MODULE(DQMSummaryEventSetupAnalyzer); 00053 }