133 {
134#ifdef PIXEL_DEBUG
135 ATH_MSG_VERBOSE(
"-------------------------------------------------------------------------------------------------------------");
137#endif
138
139 const Identifier invalidPixelId = Identifier();
140 Identifier pixelId;
142 bool isIBLModule = false;
143 bool isDBMModule = false;
144 uint32_t rodId = robFrag->rod_source_id();
145 uint32_t robId = robFrag->rob_source_id();
146 uint32_t robBCID = robFrag->rod_bc_id();
147 if (
isIBL( robId ) && robId != rodId ) {
148 generalwarning(
"Discrepancy in IBL SourceId: ROBID 0x" << std::hex << robId <<
" unequal to RODID 0x" << rodId);
149 }
151 std::unique_ptr<SG::ReadCondHandle<PixelHitDiscCnfgData> > pixHitDiscCnfg;
152 unsigned int errorRecoverable = 0;
155
156
157
158 std::array<uint64_t, PixelRodDecoder::ERROR_CONTAINER_MAX> bsErrWord{};
159 std::fill(bsErrWord.begin(),bsErrWord.end(),0);
160
161 if (robFrag->nstatus()!=0) {
163 robFrag->status(rob_status);
164
166 ATH_MSG_DEBUG(
"ROB status word for robid 0x"<< std::hex << robId <<
" is non-zero 0x" << (*rob_status) << std::dec);
167
168
169
170
171 if ((*rob_status) & (0x1u << 27)) {
173 return StatusCode::RECOVERABLE;
174 }
175 if ((*rob_status) & (0x1u << 31)) {
177 return StatusCode::RECOVERABLE;
178 }
179
180
181
182 if (robFrag->rod_ndata() > robFrag->payload_size_word() && !robFrag->check_rod_noex(robFrag->rod_version() >> 16)) {
184 " invalid ROD fragment, invalid payload size");
185 return StatusCode::RECOVERABLE;
186 }
187 }
188 }
190
191
192 unsigned int mBCID = 0x3FFF;
193 unsigned int mLVL1ID = 0x3FFF;
194 unsigned int mLink = 0x3FFF;
195 int mLVL1A = 0x3FFF;
196 int offsetBCID_ROB_FE = 0x3FFF;
197
203
204 bool link_start = false;
205 IdentifierHash offlineIdHash;
206 IdentifierHash previous_offlineIdHash;
207 int mBCID_offset = -1;
208 unsigned int mBCID_max_pix = 0x100;
209 unsigned int mBCID_max_IBL = 0x400;
210 bool receivedCondensedWords = false;
211 int countHitCondensedWords = 0;
213 bool are_4condensed_words = false;
214 unsigned int prevBCID = 0x3FFF;
215 unsigned int prevLVL1ID = 0x3FFF;
217 int prevOffsetBCID_ROB_FE = 0x3FFF;
218 unsigned int prevStartingBCID = 0x3FFF;
219 unsigned int nFragmentsPerFE[8] = {0};
220 IdentifierHash skipHash = 0xffffffff, lastHash = 0xffffffff;
222
224 robFrag->rod_data(vint);
225 int hitDiscCnfg = 3;
226
227 eformat::helper::SourceIdentifier sid_rob(robId);
228 sLinkSourceId = (sid_rob.module_id()) & 0x000F;
229 if (
isIBL( robId ) && sLinkSourceId>0x3) {
230 generalwarning(
"In ROB 0x" << std::hex << robId <<
": IBL/DBM SLink number not in correct range (0-3): SLink = " << std::dec << sLinkSourceId);
231 }
232
233 bool corruptionError = false;
234
235 std::unordered_set<Identifier> foundPixels;
236
237
238 const int nwords = robFrag->rod_ndata();
239 for (int dataword_it = 0; dataword_it < nwords; ++dataword_it) {
240 const uint32_t rawDataWord = vint[dataword_it];
243
244 serviceCodeCounter = 0;
245 serviceCode = 0;
246
247 int indexModule = -1;
248 int indexFE = -1;
249
250 if (offlineIdHash!=0xffffffff) {
251 isIBLModule = false;
252 isDBMModule = false;
254 isIBLModule =
isIBL(robId);
255 isDBMModule =
isDBM(robId);
256 }
257
258 int chFE = 0;
259 if (isIBLModule || isDBMModule) {
263 }
264 else {
266 }
267 indexModule = static_cast<int>(offlineIdHash);
268 indexFE = (1+chFE)*
m_pixel_id->wafer_hash_max()+
static_cast<int>(offlineIdHash);
269 }
270
271
272 bool headerErr_decoding = false;
273 bool headerErr_flagged = false;
274 bool headerErr_preamble = false;
275 bool headerErr_timeout = false;
276 bool headerErr_lvl1id = false;
277 bool headerErr_bcid = false;
278 switch (word_type) {
279
281
283 errorRecoverable = 0;
284
285 if (link_start) {
286 generalwarning(
"In ROB 0x" << std::hex << robId <<
": Unexpected link header found: 0x" << std::hex << rawDataWord <<
", data corruption" << std::dec);
288 headerErr_decoding = true;
289 }
290 else {
292 }
293 link_start = true;
294 are_4condensed_words = false;
295 receivedCondensedWords = false;
296 isIBLModule = false;
297 isDBMModule = false;
298 countHitCondensedWords = 0;
300 isIBLModule =
isIBL(robId);
301 isDBMModule =
isDBM(robId);
302 }
303
304 prevLVL1ID = mLVL1ID;
305 prevBCID = mBCID;
306 prevLinkNum = mLink;
307 prevOffsetBCID_ROB_FE = offsetBCID_ROB_FE;
308
309 if (isIBLModule || isDBMModule) {
310#ifdef PIXEL_DEBUG
311 ATH_MSG_VERBOSE(
"Decoding the IBL/DBM header word: 0x" << std::hex << rawDataWord << std::dec );
312#endif
313
314
320 headerErr_flagged = true;
321 }
323 mLink = fe_IBLheader;
325 if (sLinkHeader != sLinkSourceId) {
326 generalwarning(
"In ROB 0x" << std::hex << robId <<
", link 0x" << mLink <<
": SLink discrepancy: Slink number from SourceId = 0x" << std::hex << sLinkSourceId <<
", number from link header = 0x" << sLinkHeader << std::dec);
327 }
328
329 if (mLink == prevLinkNum) {
330
331 if (mLVL1ID != prevLVL1ID && prevLVL1ID != 0x3FFF) {
332 lvl1id_bcid_warning(
"In ROB 0x" << std::hex << robId <<
", FE: 0x" << mLink <<
": frame header LVL1ID differs from previous one (current frame LVL1ID = 0x" << mLVL1ID <<
", previous frame LVL1ID = 0x" << prevLVL1ID <<
")" << std::dec);
333 }
334
335 if ((mBCID != prevBCID + 1) && prevBCID != 0x3FFF && prevBCID != mBCID_max_IBL) {
336 lvl1id_bcid_warning(
"In ROB 0x" << std::hex << robId <<
", FE: 0x" << mLink <<
": frame header with non-consecutive BCID (current BCID = 0x" << mBCID <<
", previous BCID = 0x" << prevBCID <<
")" << std::dec);
337 }
338 }
339 else {
340 offsetBCID_ROB_FE = static_cast<int>(mBCID) - robBCID;
341 if (offsetBCID_ROB_FE != prevOffsetBCID_ROB_FE && (offsetBCID_ROB_FE != 0x3FFF && prevOffsetBCID_ROB_FE != 0x3FFF)) {
342 lvl1id_bcid_warning(
"In ROB 0x" << std::hex << robId <<
", FE: 0x" << mLink << std::dec <<
": FE header with unexpected BCID offset" <<
" wrt to ROB header (offset = " << offsetBCID_ROB_FE <<
", expected " << prevOffsetBCID_ROB_FE <<
" from ROB)");
343 }
344
345 if (mBCID != prevStartingBCID && prevStartingBCID != 0x3FFF) {
346 lvl1id_bcid_warning(
"In ROB 0x" << std::hex << robId <<
", FE: 0x" << mLink <<
": FE BCID starts at different value than in previous FE (current BCID = 0x" << mBCID <<
", prev starting BCID = 0x" << prevStartingBCID <<
")" << std::dec);
347 }
348 prevStartingBCID = mBCID;
349 }
350
351 if (mLink < 0x8) { ++nFragmentsPerFE[mLink]; }
352 }
353 else {
354 ATH_MSG_VERBOSE(
"Decoding Pixel header word: 0x" << std::hex << rawDataWord << std::dec );
359 if ( headerError != 0 ) {
360 sc = StatusCode::RECOVERABLE;
361 errorRecoverable = errorRecoverable | (headerError << 20);
362
363 {
364 if (headerError & (1 << 3)) {
366 headerErr_preamble = true;
367 }
368 if (headerError & (1 << 2)) {
370 headerErr_timeout = true;
371 }
372 if (headerError & (1 << 1)) {
374 headerErr_lvl1id = true;
375 }
376 if (headerError & (1 << 0)) {
378 headerErr_bcid = true;
379 }
380 }
381
382 }
383 }
384
385 onlineId = pixCabling->getOnlineIdFromRobId(robId, mLink);
386 if (onlineId == 0) {
387 generalwarning(
"In ROB 0x" << std::hex << robId <<
", FE: 0x" << mLink <<
": Got invalid onlineId (= 0) in FE header - dataword = 0x" << rawDataWord);
388 }
389
390#ifdef PIXEL_DEBUG
391 ATH_MSG_VERBOSE(
"In decoder: got onlineId 0x" << std::hex << onlineId );
392#endif
393
394 offlineIdHash =
m_pixel_id->wafer_hash(pixCabling->find_entry_onoff(onlineId));
395 if (offlineIdHash != previous_offlineIdHash) {
396 mBCID_offset = mBCID;
397
398
399 bsErrWord[static_cast<int>(offlineIdHash)+52736] = 1;
400 }
401 mLVL1A = mBCID - mBCID_offset;
402 if (mLVL1A < 0) {
403 if (isIBLModule || isDBMModule) { mLVL1A=mLVL1A+mBCID_max_IBL; }
404 else { mLVL1A=mLVL1A+mBCID_max_pix; }
405 }
406
407
408 if (isIBLModule || isDBMModule) {
409 if (indexFE>-1) {
416 }
417 }
418 else {
419
426 }
427
428
429#ifdef PIXEL_DEBUG
430 ATH_MSG_VERBOSE(
"link header with BCID: " << mBCID <<
" LVL1ID: " << mLVL1ID <<
" LVL1A: " << mLVL1A <<
" link: " << mLink <<
" found");
431 ATH_MSG_VERBOSE(
"got OfflineIDHash: 0x" << std::hex << offlineIdHash <<
" from OnlineID: 0x" << onlineId << std::dec <<
" link: " << mLink);
432#endif
433
434 if (offlineIdHash == 0xffffffff) {
435 generalwarning(
"In ROB 0x" << std::hex << robId <<
", FE: 0x" << mLink <<
": Unknown OnlineId identifier in FE header - not found by mapping" << std::dec);
437 link_start = false;
438 continue;
439 }
440 break;
441
443 if (link_start) {
445 unsigned int mFE = 0;
446 unsigned int mRow = 0;
447 unsigned int mColumn = 0;
448 int mToT = 0;
451 if (isIBLModule || isDBMModule) {
452
453#ifdef PIXEL_DEBUG
454 ATH_MSG_DEBUG (
"Decoding IBL/DBM hit word: 0x" << std::hex << rawDataWord << std::dec);
455#endif
456
458 countHitCondensedWords = 1;
459 are_4condensed_words = false;
460 condensedWords[0] = rawDataWord;
461 continue;
462 }
463 else if (countHitCondensedWords == 1) {
464 ++countHitCondensedWords;
465 condensedWords[1] = rawDataWord;
466 continue;
467 }
468 else if (countHitCondensedWords == 2) {
469 ++countHitCondensedWords;
470 condensedWords[2] = rawDataWord;
471 continue;
472 }
474 are_4condensed_words = true;
475 receivedCondensedWords = true;
476 condensedWords[3] = rawDataWord;
478
479
480
481
482
483
484
485 hitwords[0] = (condensedWords[0] &
mask24);
486
488
490
492
493 hitwords[4] = (condensedWords[3] >>
skip5) &
mask24;
494
495#ifdef PIXEL_DEBUG
496 ATH_MSG_VERBOSE(
"4 consecutive IBL hit words found. Condensed hits are being decoded");
497#endif
498
499 for (
unsigned int i(0);
i <
nHits; ++
i) {
503 ATH_MSG_VERBOSE(
"hitword[" << i <<
"] = 0x" << std::hex << hitwords[i] <<
", row: 0x" << row[i] <<
", col: 0x" << col[i] <<
", 8-bit ToT: 0x" << tot[i] << std::dec);
504 }
505 countHitCondensedWords = 0;
506 linkNum_IBLword = linkNum_IBLheader;
507 }
509 if (countHitCondensedWords != 0) {
510 generalwarning(
"In ROB 0x" << std::hex << robId <<
", link 0x" << mLink <<
": Interruption of IBL condensed words - hit(s) ignored (current dataword: 0x" << std::hex << rawDataWord << std::dec <<
")");
514 countHitCondensedWords = 0;
515 }
516
517 are_4condensed_words = false;
518 mRow =
decodeRow(rawDataWord, isIBLModule || isDBMModule );
519 mColumn =
decodeColumn(rawDataWord, isIBLModule || isDBMModule);
520 mToT =
decodeToT(rawDataWord, isIBLModule || isDBMModule);
522
523 if (linkNum_IBLword != linkNum_IBLheader) {
524 generalwarning(
"In ROB 0x" << std::hex << robId <<
": Link number mismatch - nnnnn (hit word) = 0x" << linkNum_IBLword <<
", nnnnn (header) = 0x" << linkNum_IBLheader << std::dec);
525 }
526
527#ifdef PIXEL_DEBUG
528 ATH_MSG_DEBUG(
"hit dataword found for module offlineIDHash: " << offlineIdHash <<
" Row: 0x" << std::hex << mRow <<
" Col: 0x" << mColumn <<
" Tot: 0x" << mToT << std::dec);
529#endif
530
531 }
532 else {
533 generalwarning(
"In ROB 0x" << std::hex << robId <<
", FE: 0x" << mLink <<
": IBL/DBM hit word 0x" << rawDataWord <<
" not recognised" << std::dec);
536 continue;
537 }
538
539
542 mFE = 0;
543 }
544
545 }
546 else {
547
548#ifdef PIXEL_DEBUG
549 ATH_MSG_VERBOSE(
"Decoding Pixel hit word: 0x" << std::hex << rawDataWord << std::dec);
550#endif
551
552 if (countHitCondensedWords != 0){
553 generalwarning(
"In ROB 0x" << std::hex << robId <<
", link 0x" << mLink
554 << ": Interruption of IBL condensed words - hit(s) ignored (current dataword: 0x"
555 << std::hex << rawDataWord << std::dec << ")");
559 countHitCondensedWords = 0;
560 }
561
562 are_4condensed_words = false;
564 mRow =
decodeRow(rawDataWord, isIBLModule || isDBMModule );
565 mColumn =
decodeColumn(rawDataWord, isIBLModule || isDBMModule);
566 mToT =
decodeToT(rawDataWord, isIBLModule || isDBMModule);
567
568#ifdef PIXEL_DEBUG
569 ATH_MSG_DEBUG(
"hit dataword found for module offlineIDHash: " << offlineIdHash <<
" FE: " << mFE <<
" Row: " << mRow <<
" Col: " << mColumn );
570#endif
571
572 }
573
574
575
576
577
578 if (offlineIdHash == skipHash) continue;
579 if (offlineIdHash != lastHash) {
580 lastHash = offlineIdHash;
581 if (vecHash!=nullptr) {
582 std::vector<IdentifierHash>::iterator
p = std::find(vecHash->begin(),vecHash->end(),offlineIdHash);
583 if (p == vecHash->end()) {
584 skipHash = offlineIdHash;
585 continue;
586 }
587 }
589 if( coll == nullptr ) {
591
593
594 coll->setIdentifier(ident);
595
599 ATH_MSG_ERROR(
"failed to add Pixel RDO collection to container" );
600 }
601 }
602 }
603
604
605 if (isIBLModule || isDBMModule) {
606 unsigned int num_cycles_toFillCollection(0);
607 if (are_4condensed_words) {
608 num_cycles_toFillCollection =
nHits;
609 }
610 else {
611 num_cycles_toFillCollection = 1;
613 col[0] = mColumn;
615 }
616 int IBLtot[2];
617 for (
unsigned int i(0);
i < num_cycles_toFillCollection; ++
i) {
618
619#ifdef PIXEL_DEBUG
620 ATH_MSG_VERBOSE(
"ROW[" << i <<
"] = 0x" << std::hex << row[i] << std::dec <<
", COL[" << i <<
"] = 0x" << std::hex << col[i] << std::dec <<
", 8-bit TOT[" << i <<
"] = 0x" << std::hex << tot[i] << std::dec );
621#endif
622
623
624 if ((tot[i] & 0xF0) == 0x00) {
625 generalwarning(
"In ROB 0x" << std::hex << robId <<
", FE 0x" << mLink <<
": First IBL ToT field is 0 - hit word 0x" << rawDataWord <<
" decodes to ToT1 = 0" << (tot[i] >> 4) <<
", ToT2 = 0x" << (tot[i] & 0xF) <<
", row = " << std::dec << row[i] <<
" col = " << col[i] << std::dec);
626 continue;
627 }
628 else {
629 if (((row[i] != 0) && (col[i] != 0) && (row[i] <= 336) && (col[i] <= 80)) || isDBMModule) {
630 pixelId =
m_pixelReadout ->getPixelIdfromHash (offlineIdHash, mFE, row[i], col[i]);
631
632#ifdef PIXEL_DEBUG
638 ATH_MSG_VERBOSE(
" eta_i: " << eta_i <<
", phi_i: " << phi_i <<
", eta_m: " << eta_m <<
", phi_m: " << phi_m );
639#endif
640 if (pixelId == invalidPixelId) {
641 generalwarning(
"In ROB 0x" << std::hex << robId <<
", FE 0x" << mLink <<
": Illegal pixelId - hit word 0x" << rawDataWord <<
" decodes to ToT1 = 0" << (tot[i] >> 4) <<
", ToT2 = 0x" << (tot[i] & 0xF) <<
", row = " << std::dec << row[i] <<
" col = " << col[i] << std::dec);
644 continue;
645 }
648#ifdef PIXEL_DEBUG
649 ATH_MSG_VERBOSE(
"Starting from tot = 0x" << std::hex << tot[i] <<
" IBLtot[0] = 0x" << std::hex << IBLtot[0] <<
" IBLtot[1] = 0x" << IBLtot[1] << std::dec );
650#endif
651
652 if (!pixHitDiscCnfg) {
653 pixHitDiscCnfg = std::make_unique<SG::ReadCondHandle<PixelHitDiscCnfgData> > (
m_condHitDiscCnfgKey,ctx);
654 }
655
657 hitDiscCnfg = (*pixHitDiscCnfg)->getHitDiscCnfgPL();
658 }
660 hitDiscCnfg = (*pixHitDiscCnfg)->getHitDiscCnfg3D();
661 }
662
663 if (hitDiscCnfg == 2 && IBLtot[0] == 2) IBLtot[0] = 16;
664 if (hitDiscCnfg == 2 && IBLtot[1] == 2) IBLtot[1] = 16;
666
667 coll->push_back(
new RDO(pixelId, IBLtot[0], mBCID, mLVL1ID, mLVL1A));
668 }
669 else {
671 }
672
673#ifdef PIXEL_DEBUG
674 ATH_MSG_VERBOSE(
"Collection filled with pixelId: " << pixelId <<
" TOT = 0x" << std::hex << IBLtot[0] << std::dec <<
" mBCID = " << mBCID <<
" mLVL1ID = " << mLVL1ID <<
" mLVL1A = " << mLVL1A );
675#endif
676
677
678
679
680 if (IBLtot[1] != 0x0 && (IBLtot[1] != 0xF || hitDiscCnfg != 3)) {
681 if ((row[i] + 1) > 336) {
682
683 generalwarning(
"In ROB = 0x" << std::hex << robId <<
", link 0x" << mLink <<
": Illegal IBL row number for second ToT field, hit word 0x" << rawDataWord <<
" decodes to row = " << std::dec << row[i]+1 <<
" col = " << col[i] <<
" (ToT1 = 0x" << std::hex << IBLtot[0] <<
" ToT2 = 0x" << IBLtot[1] <<
")");
686 continue;
687 }
688 else {
689 pixelId =
m_pixelReadout->getPixelIdfromHash (offlineIdHash, mFE, row[i] + 1, col[i]);
690
691#ifdef PIXEL_DEBUG
696 int phi_i_max =
m_pixel_id->phi_index_max(pixelId);
697 int eta_i_max =
m_pixel_id->eta_index_max(pixelId);
699 ATH_MSG_VERBOSE(
" eta_i: " << eta_i <<
", phi_i: " << phi_i <<
", eta_m: " << eta_m <<
", phi_m: " << phi_m <<
", eta_i_max: " << eta_i_max <<
", phi_i_max: " << phi_i_max );
700#endif
701
702 if (pixelId == invalidPixelId) {
703 generalwarning(
"In ROB 0x" << std::hex << robId <<
", FE 0x" << mLink <<
": Illegal pixelId - hit word 0x" << rawDataWord <<
" decodes to ToT1 = 0" << (tot[i] >> 4) <<
", ToT2 = 0x" << (tot[i] & 0xF) <<
", row = " << std::dec << row[i] <<
" col = " << col[i] << std::dec);
706 continue;
707 }
709 coll->push_back(
new RDO(pixelId, IBLtot[1], mBCID, mLVL1ID, mLVL1A));
710 }
711 else {
713 }
714
715#ifdef PIXEL_DEBUG
716 ATH_MSG_VERBOSE(
"Collection filled with pixelId: " << pixelId <<
" TOT = 0x" << std::hex << IBLtot[1] << std::dec <<
" mBCID = " << mBCID <<
" mLVL1ID = " << mLVL1ID <<
" mLVL1A = " << mLVL1A );
717#endif
718
719 }
720 }
721 }
722 else {
723 generalwarning(
"In ROB = 0x" << std::hex << robId <<
", link 0x" << mLink <<
": Illegal IBL row/col number, hit word 0x" << rawDataWord <<
" decodes to row = " << std::dec << row[i] <<
" col = " << col[i] <<
" (ToT1 = 0x" << std::hex << (tot[i] >> 4) <<
" ToT2 = 0x" << (tot[i] & 0xF) <<
")");
726 continue;
727 }
728 }
729 }
730 }
731
732 else {
733 pixelId =
m_pixelReadout->getPixelIdfromHash(offlineIdHash, mFE, mRow, mColumn);
734 if (pixelId == invalidPixelId) {
735 ATH_MSG_DEBUG(
"In ROB = 0x" << std::hex << robId <<
", link 0x" << mLink <<
": Illegal pixelId - row = " << std::dec << mRow <<
", col = " << mColumn <<
", dataword = 0x" << std::hex << rawDataWord << std::dec);
739 continue;
740 }
741
743 coll->push_back(
new RDO(pixelId, mToT, mBCID, mLVL1ID, mLVL1A));
744 }
745 else {
747 }
748
749#ifdef PIXEL_DEBUG
750 ATH_MSG_VERBOSE(
"Collection filled with pixelId: " << pixelId <<
" TOT = 0x" << std::hex << mToT << std::dec <<
" mBCID = " << mBCID <<
" mLVL1ID = " << mLVL1ID <<
" mLVL1A = " << mLVL1A );
751#endif
752
753 }
754 }
755 else {
756 generalwarning(
"In ROB = 0x" << std::hex << robId <<
", link 0x" << mLink <<
": Unexpected hit dataword: " << rawDataWord <<
" - hit ignored");
760 continue;
761 }
762 break;
763
765 if (link_start) {
767 }
768 else {
769 generalwarning(
"In ROB = 0x" << std::hex << robId <<
", link 0x" << mLink <<
": Unexpected trailer found: 0x" << std::hex << rawDataWord <<
", data corruption");
773 continue;
774 }
775 previous_offlineIdHash = offlineIdHash;
776 link_start = false;
777 are_4condensed_words = false;
778
779 if (isIBLModule || isDBMModule) {
780 ATH_MSG_VERBOSE(
"Decoding IBL/DBM trailer word: 0x" << std::hex << rawDataWord << std::dec );
782
783 if (trailerError & (1 << 8)) {
786 }
787
788 if (trailerError & (1 << 6)) {
791 }
792 if (trailerError & (1 << 5)) {
795 }
796 if (trailerError & (1 << 4)) {
799 }
800 if (trailerError & (1 << 3)) {
803 }
804 if (trailerError & (1 << 2)) {
807 }
808 if (trailerError & (1 << 1)) {
811 }
812 if (trailerError & (1 << 0)) {
815 }
816
817 if (trailerError & (1 << 7)) {
818 if (!receivedCondensedWords) {
generalwarning(
"In ROB 0x" << std::hex << robId <<
", link 0x" << mLink <<
": condensed mode bit is set, but no condensed words received" << std::dec); }
819 }
820
822
823 if (linkNum_IBLword != linkNum_IBLheader) {
824 generalwarning(
"In ROB 0x" << std::hex << robId <<
", link 0x" << mLink <<
": Link number mismatch - nnnnn (trailer) = 0x" << linkNum_IBLword <<
", nnnnn (header) = 0x" << linkNum_IBLheader << std::dec);
825 }
828 }
829 }
830 else {
831 ATH_MSG_VERBOSE(
"Decoding Pixel trailer word: 0x" << std::hex << rawDataWord << std::dec );
833 if (trailerError != 0) {
834 sc = StatusCode ::RECOVERABLE;
835 errorRecoverable = errorRecoverable | trailerError;
836
837 const std::array<unsigned long long, 4> bitPosition{0_BIT, 1_BIT, 2_BIT, 3_BIT};
838 for (const auto bit:bitPosition){
840 }
841
842 if ( trailerError & 0xF ) {
845 }
846
847
848 if (trailerError != 0) {
849 if (indexModule>-1) {
853 }
854 if (indexFE>-1) {
858 }
859 }
860
861 }
862 }
863 break;
864
866
867 are_4condensed_words = false;
868 if (isIBLModule || isDBMModule) {
869 ATH_MSG_VERBOSE(
"Decoding IBL/DBM FEflag word: 0x" << std::hex << rawDataWord << std::dec);
871 if (linkNum_IBLword != linkNum_IBLheader) {
872 generalwarning(
"In ROB 0x" << std::hex << robId <<
", link 0x" << mLink <<
": Link number mismatch - nnnnn (error word) = 0x" << linkNum_IBLword <<
", nnnnn (header) = 0x" << linkNum_IBLheader << std::dec);
873 }
876
877 if (serviceCode>31) {
878 generalwarning(
"In ROB 0x" << std::hex << robId <<
", link 0x" << mLink <<
": Got out-of-bounds service code: " << std::dec << serviceCode <<
" (counter: " << serviceCodeCounter <<
"), ignored");
879 }
880
883
884 if (serviceCodeCounter>0 && serviceCode<32) {
885 if (serviceCode!=14) {
886
887 if (static_cast<int>(offlineIdHash)>155 && static_cast<int>(offlineIdHash)<436) {
888
889 int indexOffset = 17*
m_pixel_id->wafer_hash_max();
890 int indexSvcCounter = indexOffset+serviceCode*280*2+2*(static_cast<int>(offlineIdHash)-156)+chFE;
891
892 bsErrWord[indexSvcCounter] = serviceCodeCounter;
893 }
894 }
895 }
896
897 }
898 else {
899 ATH_MSG_VERBOSE(
"Decoding Pixel FEflag word: 0x" << std::hex << rawDataWord << std::dec );
902 FEFlags = FEFlags & 0xff;
903 if ((MCCFlags | FEFlags) != 0) {
904 sc = StatusCode::RECOVERABLE;
905 errorRecoverable = errorRecoverable | (MCCFlags << 12) | (FEFlags << 4);
906
907 static constexpr std::array<unsigned long long, 8> bitPosition {0_BIT, 1_BIT, 2_BIT, 3_BIT, 4_BIT, 5_BIT, 6_BIT, 7_BIT};
908 for (const auto thisBit:bitPosition){
911 }
912
913 if ( MCCFlags & 0xff or FEFlags & 0xf3 ) {
916 }
917
918 if (indexModule>-1) {
927
933 }
934
935 if (indexFE>-1) {
944
950 }
951 }
952 else {
955 ATH_MSG_DEBUG(
"Disabled Pixel chip " << ((rawDataWord & 0x0F000000) >> 24) );
956 }
957 }
958
959 break;
960
961
963
964 are_4condensed_words = false;
965
966 break;
967
968
969 default:
970 generalwarning(
"In ROB 0x" << std::hex << robId <<
", FE 0x" << mLink <<
": Unknown word type found, 0x" << std::hex << rawDataWord << std::dec <<
", ignoring");
974
975 }
976 }
977
979
980
981 if (isIBLModule || isDBMModule) {
983 }
984
985
986 for (
size_t i=0; i<static_cast<size_t>(bsErrWord.size());
i++) {
987 if (bsErrWord[i]>0) {
988 decodingErrors.
setOrDrop(i,bsErrWord[i]);
989 }
990 }
991
992 if (
sc == StatusCode::RECOVERABLE) {
993
994 if (errorRecoverable == (3 << 20) ){
996 return StatusCode::SUCCESS;
997 }
998 ATH_MSG_DEBUG(
"Recoverable errors found in PixelRodDecoder, errorcode: " << errorRecoverable );
999 }
1001}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
static const uint32_t PRB_LINKHEADER
static const uint32_t skipRow
static const uint32_t skip5
static const uint32_t skip3
static const uint32_t PRB_DATAWORD
static const int nCondensedWords
static const uint32_t mask19
static const uint32_t PRB_FEERROR2
static const uint32_t mask12
static const uint32_t PRB_DATAMASK
static const uint32_t PRB_LASTHITCONDENSEDWORD
static const uint32_t skip4
static const uint32_t mask24
static const uint32_t skipTOT
static const uint32_t PRB_RAWDATA
static const uint32_t PRB_FIRSTHITCONDENSEDWORD
static const uint32_t skipCol
static const uint32_t nHits
static const uint32_t PRB_LINKTRAILER
static const uint32_t mask5
bool isIBL(uint32_t robId)
#define lvl1id_bcid_warning(x)
bool isDBM(uint32_t robId)
virtual StatusCode addCollection(const T *coll, IdentifierHash hashId)=0
virtual StatusCode naughtyRetrieve(IdentifierHash hashId, T *&collToRetrieve) const =0
bool setOrDrop(size_t i, const T &value)
Set the value for the given hash.
std::atomic_uint m_numLVL1IDErrors
uint32_t extractFefromLinkNum(const uint32_t linkNum) const
std::atomic_uint m_numPreambleErrors
InDetRawDataCollection< PixelRDORawData > PixelRawCollection
std::atomic_uint m_numLinkMaskedByPPC
std::atomic_uint m_numTimeOutErrors
std::atomic_uint m_numDecodingErrors
uint32_t getDataType(unsigned int rawDataWord, bool link_start) const
uint32_t decodeTrailerErrors_IBL(const uint32_t word) const
void propagateROBErrorsToModules(const PixelCablingCondData *pixCabling, uint32_t robId, std::array< uint64_t, PixelRodDecoder::ERROR_CONTAINER_MAX > &bsErrWord, IDCInDetBSErrContainer &decodingErrors, PixelByteStreamErrors::PixelErrorsEnum error_code, const char *error_description) const
ServiceHandle< InDetDD::IPixelReadoutManager > m_pixelReadout
StatusCode updateEventInfoIfEventCorrupted(bool isCorrupted) const
checks if all FEs have sent the same number of headers, if not, generate warning message
uint32_t decodeHeaderErrors(const uint32_t word) const
std::atomic_uint m_numBCIDErrors
std::atomic_uint m_numDuplicatedPixels
uint32_t decodeFeI4Bflag_IBL(const uint32_t word) const
uint32_t decodeMCCFlags(const uint32_t word) const
bool thisRdoIsUnique(const Identifier &pixelRdo, std::unordered_set< Identifier > &pixelRdosSeenSoFar) const
get local FEI4
uint32_t decodeRow(const uint32_t word, bool isIBLorDBM) const
uint32_t decodeModule_IBL(const uint32_t word) const
void checkUnequalNumberOfHeaders(const unsigned int nFragmentsPerFE[8], uint32_t robId) const
if the check duplicated RDO flag is true, check that this RDO is unique (returns true if unique)
uint32_t decodeFE(const uint32_t word) const
std::atomic_uint m_numLimitError
SG::ReadCondHandleKey< PixelHitDiscCnfgData > m_condHitDiscCnfgKey
uint32_t decodeTrailerErrors(const uint32_t word) const
SG::ReadCondHandleKey< PixelCablingCondData > m_condCablingKey
uint32_t decodeServiceCode_IBL(const uint32_t word) const
std::atomic_uint m_numFlaggedErrors
const PixelID * m_pixel_id
uint32_t decodeColumn(const uint32_t word, bool isIBLorDBM) const
uint32_t decodeToT(const uint32_t word, bool isIBLorDBM) const
uint32_t decodeModule(const uint32_t word) const
unsigned int getLocalFEI4(const uint32_t fe, const uint64_t onlineId) const
in case of invalid ROB fragments set corresponding error flags in all linked modules.
uint32_t decodeFEFlags2(const uint32_t word) const
uint32_t decodeLinkNumHit_IBL(const uint32_t word) const
uint32_t decodeL1ID_IBL(const uint32_t word) const
uint32_t decodeBcidTrailer_IBL(const uint32_t word) const
uint32_t decodeServiceCodeCounter_IBL(const uint32_t word) const
uint32_t decodeBCID_IBL(const uint32_t word) const
uint32_t extractSLinkfromLinkNum(const uint32_t linkNum) const
uint32_t decodeLinkNumFEFlag_IBL(const uint32_t word) const
std::atomic_uint m_numTrailerErrors
std::atomic_uint m_numDisabledFEErrors
std::atomic_uint m_numInvalidIdentifiers
std::atomic_uint m_masked_errors
BooleanProperty m_checkDuplicatedPixel
bool checkDataWordsCorruption(uint32_t word) const
checks if data words do not look like header & trailer markers, return true if so,...
uint32_t decodeL1ID(const uint32_t word) const
uint32_t decodeLinkNumTrailer_IBL(const uint32_t word) const
uint32_t decodeBCID(const uint32_t word) const
::StatusCode StatusCode
StatusCode definition for legacy code.
const DataType * PointerType
void addError(IDCInDetBSErrContainer::ErrorCode &errWord, PixelErrorsEnum errType)
row
Appending html table to final .html summary file.