CMS 3D CMS Logo

CopyPerformanceSummary.cc

Go to the documentation of this file.
00001 #include "DQM/SiStripHistoricInfoClient/interface/CopyPerformanceSummary.h"
00002 #include "FWCore/Framework/interface/ESHandle.h"
00003 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00004 #include "DataFormats/Provenance/interface/RunID.h"
00005 #include "CalibTracker/Records/interface/SiStripDetCablingRcd.h"
00006 #include "CondCore/DBOutputService/interface/PoolDBOutputService.h"
00007 #include "CondFormats/DataRecord/interface/SiStripPerformanceSummaryRcd.h"
00008 #include <string>
00009 
00010 //---- default constructor / destructor
00011 CopyPerformanceSummary::CopyPerformanceSummary(const edm::ParameterSet& iConfig) {}
00012 CopyPerformanceSummary::~CopyPerformanceSummary() {}
00013 
00014 //---- called each event
00015 void CopyPerformanceSummary::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) {
00016   if(firstEventInRun){
00017     firstEventInRun=false;
00018   }
00019   ++nevents;
00020 }
00021 
00022 //---- called each BOR
00023 void CopyPerformanceSummary::beginRun(const edm::Run& run, const edm::EventSetup& iSetup){
00024   edm::ESHandle<SiStripPerformanceSummary> tkperf;
00025   iSetup.get<SiStripPerformanceSummaryRcd>().get(tkperf);
00026   pSummary_ = new SiStripPerformanceSummary(*tkperf.product());
00027   firstEventInRun=true;
00028 }
00029 
00030 //---- called each EOR
00031 void CopyPerformanceSummary::endRun(const edm::Run& run , const edm::EventSetup& iSetup){
00032   firstEventInRun=false;
00033   pSummary_->print();
00034   writeToDB(run);
00035 }
00036 
00037 //-----------------------------------------------------------------------------------------------
00038 void CopyPerformanceSummary::beginJob(const edm::EventSetup&) {
00039   nevents = 0;
00040 }
00041 
00042 //-----------------------------------------------------------------------------------------------
00043 void CopyPerformanceSummary::endJob() {
00044 }
00045 
00046 //-----------------------------------------------------------------------------------------------
00047 void CopyPerformanceSummary::writeToDB(const edm::Run& run) const {
00048   unsigned int l_run  = run.run();
00049   std::cout<<"CopyPerformanceSummary::writeToDB()  run="<<l_run<<std::endl;
00050   //now write SiStripPerformanceSummary data in DB
00051   edm::Service<cond::service::PoolDBOutputService> mydbservice;
00052   if( mydbservice.isAvailable() ){
00053     if( mydbservice->isNewTagRequest("SiStripPerformanceSummaryRcd") ){
00054       mydbservice->createNewIOV<SiStripPerformanceSummary>(pSummary_,mydbservice->beginOfTime(),mydbservice->endOfTime(),"SiStripPerformanceSummaryRcd");
00055     } else {
00056       mydbservice->appendSinceTime<SiStripPerformanceSummary>(pSummary_,mydbservice->currentTime(),"SiStripPerformanceSummaryRcd");
00057     }
00058   }else{
00059     edm::LogError("writeToDB")<<"Service is unavailable"<<std::endl;
00060   }
00061 }

Generated on Tue Jun 9 17:33:34 2009 for CMSSW by  doxygen 1.5.4