CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_3/src/DQM/DTMonitorClient/src/DTDAQInfo.cc

Go to the documentation of this file.
00001 
00002 /*
00003  *  See header file for a description of this class.
00004  *
00005  *  $Date: 2010/01/05 10:15:45 $
00006  *  $Revision: 1.6 $
00007  *  \author G. Cerminara - INFN Torino
00008  */
00009 
00010 
00011 #include "DQM/DTMonitorClient/src/DTDAQInfo.h"
00012 #include "DataFormats/FEDRawData/interface/FEDNumbering.h"
00013 
00014 #include "FWCore/ServiceRegistry/interface/Service.h"
00015 #include "FWCore/Framework/interface/ESHandle.h"
00016 #include "FWCore/Framework/interface/EventSetup.h"
00017 
00018 #include "DQMServices/Core/interface/DQMStore.h"
00019 #include "DQMServices/Core/interface/MonitorElement.h"
00020 
00021 #include "CondFormats/RunInfo/interface/RunInfo.h"
00022 #include "CondFormats/RunInfo/interface/RunSummary.h"
00023 #include "CondFormats/DataRecord/interface/RunSummaryRcd.h"
00024 
00025 
00026 #include "CondFormats/DTObjects/interface/DTReadOutMapping.h"
00027 #include "CondFormats/DataRecord/interface/DTReadOutMappingRcd.h"
00028 
00029 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00030 
00031 
00032 
00033 using namespace std;
00034 using namespace edm;
00035 
00036 
00037 
00038 DTDAQInfo::DTDAQInfo(const ParameterSet& pset) {}
00039 
00040 
00041 
00042 
00043 DTDAQInfo::~DTDAQInfo() {}
00044 
00045 
00046 
00047 void DTDAQInfo::beginJob(){
00048   // get the DQMStore
00049   theDbe = Service<DQMStore>().operator->();
00050   
00051   // book the ME
00052   // global fraction
00053   theDbe->setCurrentFolder("DT/EventInfo");
00054   totalDAQFraction = theDbe->bookFloat("DAQSummary");  
00055   totalDAQFraction->Fill(-1);
00056 
00057   // map
00058   daqMap = theDbe->book2D("DAQSummaryMap","DT Certification Summary Map",12,1,13,5,-2,3);
00059   daqMap->setAxisTitle("sector",1);
00060   daqMap->setAxisTitle("wheel",2);
00061 
00062 
00063   // Wheel "fractions" -> will be 0 or 1
00064   theDbe->setCurrentFolder("DT/EventInfo/DAQContents");
00065   for(int wheel = -2; wheel != 3; ++wheel) {
00066     stringstream streams;
00067     streams << "DT_Wheel" << wheel;
00068     daqFractions[wheel] = theDbe->bookFloat(streams.str());
00069     daqFractions[wheel]->Fill(-1);
00070   }
00071 
00072   //
00073 
00074 }
00075 
00076 
00077 
00078 void DTDAQInfo::beginLuminosityBlock(const LuminosityBlock& lumi, const  EventSetup& setup) {
00079   // create a record key for RunInfoRcd
00080   eventsetup::EventSetupRecordKey recordKey(eventsetup::EventSetupRecordKey::TypeTag::findType("RunInfoRcd"));
00081 
00082 
00083   if(setup.find(recordKey) != 0) { 
00084     // reset to 0
00085     totalDAQFraction->Fill(0.);
00086     daqFractions[-2]->Fill(0.);
00087     daqFractions[-1]->Fill(0.);
00088     daqFractions[-0]->Fill(0.);
00089     daqFractions[1]->Fill(0.);
00090     daqFractions[2]->Fill(0.);
00091 
00092     daqMap->Reset();
00093 
00094     //get fed summary information
00095     ESHandle<RunInfo> sumFED;
00096     setup.get<RunInfoRcd>().get(sumFED);    
00097     vector<int> fedInIDs = sumFED->m_fed_in;   
00098 
00099 
00100     // the range of DT feds
00101     static int FEDIDmin = FEDNumbering::MINDTFEDID;
00102     static int FEDIDMax = FEDNumbering::MAXDTFEDID;
00103 
00104     // loop on all active feds
00105     for(vector<int>::const_iterator fed = fedInIDs.begin();
00106         fed != fedInIDs.end();
00107         ++fed) {
00108       // check if the fed is in the DT range
00109       if(!(*fed >= FEDIDmin && *fed <= FEDIDMax)) continue;
00110 
00111       // check if the 12 channels are connected to any sector and fill the wheel percentage accordignly
00112       int wheel = -99;
00113       int sector = -99;
00114       int dummy = -99;
00115       for(int ros = 1; ros != 13; ++ros) {
00116         if(!mapping->readOutToGeometry(*fed,ros,2,2,2,wheel,dummy,sector,dummy,dummy,dummy)) {
00117           LogTrace("DQM|DTMonitorClient|DTDAQInfo")
00118             << "FED: " << *fed << " Ch: " << ros << " wheel: " << wheel << " Sect: " << sector << endl;
00119           daqFractions[wheel]->Fill(daqFractions[wheel]->getFloatValue() + 1./12.);
00120           totalDAQFraction->Fill(totalDAQFraction->getFloatValue() + 1./60.);
00121           daqMap->Fill(sector,wheel);
00122         }
00123       }
00124     }   
00125   } else {      
00126     LogWarning("DQM|DTMonitorClient|DTDAQInfo") << "*** Warning: record key not found for RunInfoRcd" << endl;
00127     totalDAQFraction->Fill(-1);               
00128     for(int wheel = -2; wheel != 3; ++wheel) {
00129       daqFractions[wheel]->Fill(-1);
00130     }
00131     return; 
00132   }
00133 }
00134 
00135 
00136 
00137 
00138 void DTDAQInfo::endLuminosityBlock(const LuminosityBlock&  lumi, const  EventSetup& setup){}
00139 
00140 
00141 
00142 void DTDAQInfo::endJob() {}
00143 
00144 
00145 
00146 void DTDAQInfo::analyze(const Event& event, const EventSetup& setup){}
00147 
00148 
00149 
00150 void DTDAQInfo::beginRun(const Run& run, const EventSetup& setup) {
00151   // retrieve the mapping
00152   setup.get<DTReadOutMappingRcd>().get(mapping);
00153 }