CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_3/src/DQM/RPCMonitorDigi/src/RPCDcsInfo.cc

Go to the documentation of this file.
00001 #include "DQM/RPCMonitorDigi/interface/RPCDcsInfo.h"
00002 #include "DataFormats/Scalers/interface/DcsStatus.h"
00003 #include "DataFormats/Common/interface/Handle.h"
00004 #include "DataFormats/L1GlobalTrigger/interface/L1GtFdlWord.h"
00005 #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutRecord.h"
00006 
00007 
00008 RPCDcsInfo::RPCDcsInfo(const edm::ParameterSet& ps){
00009   
00010   dbe_ = edm::Service<DQMStore>().operator->();
00011 
00012   subsystemname_ = ps.getUntrackedParameter<std::string>("subSystemFolder", "RPC") ;
00013   dcsinfofolder_ = ps.getUntrackedParameter<std::string>("dcsInfoFolder", "DCSInfo") ;
00014   scalersRawToDigiLabel_ = ps.getUntrackedParameter<std::string>("ScalersRawToDigiLabel", "scalersRawToDigi");
00015   
00016   // initialize
00017   dcs = true;
00018 }
00019 
00020 RPCDcsInfo::~RPCDcsInfo(){}
00021 
00022 void RPCDcsInfo::beginRun(const edm::Run& r, const edm::EventSetup &c ) {
00023 
00024   dbe_->cd();  
00025   dbe_->setCurrentFolder(subsystemname_ + "/" + dcsinfofolder_);
00026 
00027   DCSbyLS_=dbe_->book1D("DCSbyLS","DCS",1,0.5,1.5);
00028   DCSbyLS_->setLumiFlag();
00029 
00030   // initialize
00031   dcs=true;
00032 } 
00033 
00034 void RPCDcsInfo::analyze(const edm::Event& e, const edm::EventSetup& c){
00035  
00036   makeDcsInfo(e);
00037   return;
00038 }
00039 
00040 void RPCDcsInfo::endLuminosityBlock(const edm::LuminosityBlock& l, const edm::EventSetup& c){
00041 
00042   // int nlumi = l.id().luminosityBlock();
00043 
00044   // fill dcs vs lumi 
00045   /* set those bins 0 for which bits are ON 
00046      needed for merge off lumi histograms across files */
00047   if (dcs)  DCSbyLS_->setBinContent(1,0.);
00048   else  DCSbyLS_->setBinContent(1,1.);
00049 
00050   dcs = true;
00051   
00052   return;
00053 }
00054 
00055 
00056 void  RPCDcsInfo::makeDcsInfo(const edm::Event& e) {
00057 
00058   edm::Handle<DcsStatusCollection> dcsStatus;
00059 
00060   if ( ! e.getByLabel("scalersRawToDigi", dcsStatus) ){
00061     dcs = false;
00062     return;
00063   }
00064   
00065   if ( ! dcsStatus.isValid() ) 
00066   {
00067     edm::LogWarning("RPCDcsInfo") << "scalersRawToDigi not found" ;
00068     dcs = false; // info not available: set to false
00069     return;
00070   }
00071     
00072 
00073   for (DcsStatusCollection::const_iterator dcsStatusItr = dcsStatus->begin(); 
00074                             dcsStatusItr != dcsStatus->end(); ++dcsStatusItr)   {
00075 
00076       if (!dcsStatusItr->ready(DcsStatus::RPC)) dcs=false;
00077       
00078   }
00079       
00080   return ;
00081 }
00082