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;
117 LogDebug(
"") <<
" invalid ROC=25 found (errorType=25)";
118 errorsInEvent =
true;
128 LogDebug(
"") <<
" error fifo nearly full (errorType=28)";
129 errorsInEvent =
true;
133 LogDebug(
"") <<
" timeout on a channel (errorType=29)";
134 errorsInEvent =
true;
135 if ((errorWord >> OMIT_ERR_shift) & OMIT_ERR_mask) {
136 LogDebug(
"") <<
" ...first errorType=29 error, this gets masked out";
142 LogDebug(
"") <<
" TBM error trailer (errorType=30)";
143 errorsInEvent =
true;
147 LogDebug(
"") <<
" event number error (errorType=31)";
148 errorsInEvent =
true;
157 if (errorType == 30) {
158 int StateMach_bits = 4;
159 int StateMach_shift = 8;
160 uint32_t StateMach_mask = ~(~uint32_t(0) << StateMach_bits);
161 int StateMach = (errorWord >> StateMach_shift) & StateMach_mask;
162 if (StateMach == 4 || StateMach == 9)
169 detId = errorDetId(
converter, errorType, errorWord);
179 LogDebug(
"ErrorCheckerPhase0::conversionError") <<
" Fed: " <<
fedId <<
" invalid channel Id (errorType=35)";
189 LogDebug(
"ErrorCheckerPhase0::conversionError") <<
" Fed: " <<
fedId <<
" invalid ROC Id (errorType=36)";
199 LogDebug(
"ErrorCheckerPhase0::conversionError")
200 <<
" Fed: " <<
fedId <<
" invalid dcol/pixel value (errorType=37)";
210 LogDebug(
"ErrorCheckerPhase0::conversionError")
211 <<
" Fed: " <<
fedId <<
" dcol/pixel read out of order (errorType=38)";
221 LogDebug(
"ErrorCheckerPhase0::conversionError")
222 <<
" cabling check returned unexpected result, status = " <<
status;
245 cabling.
link = (
word >> LINK_shift) & LINK_mask;
257 const int DB0_shift = 0;
258 const int DB1_shift = DB0_shift + 1;
259 const int DB2_shift = DB1_shift + 1;
260 const int DB3_shift = DB2_shift + 1;
261 const int DB4_shift = DB3_shift + 1;
264 int CH1 = (
word >> DB0_shift) & DataBit_mask;
265 int CH2 = (
word >> DB1_shift) & DataBit_mask;
266 int CH3 = (
word >> DB2_shift) & DataBit_mask;
267 int CH4 = (
word >> DB3_shift) & DataBit_mask;
268 int CH5 = (
word >> DB4_shift) & DataBit_mask;
272 int BLOCK = (
word >> BLOCK_shift) & BLOCK_mask;
273 int localCH = 1 * CH1 + 2 * CH2 + 3 * CH3 + 4 * CH4 + 5 * CH5;
275 chanNmbr = (BLOCK / 2) * 9 + localCH;
277 chanNmbr = ((BLOCK - 1) / 2) * 9 + 4 + localCH;
278 if ((chanNmbr < 1) || (chanNmbr > 36))
285 cabling.
link = chanNmbr;
298 cabling.
roc = (
word >> ROC_shift) & ROC_mask;
299 cabling.
link = (
word >> LINK_shift) & LINK_mask;