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;
48 includeErrors =
false;
53 includeErrors = ErrorStatus;
58 int CRC_BIT = (*trailer >> CRC_shift) & CRC_mask;
59 if (CRC_BIT == 0)
return true;
64 errors[dummyDetId].push_back(error);
71 FEDHeader fedHeader( reinterpret_cast<const unsigned char*>(header));
72 if ( !fedHeader.
check() )
return false;
74 LogDebug(
"PixelDataFormatter::interpretRawData, fedHeader.sourceID() != fedId")
75 <<
", sourceID = " <<fedHeader.
sourceID()
76 <<
", fedId = "<<fedId<<
", errorType = 32";
81 errors[dummyDetId].push_back(error);
89 FEDTrailer fedTrailer(reinterpret_cast<const unsigned char*>(trailer));
90 if ( !fedTrailer.
check()) {
94 errors[dummyDetId].push_back(error);
98 <<
"fedTrailer.check failed, Fed: " << fedId <<
", errorType = 33";
102 LogError(
"FedTrailerLenght")<<
"fedTrailer.fragmentLength()!= nWords !! Fed: " << fedId <<
", errorType = 34";
103 errorsInEvent =
true;
107 errors[dummyDetId].push_back(error);
116 int errorType = (errorWord >> ROC_shift) & ERROR_mask;
117 if LIKELY(errorType<25)
return true;
121 CablingPathToDetUnit cablingPath = { unsigned(fedId), (errorWord >> LINK_shift) & LINK_mask, 1 };
122 if (!theCablingTree->
findItem(cablingPath))
return false;
123 LogDebug(
"")<<
" invalid ROC=25 found (errorType=25)";
124 errorsInEvent =
true;
136 LogDebug(
"")<<
" error fifo nearly full (errorType=28)";
137 errorsInEvent =
true;
141 LogDebug(
"")<<
" timeout on a channel (errorType=29)";
142 errorsInEvent =
true;
143 if ((errorWord >> OMIT_ERR_shift) & OMIT_ERR_mask) {
144 LogDebug(
"")<<
" ...first errorType=29 error, this gets masked out";
150 LogDebug(
"")<<
" TBM error trailer (errorType=30)";
151 int StateMatch_bits = 4;
152 int StateMatch_shift = 8;
153 uint32_t StateMatch_mask = ~(~uint32_t(0) << StateMatch_bits);
154 int StateMatch = (errorWord >> StateMatch_shift) & StateMatch_mask;
155 if( StateMatch!=1 && StateMatch!=8 ) {
156 LogDebug(
"")<<
" FED error 30 with unexpected State Bits (errorType=30)";
159 if( StateMatch==1 ) errorType = 40;
160 errorsInEvent =
true;
164 LogDebug(
"")<<
" event number error (errorType=31)";
165 errorsInEvent =
true;
168 default:
return true;
175 detId = errorDetId(converter, errorType, errorWord);
176 errors[detId].push_back(error);
185 LogDebug(
"ErrorChecker::conversionError") <<
" Fed: " << fedId <<
" invalid channel Id (errorType=35)";
189 cms_uint32_t detId = errorDetId(converter, errorType, errorWord);
190 errors[detId].push_back(error);
195 LogDebug(
"ErrorChecker::conversionError")<<
" Fed: " << fedId <<
" invalid ROC Id (errorType=36)";
199 cms_uint32_t detId = errorDetId(converter, errorType, errorWord);
200 errors[detId].push_back(error);
205 LogDebug(
"ErrorChecker::conversionError")<<
" Fed: " << fedId <<
" invalid dcol/pixel value (errorType=37)";
209 cms_uint32_t detId = errorDetId(converter, errorType, errorWord);
210 errors[detId].push_back(error);
215 LogDebug(
"ErrorChecker::conversionError")<<
" Fed: " << fedId <<
" dcol/pixel read out of order (errorType=38)";
219 cms_uint32_t detId = errorDetId(converter, errorType, errorWord);
220 errors[detId].push_back(error);
224 default:
LogDebug(
"ErrorChecker::conversionError")<<
" cabling check returned unexpected result, status = "<<
status;
230 int errorType,
const Word32 & word)
const 232 if (!converter)
return dummyDetId;
237 case 25 :
case 30 :
case 31 :
case 36 :
case 40 : {
242 cabling.
link = (word >> LINK_shift) & LINK_mask;
246 if (!status)
return detIdx.
rawId;
251 const int DB0_shift = 0;
252 const int DB1_shift = DB0_shift + 1;
253 const int DB2_shift = DB1_shift + 1;
254 const int DB3_shift = DB2_shift + 1;
255 const int DB4_shift = DB3_shift + 1;
258 int CH1 = (word >> DB0_shift) & DataBit_mask;
259 int CH2 = (word >> DB1_shift) & DataBit_mask;
260 int CH3 = (word >> DB2_shift) & DataBit_mask;
261 int CH4 = (word >> DB3_shift) & DataBit_mask;
262 int CH5 = (word >> DB4_shift) & DataBit_mask;
266 int BLOCK = (word >> BLOCK_shift) & BLOCK_mask;
267 int localCH = 1*CH1+2*CH2+3*CH3+4*CH4+5*CH5;
268 if (BLOCK%2==0) chanNmbr=(BLOCK/2)*9+localCH;
269 else chanNmbr = ((BLOCK-1)/2)*9+4+localCH;
270 if ((chanNmbr<1)||(chanNmbr>36))
break;
276 cabling.
link = chanNmbr;
279 if (!status)
return detIdx.
rawId;
285 cabling.
roc = (word >> ROC_shift) & ROC_mask;
286 cabling.
link = (word >> LINK_shift) & LINK_mask;
bool check() const
Check that the trailer is OK.
bool moreTrailers() const
uint32_t fragmentLength() const
The length of the event fragment counted in 64-bit words including header and trailer.
std::map< cms_uint32_t, DetErrors > Errors
unsigned int cms_uint32_t
bool checkROC(bool &errorsInEvent, int fedId, const SiPixelFrameConverter *converter, const SiPixelFedCabling *theCablingTree, Word32 &errorWord, Errors &errors) override
virtual const sipixelobjects::PixelROC * findItem(const sipixelobjects::CablingPathToDetUnit &) const =0
bool checkCRC(bool &errorsInEvent, int fedId, const Word64 *trailer, Errors &errors) override
bool checkHeader(bool &errorsInEvent, int fedId, const Word64 *header, Errors &errors) override
cms_uint32_t errorDetId(const SiPixelFrameConverter *converter, int errorType, const Word32 &word) const override
int toDetector(const sipixelobjects::ElectronicIndex &cabling, sipixelobjects::DetectorIndex &detector) const
bool checkTrailer(bool &errorsInEvent, int fedId, unsigned int nWords, const Word64 *trailer, Errors &errors) override
void setErrorStatus(bool ErrorStatus) override
Pixel error – collection of errors and error information.
void conversionError(int fedId, const SiPixelFrameConverter *converter, int status, Word32 &errorWord, Errors &errors) override