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 LogDebug(
"")<<
" invalid ROC=25 found (errorType=25)";
122 errorsInEvent =
true;
132 LogDebug(
"")<<
" error fifo nearly full (errorType=28)";
133 errorsInEvent =
true;
137 LogDebug(
"")<<
" timeout on a channel (errorType=29)";
138 errorsInEvent =
true;
139 if ((errorWord >> OMIT_ERR_shift) & OMIT_ERR_mask) {
140 LogDebug(
"")<<
" ...first errorType=29 error, this gets masked out";
146 LogDebug(
"")<<
" TBM error trailer (errorType=30)";
147 errorsInEvent =
true;
151 LogDebug(
"")<<
" event number error (errorType=31)";
152 errorsInEvent =
true;
155 default:
return true;
161 int StateMach_bits = 4;
162 int StateMach_shift = 8;
163 uint32_t StateMach_mask = ~(~uint32_t(0) << StateMach_bits);
164 int StateMach = (errorWord >> StateMach_shift) & StateMach_mask;
165 if( StateMach==4 || StateMach==9 ) errorType = 40;
171 detId = errorDetId(converter, errorType, errorWord);
172 errors[detId].push_back(error);
181 LogDebug(
"ErrorCheckerPhase0::conversionError") <<
" Fed: " << fedId <<
" invalid channel Id (errorType=35)";
185 cms_uint32_t detId = errorDetId(converter, errorType, errorWord);
186 errors[detId].push_back(error);
191 LogDebug(
"ErrorCheckerPhase0::conversionError")<<
" Fed: " << fedId <<
" invalid ROC Id (errorType=36)";
195 cms_uint32_t detId = errorDetId(converter, errorType, errorWord);
196 errors[detId].push_back(error);
201 LogDebug(
"ErrorCheckerPhase0::conversionError")<<
" Fed: " << fedId <<
" invalid dcol/pixel value (errorType=37)";
205 cms_uint32_t detId = errorDetId(converter, errorType, errorWord);
206 errors[detId].push_back(error);
211 LogDebug(
"ErrorCheckerPhase0::conversionError")<<
" Fed: " << fedId <<
" dcol/pixel read out of order (errorType=38)";
215 cms_uint32_t detId = errorDetId(converter, errorType, errorWord);
216 errors[detId].push_back(error);
220 default:
LogDebug(
"ErrorCheckerPhase0::conversionError")<<
" cabling check returned unexpected result, status = "<<
status;
226 int errorType,
const Word32 & word)
const 228 if (!converter)
return dummyDetId;
233 case 25 :
case 30 :
case 31 :
case 36 :
case 40 : {
238 cabling.
link = (word >> LINK_shift) & LINK_mask;
248 const int DB0_shift = 0;
249 const int DB1_shift = DB0_shift + 1;
250 const int DB2_shift = DB1_shift + 1;
251 const int DB3_shift = DB2_shift + 1;
252 const int DB4_shift = DB3_shift + 1;
255 int CH1 = (word >> DB0_shift) & DataBit_mask;
256 int CH2 = (word >> DB1_shift) & DataBit_mask;
257 int CH3 = (word >> DB2_shift) & DataBit_mask;
258 int CH4 = (word >> DB3_shift) & DataBit_mask;
259 int CH5 = (word >> DB4_shift) & DataBit_mask;
263 int BLOCK = (word >> BLOCK_shift) & BLOCK_mask;
264 int localCH = 1*CH1+2*CH2+3*CH3+4*CH4+5*CH5;
265 if (BLOCK%2==0) chanNmbr=(BLOCK/2)*9+localCH;
266 else chanNmbr = ((BLOCK-1)/2)*9+4+localCH;
267 if ((chanNmbr<1)||(chanNmbr>36))
break;
273 cabling.
link = chanNmbr;
283 cabling.
roc = (word >> ROC_shift) & ROC_mask;
284 cabling.
link = (word >> LINK_shift) & LINK_mask;
void setErrorStatus(bool ErrorStatus) override
cms_uint32_t errorDetId(const SiPixelFrameConverter *converter, int errorType, const Word32 &word) const override
bool checkCRC(bool &errorsInEvent, int fedId, const Word64 *trailer, Errors &errors) override
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.
bool checkHeader(bool &errorsInEvent, int fedId, const Word64 *header, Errors &errors) override
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
unsigned int cms_uint32_t
bool checkROC(bool &errorsInEvent, int fedId, const SiPixelFrameConverter *converter, const SiPixelFedCabling *theCablingTree, Word32 &errorWord, Errors &errors) override
bool checkTrailer(bool &errorsInEvent, int fedId, unsigned int nWords, const Word64 *trailer, Errors &errors) override
std::map< cms_uint32_t, DetErrors > Errors
void conversionError(int fedId, const SiPixelFrameConverter *converter, int status, Word32 &errorWord, Errors &errors) override
int toDetector(const sipixelobjects::ElectronicIndex &cabling, sipixelobjects::DetectorIndex &detector) const
Pixel error – collection of errors and error information.