CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_5/src/DataFormats/RPCDigi/src/ReadoutError.cc

Go to the documentation of this file.
00001 #include "DataFormats/RPCDigi/interface/ReadoutError.h"
00002 #include <bitset>
00003 #include <iostream>
00004 
00005 using namespace rpcrawtodigi;
00006 
00007 ReadoutError::ReadoutError(const LinkBoardElectronicIndex &path, const ReadoutErrorType & type) {
00008 
00009   unsigned int where = (path.dccId<< 13) | (path.dccInputChannelNum << 7) | (path.tbLinkInputNum << 2) | path.lbNumInLink;
00010   unsigned int what  = type;
00011   theError =  (where<<4) | (what & 0xf);
00012 }
00013 
00014 ReadoutError::ReadoutErrorType ReadoutError::type() const
00015 {
00016 //return static_cast<ReadoutErrorType>(theError&0xf);
00017   return ReadoutErrorType(theError & 0xf);
00018 }
00019 
00020 LinkBoardElectronicIndex ReadoutError::where() const
00021 {
00022   unsigned int data= (theError>>4);
00023   LinkBoardElectronicIndex ele;
00024   ele.dccId = (data >> 13);
00025   ele.dccInputChannelNum= (data >> 7) & 63;
00026   ele.tbLinkInputNum = (data >> 2) & 31;
00027   ele.lbNumInLink = data & 3;
00028   return ele;
00029 }
00030 
00031 std::string ReadoutError::name(const ReadoutErrorType & code) 
00032 {
00033   std::string result;
00034   switch (code) {
00035     case (HeaderCheckFail)      : { result = "HeaderCheckFail"; break; }
00036     case (InconsitentFedId)     : { result = "InconsitentFedId"; break; }
00037     case (TrailerCheckFail)     : { result = "TrailerCheckFail"; break; }
00038     case (InconsistentDataSize) : { result = "InconsistentDataSize"; break; }
00039     case (InvalidLB)            : { result = "InvalidLB"; break; }
00040     case (EmptyPackedStrips)    : { result = "EmptyPackedStrips"; break; }
00041     case (InvalidDetId)         : { result = "InvalidDetId"; break; }
00042     case (InvalidStrip)         : { result = "InvalidStrip"; break; }
00043     case (EOD)                  : { result = "EOD"; break; }
00044     default                     : { result = "NoProblem"; }
00045   }
00046   return result;
00047 }
00048