21 constexpr
int CRC_bits = 1;
22 constexpr
int LINK_bits = 6;
23 constexpr
int ROC_bits = 5;
24 constexpr
int DCOL_bits = 5;
25 constexpr
int PXID_bits = 8;
26 constexpr
int ADC_bits = 8;
27 constexpr
int OMIT_ERR_bits = 1;
29 constexpr
int CRC_shift = 2;
30 constexpr
int ADC_shift = 0;
31 constexpr
int PXID_shift = ADC_shift + ADC_bits;
32 constexpr
int DCOL_shift = PXID_shift + PXID_bits;
33 constexpr
int ROC_shift = DCOL_shift + DCOL_bits;
34 constexpr
int LINK_shift = ROC_shift + ROC_bits;
35 constexpr
int OMIT_ERR_shift = 20;
51 int CRC_BIT = (*trailer >> CRC_shift) & CRC_mask;
65 if (!fedHeader.
check())
68 LogDebug(
"PixelDataFormatter::interpretRawData, fedHeader.sourceID() != fedId")
69 <<
", sourceID = " << fedHeader.
sourceID() <<
", fedId = " <<
fedId <<
", errorType = 32";
82 FEDTrailer fedTrailer(reinterpret_cast<const unsigned char*>(trailer));
83 if (!fedTrailer.
check()) {
90 LogError(
"FedTrailerCheck") <<
"fedTrailer.check failed, Fed: " <<
fedId <<
", errorType = 33";
94 LogError(
"FedTrailerLenght") <<
"fedTrailer.fragmentLength()!= nWords !! Fed: " <<
fedId <<
", errorType = 34";
111 int errorType = (errorWord >> ROC_shift) & ERROR_mask;
113 LIKELY(errorType < 25)
return true;
118 if (!theCablingTree->
findItem(cablingPath))
120 LogDebug(
"") <<
" invalid ROC=25 found (errorType=25)";
121 errorsInEvent =
true;
133 LogDebug(
"") <<
" error fifo nearly full (errorType=28)";
134 errorsInEvent =
true;
138 LogDebug(
"") <<
" timeout on a channel (errorType=29)";
139 errorsInEvent =
true;
140 if ((errorWord >> OMIT_ERR_shift) & OMIT_ERR_mask) {
141 LogDebug(
"") <<
" ...first errorType=29 error, this gets masked out";
147 LogDebug(
"") <<
" TBM error trailer (errorType=30)";
148 int StateMatch_bits = 4;
149 int StateMatch_shift = 8;
150 uint32_t StateMatch_mask = ~(~uint32_t(0) << StateMatch_bits);
151 int StateMatch = (errorWord >> StateMatch_shift) & StateMatch_mask;
152 if (StateMatch != 1 && StateMatch != 8) {
153 LogDebug(
"") <<
" FED error 30 with unexpected State Bits (errorType=30)";
158 errorsInEvent =
true;
162 LogDebug(
"") <<
" event number error (errorType=31)";
163 errorsInEvent =
true;
174 detId = errorDetId(
converter, errorType, errorWord);
184 LogDebug(
"ErrorChecker::conversionError") <<
" Fed: " <<
fedId <<
" invalid channel Id (errorType=35)";
194 LogDebug(
"ErrorChecker::conversionError") <<
" Fed: " <<
fedId <<
" invalid ROC Id (errorType=36)";
204 LogDebug(
"ErrorChecker::conversionError") <<
" Fed: " <<
fedId <<
" invalid dcol/pixel value (errorType=37)";
214 LogDebug(
"ErrorChecker::conversionError") <<
" Fed: " <<
fedId <<
" dcol/pixel read out of order (errorType=38)";
224 LogDebug(
"ErrorChecker::conversionError") <<
" cabling check returned unexpected result, status = " <<
status;
245 cabling.
link = (
word >> LINK_shift) & LINK_mask;
255 const int DB0_shift = 0;
256 const int DB1_shift = DB0_shift + 1;
257 const int DB2_shift = DB1_shift + 1;
258 const int DB3_shift = DB2_shift + 1;
259 const int DB4_shift = DB3_shift + 1;
262 int CH1 = (
word >> DB0_shift) & DataBit_mask;
263 int CH2 = (
word >> DB1_shift) & DataBit_mask;
264 int CH3 = (
word >> DB2_shift) & DataBit_mask;
265 int CH4 = (
word >> DB3_shift) & DataBit_mask;
266 int CH5 = (
word >> DB4_shift) & DataBit_mask;
270 int BLOCK = (
word >> BLOCK_shift) & BLOCK_mask;
271 int localCH = 1 * CH1 + 2 * CH2 + 3 * CH3 + 4 * CH4 + 5 * CH5;
273 chanNmbr = (BLOCK / 2) * 9 + localCH;
275 chanNmbr = ((BLOCK - 1) / 2) * 9 + 4 + localCH;
276 if ((chanNmbr < 1) || (chanNmbr > 36))
283 cabling.
link = chanNmbr;
294 cabling.
roc = (
word >> ROC_shift) & ROC_mask;
295 cabling.
link = (
word >> LINK_shift) & LINK_mask;