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";
101 if ( fedTrailer.
lenght()!= nWords) {
102 LogError(
"FedTrailerLenght")<<
"fedTrailer.lenght()!= nWords !! Fed: " << fedId <<
", errorType = 34";
103 errorsInEvent =
true;
107 errors[dummyDetId].push_back(error);
115 int errorType = (errorWord >> ROC_shift) & ERROR_mask;
116 if likely(errorType<25)
return true;
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 errorsInEvent =
true;
152 LogDebug(
"")<<
" event number error (errorType=31)";
153 errorsInEvent =
true;
156 default:
return true;
162 int StateMach_bits = 4;
163 int StateMach_shift = 8;
164 uint32_t StateMach_mask = ~(~uint32_t(0) << StateMach_bits);
165 int StateMach = (errorWord >> StateMach_shift) & StateMach_mask;
166 if( StateMach==4 || StateMach==9 ) errorType = 40;
172 detId = errorDetId(converter, errorType, errorWord);
173 errors[detId].push_back(error);
182 LogDebug(
"ErrorChecker::conversionError") <<
" Fed: " << fedId <<
" invalid channel Id (errorType=35)";
186 cms_uint32_t detId = errorDetId(converter, errorType, errorWord);
187 errors[detId].push_back(error);
192 LogDebug(
"ErrorChecker::conversionError")<<
" Fed: " << fedId <<
" invalid ROC Id (errorType=36)";
196 cms_uint32_t detId = errorDetId(converter, errorType, errorWord);
197 errors[detId].push_back(error);
202 LogDebug(
"ErrorChecker::conversionError")<<
" Fed: " << fedId <<
" invalid dcol/pixel value (errorType=37)";
206 cms_uint32_t detId = errorDetId(converter, errorType, errorWord);
207 errors[detId].push_back(error);
212 LogDebug(
"ErrorChecker::conversionError")<<
" Fed: " << fedId <<
" dcol/pixel read out of order (errorType=38)";
216 cms_uint32_t detId = errorDetId(converter, errorType, errorWord);
217 errors[detId].push_back(error);
221 default:
LogDebug(
"ErrorChecker::conversionError")<<
" cabling check returned unexpected result, status = "<<
status;
227 int errorType,
const Word32 & word)
const 229 if (!converter)
return dummyDetId;
234 case 25 :
case 30 :
case 31 :
case 36 :
case 40 : {
239 cabling.
link = (word >> LINK_shift) & LINK_mask;
249 const int DB0_shift = 0;
250 const int DB1_shift = DB0_shift + 1;
251 const int DB2_shift = DB1_shift + 1;
252 const int DB3_shift = DB2_shift + 1;
253 const int DB4_shift = DB3_shift + 1;
256 int CH1 = (word >> DB0_shift) & DataBit_mask;
257 int CH2 = (word >> DB1_shift) & DataBit_mask;
258 int CH3 = (word >> DB2_shift) & DataBit_mask;
259 int CH4 = (word >> DB3_shift) & DataBit_mask;
260 int CH5 = (word >> DB4_shift) & DataBit_mask;
264 int BLOCK = (word >> BLOCK_shift) & BLOCK_mask;
265 int localCH = 1*CH1+2*CH2+3*CH3+4*CH4+5*CH5;
266 if (BLOCK%2==0) chanNmbr=(BLOCK/2)*9+localCH;
267 else chanNmbr = ((BLOCK-1)/2)*9+4+localCH;
268 if ((chanNmbr<1)||(chanNmbr>36))
break;
274 cabling.
link = chanNmbr;
284 cabling.
roc = (word >> ROC_shift) & ROC_mask;
285 cabling.
link = (word >> LINK_shift) & LINK_mask;
bool checkTrailer(bool &errorsInEvent, int fedId, int nWords, const Word64 *trailer, Errors &errors)
cms_uint32_t errorDetId(const SiPixelFrameConverter *converter, int errorType, const Word32 &word) const
bool checkROC(bool &errorsInEvent, int fedId, const SiPixelFrameConverter *converter, Word32 &errorWord, Errors &errors)
std::map< cms_uint32_t, DetErrors > Errors
bool checkCRC(bool &errorsInEvent, int fedId, const Word64 *trailer, Errors &errors)
void setErrorStatus(bool ErrorStatus)
int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
unsigned int cms_uint32_t
int lenght()
The length of the event fragment counted in 64-bit words including header and trailer.
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)