File indexing completed on 2024-04-06 12:05:08
0001 #include "DataFormats/RPCDigi/interface/ReadoutError.h"
0002 #include <bitset>
0003 #include <iostream>
0004
0005 using namespace rpcrawtodigi;
0006
0007 ReadoutError::ReadoutError(const LinkBoardElectronicIndex &path, const ReadoutErrorType &type) {
0008 unsigned int where =
0009 (path.dccId << 13) | (path.dccInputChannelNum << 7) | (path.tbLinkInputNum << 2) | path.lbNumInLink;
0010 unsigned int what = type;
0011 theError = (where << 4) | (what & 0xf);
0012 }
0013
0014 ReadoutError::ReadoutErrorType ReadoutError::type() const {
0015
0016 return ReadoutErrorType(theError & 0xf);
0017 }
0018
0019 LinkBoardElectronicIndex ReadoutError::where() const {
0020 unsigned int data = (theError >> 4);
0021 LinkBoardElectronicIndex ele;
0022 ele.dccId = (data >> 13);
0023 ele.dccInputChannelNum = (data >> 7) & 63;
0024 ele.tbLinkInputNum = (data >> 2) & 31;
0025 ele.lbNumInLink = data & 3;
0026 return ele;
0027 }
0028
0029 std::string ReadoutError::name(const ReadoutErrorType &code) {
0030 std::string result;
0031 switch (code) {
0032 case (HeaderCheckFail): {
0033 result = "HeaderCheckFail";
0034 break;
0035 }
0036 case (InconsitentFedId): {
0037 result = "InconsitentFedId";
0038 break;
0039 }
0040 case (TrailerCheckFail): {
0041 result = "TrailerCheckFail";
0042 break;
0043 }
0044 case (InconsistentDataSize): {
0045 result = "InconsistentDataSize";
0046 break;
0047 }
0048 case (InvalidLB): {
0049 result = "InvalidLB";
0050 break;
0051 }
0052 case (EmptyPackedStrips): {
0053 result = "EmptyPackedStrips";
0054 break;
0055 }
0056 case (InvalidDetId): {
0057 result = "InvalidDetId";
0058 break;
0059 }
0060 case (InvalidStrip): {
0061 result = "InvalidStrip";
0062 break;
0063 }
0064 case (EOD): {
0065 result = "EOD";
0066 break;
0067 }
0068 default: {
0069 result = "NoProblem";
0070 }
0071 }
0072 return result;
0073 }