CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/DQM/DTMonitorModule/src/DTROMonitorFilter.cc

Go to the documentation of this file.
00001 /*
00002  *  See header file for a description of this class.
00003  *
00004  *  $Date: 2010/03/12 18:33:51 $
00005  *  $Revision: 1.2 $
00006  *  \author G. Cerminara - INFN Torino
00007  */
00008 
00009 #include "DQM/DTMonitorModule/src/DTROMonitorFilter.h"
00010 
00011 #include <FWCore/Framework/interface/Event.h>
00012 
00013 #include <FWCore/Framework/interface/ESHandle.h>
00014 #include <FWCore/Framework/interface/EventSetup.h>
00015 #include <FWCore/ParameterSet/interface/ParameterSet.h>
00016 
00017 #include <DataFormats/FEDRawData/interface/FEDRawData.h>
00018 #include <DataFormats/FEDRawData/interface/FEDNumbering.h>
00019 #include <EventFilter/DTRawToDigi/interface/DTDDUWords.h>
00020 
00021 using namespace edm;
00022 
00023 
00024 DTROMonitorFilter::DTROMonitorFilter(const edm::ParameterSet& pset){
00025   inputLabel = pset.getUntrackedParameter<InputTag>("inputLabel",InputTag("source"));
00026 
00027 
00028 }
00029 
00030 DTROMonitorFilter::~DTROMonitorFilter(){}
00031 
00032 
00033 bool DTROMonitorFilter::filter(edm::Event& event, const edm::EventSetup& setup) {
00034   // get the raw data
00035   event.getByLabel(inputLabel, rawdata);
00036   
00037 
00038   // Loop over the DT FEDs
00039   int FEDIDmin = FEDNumbering::MINDTFEDID;
00040   int FEDIDMax = FEDNumbering::MAXDTFEDID;
00041 
00042   // Definitions
00043   static const int wordSize_32 = 4;
00044   static const int wordSize_64 = 8;
00045 
00046   for (int dduID=FEDIDmin; dduID<=FEDIDMax; ++dduID) {  // loop over all feds
00047     const FEDRawData& feddata = rawdata->FEDData(dduID);
00048     const int datasize = feddata.size();    
00049     if (datasize){ // check the FED payload
00050       const unsigned int* index32 = reinterpret_cast<const unsigned int*>(feddata.data());
00051       const int numberOf32Words = datasize/wordSize_32;
00052       
00053       const unsigned char* index8 = reinterpret_cast<const unsigned char*>(index32);
00054 
00055       // Check Status Words (1 x ROS)
00056       for (int rosId = 0; rosId < 12; rosId++ ) {
00057         int wordIndex8 = numberOf32Words*wordSize_32 - 3*wordSize_64 + rosId; 
00058         DTDDUFirstStatusWord statusWord(index8[wordIndex8]);
00059         // check the error bit
00060         if(statusWord.errorFromROS() != 0) return true;
00061       }
00062     }
00063   }
00064 
00065   // check the event error flag 
00066   return false;
00067 }