CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_5_3_14/src/DQM/RPCMonitorClient/src/RPCDaqInfo.cc

Go to the documentation of this file.
00001 #include "DQM/RPCMonitorClient/interface/RPCDaqInfo.h"
00002 #include "DataFormats/FEDRawData/interface/FEDNumbering.h"
00003 #include "CondFormats/RunInfo/interface/RunInfo.h"
00004 #include "CondFormats/RunInfo/interface/RunSummary.h"
00005 #include "CondFormats/DataRecord/interface/RunSummaryRcd.h"
00006 
00007 RPCDaqInfo::RPCDaqInfo(const edm::ParameterSet& ps) {
00008  
00009   FEDRange_.first  = ps.getUntrackedParameter<unsigned int>("MinimumRPCFEDId", 790);
00010   FEDRange_.second = ps.getUntrackedParameter<unsigned int>("MaximumRPCFEDId", 792);
00011   
00012   NumberOfFeds_ =FEDRange_.second -  FEDRange_.first +1;
00013 
00014   numberOfDisks_ = ps.getUntrackedParameter<int>("NumberOfEndcapDisks", 3);
00015 }
00016 
00017 RPCDaqInfo::~RPCDaqInfo(){}
00018 
00019 void RPCDaqInfo::beginLuminosityBlock(const edm::LuminosityBlock& lumiBlock, const  edm::EventSetup& iSetup){
00020   
00021   edm::eventsetup::EventSetupRecordKey recordKey(edm::eventsetup::EventSetupRecordKey::TypeTag::findType("RunInfoRcd"));
00022 
00023 
00024   if(0 != iSetup.find( recordKey ) ) {
00025 
00026     //get fed summary information
00027     edm::ESHandle<RunInfo> sumFED;
00028     iSetup.get<RunInfoRcd>().get(sumFED);    
00029     std::vector<int> FedsInIds= sumFED->m_fed_in;   
00030 
00031     int FedCount=0;
00032 
00033     //loop on all active feds
00034     for(unsigned int fedItr=0;fedItr<FedsInIds.size(); ++fedItr) {
00035       int fedID=FedsInIds[fedItr];
00036       //make sure fed id is in allowed range  
00037 
00038       if(fedID>=FEDRange_.first && fedID<=FEDRange_.second) ++FedCount;
00039     }   
00040 
00041     //Fill active fed fraction ME
00042     if(NumberOfFeds_>0) DaqFraction_->Fill( FedCount/NumberOfFeds_);
00043     else  DaqFraction_->Fill(-1);
00044  
00045   }else{      
00046     DaqFraction_->Fill(-1);               
00047     return; 
00048   }
00049 }
00050 
00051 
00052 void RPCDaqInfo::endLuminosityBlock(const edm::LuminosityBlock&  lumiBlock, const  edm::EventSetup& iSetup){}
00053 
00054 
00055 void RPCDaqInfo::beginJob(){
00056 
00057   dbe_ = 0;
00058   dbe_ = edm::Service<DQMStore>().operator->();
00059   
00060   //fraction of alive FEDs
00061   dbe_->setCurrentFolder("RPC/EventInfo/DAQContents");
00062  
00063   int limit = numberOfDisks_;
00064   if(numberOfDisks_ < 2) limit = 2;
00065   
00066   for (int i = -1 * limit; i<= limit;i++ ){//loop on wheels and disks
00067     if (i>-3 && i<3){//wheels
00068       std::stringstream streams;
00069       streams << "RPC_Wheel" << i;
00070       daqWheelFractions[i+2] = dbe_->bookFloat(streams.str());
00071       daqWheelFractions[i+2]->Fill(-1);
00072     }
00073     
00074     if (i == 0  || i > numberOfDisks_ || i< (-1 * numberOfDisks_))continue;
00075     
00076     int offset = numberOfDisks_;
00077     if (i>0) offset --; //used to skip case equale to zero
00078     
00079     std::stringstream streams;
00080     streams << "RPC_Disk" << i;
00081     daqDiskFractions[i+2] = dbe_->bookFloat(streams.str());
00082     daqDiskFractions[i+2]->Fill(-1);
00083   }
00084 
00085 
00086   //daq summary for RPCs
00087   dbe_->setCurrentFolder("RPC/EventInfo");
00088     
00089   DaqFraction_ = dbe_->bookFloat("DAQSummary");
00090 
00091   DaqMap_ = dbe_->book2D( "DAQSummaryMap","RPC DAQ Summary Map",15, -7.5, 7.5, 12, 0.5 ,12.5);
00092 
00093  //customize the 2d histo
00094   std::stringstream BinLabel;
00095   for (int i= 1 ; i<=15; i++){
00096     BinLabel.str("");
00097     if(i<13){
00098       BinLabel<<"Sec"<<i;
00099       DaqMap_->setBinLabel(i,BinLabel.str(),2);
00100     } 
00101 
00102     BinLabel.str("");
00103     if(i<5)
00104       BinLabel<<"Disk"<<i-5;
00105     else if(i>11)
00106       BinLabel<<"Disk"<<i-11;
00107     else if(i==11 || i==5)
00108       BinLabel.str("");
00109     else
00110       BinLabel<<"Wheel"<<i-8;
00111  
00112      DaqMap_->setBinLabel(i,BinLabel.str(),1);
00113   }
00114 }
00115 
00116 
00117 void RPCDaqInfo::endJob() {}
00118 
00119 
00120 
00121 void RPCDaqInfo::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup){}
00122