CMS 3D CMS Logo

CSCDaqInfo.cc

Go to the documentation of this file.
00001 /*
00002  * =====================================================================================
00003  *
00004  *       Filename:  CSCDaqInfo.cc
00005  *
00006  *    Description:  CSC Daq Information Implementaion
00007  *
00008  *        Version:  1.0
00009  *        Created:  12/09/2008 10:55:59 AM
00010  *       Revision:  none
00011  *       Compiler:  gcc
00012  *
00013  *         Author:  Valdas Rapsevicius (VR), valdas.rapsevicius@cern.ch
00014  *        Company:  CERN, CH
00015  *
00016  * =====================================================================================
00017  */
00018 
00019 #include "DQM/CSCMonitorModule/interface/CSCDaqInfo.h"
00020 
00021 #include "DataFormats/FEDRawData/interface/FEDNumbering.h"
00022 
00023 #ifdef CMSSW22
00024 #include "CondFormats/RunInfo/interface/RunInfo.h"
00025 #include "CondFormats/RunInfo/interface/RunSummary.h"
00026 #include "CondFormats/DataRecord/interface/RunSummaryRcd.h"
00027 #endif
00028 
00029 using namespace std;
00030 using namespace edm;
00031 
00032 CSCDaqInfo::CSCDaqInfo(const edm::ParameterSet& ps) {
00033    
00034   FEDRange.first  = ps.getUntrackedParameter<unsigned int>("MinimumCSCFEDId", 750);
00035   FEDRange.second = ps.getUntrackedParameter<unsigned int>("MaximumCSCFEDId", 757);
00036   NumberOfFeds =FEDRange.second -  FEDRange.first + 1;
00037 
00038 }
00039 
00040 CSCDaqInfo::~CSCDaqInfo(){}
00041 
00042 void CSCDaqInfo::beginLuminosityBlock(const LuminosityBlock& lumiBlock, const EventSetup& iSetup){
00043     
00044 #ifdef CMSSW22
00045 
00046   edm::eventsetup::EventSetupRecordKey recordKey(edm::eventsetup::EventSetupRecordKey::TypeTag::findType("RunInfoRcd"));
00047 
00048   if(0 != iSetup.find(recordKey) ) {
00049 
00050     cout << "record key found" << endl;
00051     //get fed summary information
00052     ESHandle<RunInfo> sumFED;
00053     iSetup.get<RunInfoRcd>().get(sumFED);    
00054     vector<int> FedsInIds= sumFED->m_fed_in;   
00055     int FedCount=0;
00056 
00057     //loop on all active feds
00058     for(unsigned int fedItr = 0; fedItr < FedsInIds.size(); ++fedItr) {
00059       int fedID = FedsInIds[fedItr];
00060       //make sure fed id is in allowed range  
00061       cout << fedID << endl;   
00062       if (fedID >= FEDRange.first && fedID <= FEDRange.second) ++FedCount;
00063     }   
00064 
00065     //Fill active fed fraction ME
00066     if(NumberOfFeds > 0)
00067       DaqFraction->Fill(FedCount / NumberOfFeds);
00068     else
00069       DaqFraction->Fill(-1);
00070 
00071   } else {
00072     DaqFraction->Fill(-1);               
00073     return; 
00074   }
00075 
00076 #endif
00077 
00078 }
00079 
00080 void CSCDaqInfo::endLuminosityBlock(const edm::LuminosityBlock&  lumiBlock, const  edm::EventSetup& iSetup){}
00081 
00082 void CSCDaqInfo::beginJob(const edm::EventSetup& iSetup){
00083 
00084   dbe = 0;
00085   dbe = Service<DQMStore>().operator->();
00086        
00087   dbe->setCurrentFolder("CSC/EventInfo/DAQContents");
00088   DaqFraction = dbe->bookFloat("CSCDaqFraction");  
00089 }
00090 
00091 void CSCDaqInfo::endJob() {}
00092 
00093 void CSCDaqInfo::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup){}
00094 

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