32 constexpr int PXID_shift = ADC_shift + ADC_bits;
33 constexpr int DCOL_shift = PXID_shift + PXID_bits;
34 constexpr int ROC_shift = DCOL_shift + DCOL_bits;
35 constexpr int LINK_shift = ROC_shift + ROC_bits;
50 includeErrors =
false;
55 includeErrors = ErrorStatus;
60 int CRC_BIT = (*trailer >> CRC_shift) & CRC_mask;
61 if (CRC_BIT == 0)
return true;
66 errors[dummyDetId].push_back(error);
73 FEDHeader fedHeader( reinterpret_cast<const unsigned char*>(header));
74 if ( !fedHeader.
check() )
return false;
76 LogDebug(
"PixelDataFormatter::interpretRawData, fedHeader.sourceID() != fedId")
77 <<
", sourceID = " <<fedHeader.
sourceID()
78 <<
", fedId = "<<fedId<<
", errorType = 32";
83 errors[dummyDetId].push_back(error);
91 FEDTrailer fedTrailer(reinterpret_cast<const unsigned char*>(trailer));
92 if ( !fedTrailer.
check()) {
96 errors[dummyDetId].push_back(error);
100 <<
"fedTrailer.check failed, Fed: " << fedId <<
", errorType = 33";
104 LogError(
"FedTrailerLenght")<<
"fedTrailer.fragmentLength()!= nWords !! Fed: " << fedId <<
", errorType = 34";
105 errorsInEvent =
true;
109 errors[dummyDetId].push_back(error);
118 int errorType = (errorWord >> ROC_shift) & ERROR_mask;
119 if LIKELY(errorType<25)
return true;
123 CablingPathToDetUnit cablingPath = { unsigned(fedId), (errorWord >> LINK_shift) & LINK_mask, 1 };
124 if (!theCablingTree->
findItem(cablingPath))
return false;
125 LogDebug(
"")<<
" invalid ROC=25 found (errorType=25)";
126 errorsInEvent =
true;
138 LogDebug(
"")<<
" error fifo nearly full (errorType=28)";
139 errorsInEvent =
true;
143 LogDebug(
"")<<
" timeout on a channel (errorType=29)";
144 errorsInEvent =
true;
145 if ((errorWord >> OMIT_ERR_shift) & OMIT_ERR_mask) {
146 LogDebug(
"")<<
" ...first errorType=29 error, this gets masked out";
152 LogDebug(
"")<<
" TBM error trailer (errorType=30)";
153 int StateMatch_bits = 4;
154 int StateMatch_shift = 8;
155 uint32_t StateMatch_mask = ~(~uint32_t(0) << StateMatch_bits);
156 int StateMatch = (errorWord >> StateMatch_shift) & StateMatch_mask;
157 if( StateMatch!=1 && StateMatch!=8 ) {
158 LogDebug(
"")<<
" FED error 30 with unexpected State Bits (errorType=30)";
161 if( StateMatch==1 ) errorType = 40;
162 errorsInEvent =
true;
166 LogDebug(
"")<<
" event number error (errorType=31)";
167 errorsInEvent =
true;
170 default:
return true;
177 detId = errorDetId(converter, errorType, errorWord);
178 errors[detId].push_back(error);
187 LogDebug(
"ErrorChecker::conversionError") <<
" Fed: " << fedId <<
" invalid channel Id (errorType=35)";
191 cms_uint32_t detId = errorDetId(converter, errorType, errorWord);
192 errors[detId].push_back(error);
197 LogDebug(
"ErrorChecker::conversionError")<<
" Fed: " << fedId <<
" invalid ROC Id (errorType=36)";
201 cms_uint32_t detId = errorDetId(converter, errorType, errorWord);
202 errors[detId].push_back(error);
207 LogDebug(
"ErrorChecker::conversionError")<<
" Fed: " << fedId <<
" invalid dcol/pixel value (errorType=37)";
211 cms_uint32_t detId = errorDetId(converter, errorType, errorWord);
212 errors[detId].push_back(error);
217 LogDebug(
"ErrorChecker::conversionError")<<
" Fed: " << fedId <<
" dcol/pixel read out of order (errorType=38)";
221 cms_uint32_t detId = errorDetId(converter, errorType, errorWord);
222 errors[detId].push_back(error);
226 default:
LogDebug(
"ErrorChecker::conversionError")<<
" cabling check returned unexpected result, status = "<<
status;
232 int errorType,
const Word32 & word)
const 234 if (!converter)
return dummyDetId;
239 case 25 :
case 30 :
case 31 :
case 36 :
case 40 : {
244 cabling.
link = (word >> LINK_shift) & LINK_mask;
248 if (!status)
return detIdx.
rawId;
253 const int DB0_shift = 0;
254 const int DB1_shift = DB0_shift + 1;
255 const int DB2_shift = DB1_shift + 1;
256 const int DB3_shift = DB2_shift + 1;
257 const int DB4_shift = DB3_shift + 1;
260 int CH1 = (word >> DB0_shift) & DataBit_mask;
261 int CH2 = (word >> DB1_shift) & DataBit_mask;
262 int CH3 = (word >> DB2_shift) & DataBit_mask;
263 int CH4 = (word >> DB3_shift) & DataBit_mask;
264 int CH5 = (word >> DB4_shift) & DataBit_mask;
268 int BLOCK = (word >> BLOCK_shift) & BLOCK_mask;
269 int localCH = 1*CH1+2*CH2+3*CH3+4*CH4+5*CH5;
270 if (BLOCK%2==0) chanNmbr=(BLOCK/2)*9+localCH;
271 else chanNmbr = ((BLOCK-1)/2)*9+4+localCH;
272 if ((chanNmbr<1)||(chanNmbr>36))
break;
278 cabling.
link = chanNmbr;
281 if (!status)
return detIdx.
rawId;
287 cabling.
roc = (word >> ROC_shift) & ROC_mask;
288 cabling.
link = (word >> LINK_shift) & LINK_mask;
bool check() const
Check that the trailer is OK.
bool moreTrailers() const
cms_uint32_t errorDetId(const SiPixelFrameConverter *converter, int errorType, const Word32 &word) const
uint32_t fragmentLength() const
The length of the event fragment counted in 64-bit words including header and trailer.
bool checkROC(bool &errorsInEvent, int fedId, const SiPixelFrameConverter *converter, const SiPixelFedCabling *theCablingTree, Word32 &errorWord, Errors &errors)
bool checkTrailer(bool &errorsInEvent, int fedId, unsigned int nWords, const Word64 *trailer, Errors &errors)
std::map< cms_uint32_t, DetErrors > Errors
bool checkCRC(bool &errorsInEvent, int fedId, const Word64 *trailer, Errors &errors)
void setErrorStatus(bool ErrorStatus)
unsigned int cms_uint32_t
virtual const sipixelobjects::PixelROC * findItem(const sipixelobjects::CablingPathToDetUnit &) const =0
void conversionError(int fedId, const SiPixelFrameConverter *converter, int status, Word32 &errorWord, Errors &errors)
int toDetector(const sipixelobjects::ElectronicIndex &cabling, sipixelobjects::DetectorIndex &detector) const
Pixel error – collection of errors and error information.
bool checkHeader(bool &errorsInEvent, int fedId, const Word64 *header, Errors &errors)