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
159
160 std::array<uint64_t, PixelRodDecoder::ERROR_CONTAINER_MAX> bsErrWord{};
161
162 if (robFrag->nstatus()!=0) {
164 robFrag->status(rob_status);
165
167 ATH_MSG_DEBUG(
"ROB status word for robid 0x"<< std::hex << robId <<
" is non-zero 0x" << (*rob_status) << std::dec);
168
169
170
171
172 if ((*rob_status) & (0x1u << 27)) {
174 return StatusCode::RECOVERABLE;
175 }
176 if ((*rob_status) & (0x1u << 31)) {
178 return StatusCode::RECOVERABLE;
179 }
180
181
182
183 if (robFrag->rod_ndata() > robFrag->payload_size_word() && !robFrag->check_rod_noex(robFrag->rod_version() >> 16)) {
185 " invalid ROD fragment, invalid payload size");
186 return StatusCode::RECOVERABLE;
187 }
188 }
189 }
191
192
193 unsigned int mBCID = 0x3FFF;
194 unsigned int mLVL1ID = 0x3FFF;
195 unsigned int mLink = 0x3FFF;
196 int mLVL1A = 0x3FFF;
197 int offsetBCID_ROB_FE = 0x3FFF;
198
204
205 bool link_start = false;
206 IdentifierHash offlineIdHash;
207 IdentifierHash previous_offlineIdHash;
208 int mBCID_offset = -1;
209 unsigned int mBCID_max_pix = 0x100;
210 unsigned int mBCID_max_IBL = 0x400;
211 bool receivedCondensedWords = false;
212 int countHitCondensedWords = 0;
214 bool are_4condensed_words = false;
215 unsigned int prevBCID = 0x3FFF;
216 unsigned int prevLVL1ID = 0x3FFF;
218 int prevOffsetBCID_ROB_FE = 0x3FFF;
219 unsigned int prevStartingBCID = 0x3FFF;
220 unsigned int nFragmentsPerFE[8] = {0};
221 IdentifierHash skipHash = 0xffffffff, lastHash = 0xffffffff;
223
225 robFrag->rod_data(vint);
226 int hitDiscCnfg = 3;
227
228 eformat::helper::SourceIdentifier sid_rob(robId);
229 sLinkSourceId = (sid_rob.module_id()) & 0x000F;
230 if (
isIBL( robId ) && sLinkSourceId>0x3) {
231 generalwarning(
"In ROB 0x" << std::hex << robId <<
": IBL/DBM SLink number not in correct range (0-3): SLink = " << std::dec << sLinkSourceId);
232 }
233
234 bool corruptionError = false;
235
236 std::unordered_set<Identifier> foundPixels;
237
238
239 const int nwords = robFrag->rod_ndata();
240 for (int dataword_it = 0; dataword_it < nwords; ++dataword_it) {
241 const uint32_t rawDataWord = vint[dataword_it];
244
245 serviceCodeCounter = 0;
246 serviceCode = 0;
247
248 int indexModule = -1;
249 int indexFE = -1;
250
251 if (offlineIdHash!=0xffffffff) {
252 isIBLModule = false;
253 isDBMModule = false;
255 isIBLModule =
isIBL(robId);
256 isDBMModule =
isDBM(robId);
257 }
258
259 int chFE = 0;
260 if (isIBLModule || isDBMModule) {
264 }
265 else {
267 }
268 indexModule = static_cast<int>(offlineIdHash);
269 indexFE = (1+chFE)*
m_pixel_id->wafer_hash_max()+
static_cast<int>(offlineIdHash);
270 }
271
272
273 bool headerErr_decoding = false;
274 bool headerErr_flagged = false;
275 bool headerErr_preamble = false;
276 bool headerErr_timeout = false;
277 bool headerErr_lvl1id = false;
278 bool headerErr_bcid = false;
279 switch (word_type) {
280
282
284 errorRecoverable = 0;
285
286 if (link_start) {
287 generalwarning(
"In ROB 0x" << std::hex << robId <<
": Unexpected link header found: 0x" << std::hex << rawDataWord <<
", data corruption" << std::dec);
289 headerErr_decoding = true;
290 }
291 else {
293 }
294 link_start = true;
295 are_4condensed_words = false;
296 receivedCondensedWords = false;
297 isIBLModule = false;
298 isDBMModule = false;
299 countHitCondensedWords = 0;
301 isIBLModule =
isIBL(robId);
302 isDBMModule =
isDBM(robId);
303 }
304
305 prevLVL1ID = mLVL1ID;
306 prevBCID = mBCID;
307 prevLinkNum = mLink;
308 prevOffsetBCID_ROB_FE = offsetBCID_ROB_FE;
309
310 if (isIBLModule || isDBMModule) {
311#ifdef PIXEL_DEBUG
312 ATH_MSG_VERBOSE(
"Decoding the IBL/DBM header word: 0x" << std::hex << rawDataWord << std::dec );
313#endif
314
315
321 headerErr_flagged = true;
322 }
324 mLink = fe_IBLheader;
326 if (sLinkHeader != sLinkSourceId) {
327 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);
328 }
329
330 if (mLink == prevLinkNum) {
331
332 if (mLVL1ID != prevLVL1ID && prevLVL1ID != 0x3FFF) {
333 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);
334 }
335
336 if ((mBCID != prevBCID + 1) && prevBCID != 0x3FFF && prevBCID != mBCID_max_IBL) {
337 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);
338 }
339 }
340 else {
341 offsetBCID_ROB_FE = static_cast<int>(mBCID) - robBCID;
342 if (offsetBCID_ROB_FE != prevOffsetBCID_ROB_FE && (offsetBCID_ROB_FE != 0x3FFF && prevOffsetBCID_ROB_FE != 0x3FFF)) {
343 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)");
344 }
345
346 if (mBCID != prevStartingBCID && prevStartingBCID != 0x3FFF) {
347 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);
348 }
349 prevStartingBCID = mBCID;
350 }
351
352 if (mLink < 0x8) { ++nFragmentsPerFE[mLink]; }
353 }
354 else {
355 ATH_MSG_VERBOSE(
"Decoding Pixel header word: 0x" << std::hex << rawDataWord << std::dec );
360 if ( headerError != 0 ) {
361 sc = StatusCode::RECOVERABLE;
362 errorRecoverable = errorRecoverable | (headerError << 20);
363
364 {
365 if (headerError & (1 << 3)) {
367 headerErr_preamble = true;
368 }
369 if (headerError & (1 << 2)) {
371 headerErr_timeout = true;
372 }
373 if (headerError & (1 << 1)) {
375 headerErr_lvl1id = true;
376 }
377 if (headerError & (1 << 0)) {
379 headerErr_bcid = true;
380 }
381 }
382
383 }
384 }
385
386 onlineId = pixCabling->getOnlineIdFromRobId(robId, mLink);
387 if (onlineId == 0) {
388 generalwarning(
"In ROB 0x" << std::hex << robId <<
", FE: 0x" << mLink <<
": Got invalid onlineId (= 0) in FE header - dataword = 0x" << rawDataWord);
389 }
390
391#ifdef PIXEL_DEBUG
392 ATH_MSG_VERBOSE(
"In decoder: got onlineId 0x" << std::hex << onlineId );
393#endif
394
395 offlineIdHash =
m_pixel_id->wafer_hash(pixCabling->find_entry_onoff(onlineId));
396 if (offlineIdHash != previous_offlineIdHash) {
397 mBCID_offset = mBCID;
398
399
400 bsErrWord[static_cast<int>(offlineIdHash)+52736] = 1;
401 }
402 mLVL1A = mBCID - mBCID_offset;
403 if (mLVL1A < 0) {
404 if (isIBLModule || isDBMModule) { mLVL1A=mLVL1A+mBCID_max_IBL; }
405 else { mLVL1A=mLVL1A+mBCID_max_pix; }
406 }
407
408
409 if (isIBLModule || isDBMModule) {
410 if (indexFE>-1) {
417 }
418 }
419 else {
420
427 }
428
429
430#ifdef PIXEL_DEBUG
431 ATH_MSG_VERBOSE(
"link header with BCID: " << mBCID <<
" LVL1ID: " << mLVL1ID <<
" LVL1A: " << mLVL1A <<
" link: " << mLink <<
" found");
432 ATH_MSG_VERBOSE(
"got OfflineIDHash: 0x" << std::hex << offlineIdHash <<
" from OnlineID: 0x" << onlineId << std::dec <<
" link: " << mLink);
433#endif
434
435 if (offlineIdHash == 0xffffffff) {
436 generalwarning(
"In ROB 0x" << std::hex << robId <<
", FE: 0x" << mLink <<
": Unknown OnlineId identifier in FE header - not found by mapping" << std::dec);
438 link_start = false;
439 continue;
440 }
441 break;
442
444 if (link_start) {
446 unsigned int mFE = 0;
447 unsigned int mRow = 0;
448 unsigned int mColumn = 0;
449 int mToT = 0;
452 if (isIBLModule || isDBMModule) {
453
454#ifdef PIXEL_DEBUG
455 ATH_MSG_DEBUG (
"Decoding IBL/DBM hit word: 0x" << std::hex << rawDataWord << std::dec);
456#endif
457
459 countHitCondensedWords = 1;
460 are_4condensed_words = false;
461 condensedWords[0] = rawDataWord;
462 continue;
463 }
464 else if (countHitCondensedWords == 1) {
465 ++countHitCondensedWords;
466 condensedWords[1] = rawDataWord;
467 continue;
468 }
469 else if (countHitCondensedWords == 2) {
470 ++countHitCondensedWords;
471 condensedWords[2] = rawDataWord;
472 continue;
473 }
475 are_4condensed_words = true;
476 receivedCondensedWords = true;
477 condensedWords[3] = rawDataWord;
479
480
481
482
483
484
485
486 hitwords[0] = (condensedWords[0] &
mask24);
487
489
491
493
494 hitwords[4] = (condensedWords[3] >>
skip5) &
mask24;
495
496#ifdef PIXEL_DEBUG
497 ATH_MSG_VERBOSE(
"4 consecutive IBL hit words found. Condensed hits are being decoded");
498#endif
499
500 for (
unsigned int i(0);
i <
nHits; ++
i) {
504 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);
505 }
506 countHitCondensedWords = 0;
507 linkNum_IBLword = linkNum_IBLheader;
508 }
510 if (countHitCondensedWords != 0) {
511 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 <<
")");
515 countHitCondensedWords = 0;
516 }
517
518 are_4condensed_words = false;
519 mRow =
decodeRow(rawDataWord, isIBLModule || isDBMModule );
520 mColumn =
decodeColumn(rawDataWord, isIBLModule || isDBMModule);
521 mToT =
decodeToT(rawDataWord, isIBLModule || isDBMModule);
523
524 if (linkNum_IBLword != linkNum_IBLheader) {
525 generalwarning(
"In ROB 0x" << std::hex << robId <<
": Link number mismatch - nnnnn (hit word) = 0x" << linkNum_IBLword <<
", nnnnn (header) = 0x" << linkNum_IBLheader << std::dec);
526 }
527
528#ifdef PIXEL_DEBUG
529 ATH_MSG_DEBUG(
"hit dataword found for module offlineIDHash: " << offlineIdHash <<
" Row: 0x" << std::hex << mRow <<
" Col: 0x" << mColumn <<
" Tot: 0x" << mToT << std::dec);
530#endif
531
532 }
533 else {
534 generalwarning(
"In ROB 0x" << std::hex << robId <<
", FE: 0x" << mLink <<
": IBL/DBM hit word 0x" << rawDataWord <<
" not recognised" << std::dec);
537 continue;
538 }
539
540
543 mFE = 0;
544 }
545
546 }
547 else {
548
549#ifdef PIXEL_DEBUG
550 ATH_MSG_VERBOSE(
"Decoding Pixel hit word: 0x" << std::hex << rawDataWord << std::dec);
551#endif
552
553 if (countHitCondensedWords != 0){
554 generalwarning(
"In ROB 0x" << std::hex << robId <<
", link 0x" << mLink
555 << ": Interruption of IBL condensed words - hit(s) ignored (current dataword: 0x"
556 << std::hex << rawDataWord << std::dec << ")");
560 countHitCondensedWords = 0;
561 }
562
563 are_4condensed_words = false;
565 mRow =
decodeRow(rawDataWord, isIBLModule || isDBMModule );
566 mColumn =
decodeColumn(rawDataWord, isIBLModule || isDBMModule);
567 mToT =
decodeToT(rawDataWord, isIBLModule || isDBMModule);
568
569#ifdef PIXEL_DEBUG
570 ATH_MSG_DEBUG(
"hit dataword found for module offlineIDHash: " << offlineIdHash <<
" FE: " << mFE <<
" Row: " << mRow <<
" Col: " << mColumn );
571#endif
572
573 }
574
575
576
577
578
579 if (offlineIdHash == skipHash) continue;
580 if (offlineIdHash != lastHash) {
581 lastHash = offlineIdHash;
582 if (vecHash!=nullptr) {
583 std::vector<IdentifierHash>::iterator
p = std::find(vecHash->begin(),vecHash->end(),offlineIdHash);
584 if (p == vecHash->end()) {
585 skipHash = offlineIdHash;
586 continue;
587 }
588 }
590 if( coll == nullptr ) {
592
594
595 coll->setIdentifier(ident);
596
600 ATH_MSG_ERROR(
"failed to add Pixel RDO collection to container" );
601 }
602 }
603 }
604
605
606 if (isIBLModule || isDBMModule) {
607 unsigned int num_cycles_toFillCollection(0);
608 if (are_4condensed_words) {
609 num_cycles_toFillCollection =
nHits;
610 }
611 else {
612 num_cycles_toFillCollection = 1;
614 col[0] = mColumn;
616 }
617 int IBLtot[2];
618 for (
unsigned int i(0);
i < num_cycles_toFillCollection; ++
i) {
619
620#ifdef PIXEL_DEBUG
621 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 );
622#endif
623
624
625 if ((tot[i] & 0xF0) == 0x00) {
626 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);
627 continue;
628 }
629 else {
630 if (((row[i] != 0) && (col[i] != 0) && (row[i] <= 336) && (col[i] <= 80)) || isDBMModule) {
631 pixelId =
m_pixelReadout ->getPixelIdfromHash (offlineIdHash, mFE, row[i], col[i]);
632
633#ifdef PIXEL_DEBUG
639 ATH_MSG_VERBOSE(
" eta_i: " << eta_i <<
", phi_i: " << phi_i <<
", eta_m: " << eta_m <<
", phi_m: " << phi_m );
640#endif
641 if (pixelId == invalidPixelId) {
642 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);
645 continue;
646 }
649#ifdef PIXEL_DEBUG
650 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 );
651#endif
652
653 if (!pixHitDiscCnfg) {
654 pixHitDiscCnfg = std::make_unique<SG::ReadCondHandle<PixelHitDiscCnfgData> > (
m_condHitDiscCnfgKey,ctx);
655 }
656
658 hitDiscCnfg = (*pixHitDiscCnfg)->getHitDiscCnfgPL();
659 }
661 hitDiscCnfg = (*pixHitDiscCnfg)->getHitDiscCnfg3D();
662 }
663
664 if (hitDiscCnfg == 2 && IBLtot[0] == 2) IBLtot[0] = 16;
665 if (hitDiscCnfg == 2 && IBLtot[1] == 2) IBLtot[1] = 16;
667
668 if (coll) coll->push_back(
new RDO(pixelId, IBLtot[0], mBCID, mLVL1ID, mLVL1A));
669 }
670 else {
672 }
673
674#ifdef PIXEL_DEBUG
675 ATH_MSG_VERBOSE(
"Collection filled with pixelId: " << pixelId <<
" TOT = 0x" << std::hex << IBLtot[0] << std::dec <<
" mBCID = " << mBCID <<
" mLVL1ID = " << mLVL1ID <<
" mLVL1A = " << mLVL1A );
676#endif
677
678
679
680
681 if (IBLtot[1] != 0x0 && (IBLtot[1] != 0xF || hitDiscCnfg != 3)) {
682 if ((row[i] + 1) > 336) {
683
684 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] <<
")");
687 continue;
688 }
689 else {
690 pixelId =
m_pixelReadout->getPixelIdfromHash (offlineIdHash, mFE, row[i] + 1, col[i]);
691
692#ifdef PIXEL_DEBUG
697 int phi_i_max =
m_pixel_id->phi_index_max(pixelId);
698 int eta_i_max =
m_pixel_id->eta_index_max(pixelId);
700 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 );
701#endif
702
703 if (pixelId == invalidPixelId) {
704 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);
707 continue;
708 }
710 coll->push_back(
new RDO(pixelId, IBLtot[1], mBCID, mLVL1ID, mLVL1A));
711 }
712 else {
714 }
715
716#ifdef PIXEL_DEBUG
717 ATH_MSG_VERBOSE(
"Collection filled with pixelId: " << pixelId <<
" TOT = 0x" << std::hex << IBLtot[1] << std::dec <<
" mBCID = " << mBCID <<
" mLVL1ID = " << mLVL1ID <<
" mLVL1A = " << mLVL1A );
718#endif
719
720 }
721 }
722 }
723 else {
724 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) <<
")");
727 continue;
728 }
729 }
730 }
731 }
732
733 else {
734 pixelId =
m_pixelReadout->getPixelIdfromHash(offlineIdHash, mFE, mRow, mColumn);
735 if (pixelId == invalidPixelId) {
736 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);
740 continue;
741 }
742
744 coll->push_back(
new RDO(pixelId, mToT, mBCID, mLVL1ID, mLVL1A));
745 }
746 else {
748 }
749
750#ifdef PIXEL_DEBUG
751 ATH_MSG_VERBOSE(
"Collection filled with pixelId: " << pixelId <<
" TOT = 0x" << std::hex << mToT << std::dec <<
" mBCID = " << mBCID <<
" mLVL1ID = " << mLVL1ID <<
" mLVL1A = " << mLVL1A );
752#endif
753
754 }
755 }
756 else {
757 generalwarning(
"In ROB = 0x" << std::hex << robId <<
", link 0x" << mLink <<
": Unexpected hit dataword: " << rawDataWord <<
" - hit ignored");
761 continue;
762 }
763 break;
764
766 if (link_start) {
768 }
769 else {
770 generalwarning(
"In ROB = 0x" << std::hex << robId <<
", link 0x" << mLink <<
": Unexpected trailer found: 0x" << std::hex << rawDataWord <<
", data corruption");
774 continue;
775 }
776 previous_offlineIdHash = offlineIdHash;
777 link_start = false;
778 are_4condensed_words = false;
779
780 if (isIBLModule || isDBMModule) {
781 ATH_MSG_VERBOSE(
"Decoding IBL/DBM trailer word: 0x" << std::hex << rawDataWord << std::dec );
783
784 if (trailerError & (1 << 8)) {
787 }
788
789 if (trailerError & (1 << 6)) {
792 }
793 if (trailerError & (1 << 5)) {
796 }
797 if (trailerError & (1 << 4)) {
800 }
801 if (trailerError & (1 << 3)) {
804 }
805 if (trailerError & (1 << 2)) {
808 }
809 if (trailerError & (1 << 1)) {
812 }
813 if (trailerError & (1 << 0)) {
816 }
817
818 if (trailerError & (1 << 7)) {
819 if (!receivedCondensedWords) {
generalwarning(
"In ROB 0x" << std::hex << robId <<
", link 0x" << mLink <<
": condensed mode bit is set, but no condensed words received" << std::dec); }
820 }
821
823
824 if (linkNum_IBLword != linkNum_IBLheader) {
825 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);
826 }
829 }
830 }
831 else {
832 ATH_MSG_VERBOSE(
"Decoding Pixel trailer word: 0x" << std::hex << rawDataWord << std::dec );
834 if (trailerError != 0) {
835 sc = StatusCode ::RECOVERABLE;
836 errorRecoverable = errorRecoverable | trailerError;
837
838 const std::array<unsigned long long, 4> bitPosition{0_BIT, 1_BIT, 2_BIT, 3_BIT};
839 for (const auto bit:bitPosition){
841 }
842
843 if ( trailerError & 0xF ) {
846 }
847
848
849 if (trailerError != 0) {
850 if (indexModule>-1) {
854 }
855 if (indexFE>-1) {
859 }
860 }
861
862 }
863 }
864 break;
865
867
868 are_4condensed_words = false;
869 if (isIBLModule || isDBMModule) {
870 ATH_MSG_VERBOSE(
"Decoding IBL/DBM FEflag word: 0x" << std::hex << rawDataWord << std::dec);
872 if (linkNum_IBLword != linkNum_IBLheader) {
873 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);
874 }
877
878 if (serviceCode>31) {
879 generalwarning(
"In ROB 0x" << std::hex << robId <<
", link 0x" << mLink <<
": Got out-of-bounds service code: " << std::dec << serviceCode <<
" (counter: " << serviceCodeCounter <<
"), ignored");
880 }
881
884
885 if (serviceCodeCounter>0 && serviceCode<32) {
886 if (serviceCode!=14) {
887
888 if (static_cast<int>(offlineIdHash)>155 && static_cast<int>(offlineIdHash)<436) {
889
890 int indexOffset = 17*
m_pixel_id->wafer_hash_max();
891 int indexSvcCounter = indexOffset+serviceCode*280*2+2*(static_cast<int>(offlineIdHash)-156)+chFE;
892
893 bsErrWord[indexSvcCounter] = serviceCodeCounter;
894 }
895 }
896 }
897
898 }
899 else {
900 ATH_MSG_VERBOSE(
"Decoding Pixel FEflag word: 0x" << std::hex << rawDataWord << std::dec );
903 FEFlags = FEFlags & 0xff;
904 if ((MCCFlags | FEFlags) != 0) {
905 sc = StatusCode::RECOVERABLE;
906 errorRecoverable = errorRecoverable | (MCCFlags << 12) | (FEFlags << 4);
907
908 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};
909 for (const auto thisBit:bitPosition){
912 }
913
914 if ( MCCFlags & 0xff or FEFlags & 0xf3 ) {
917 }
918
919 if (indexModule>-1) {
928
934 }
935
936 if (indexFE>-1) {
945
951 }
952 }
953 else {
956 ATH_MSG_DEBUG(
"Disabled Pixel chip " << ((rawDataWord & 0x0F000000) >> 24) );
957 }
958 }
959
960 break;
961
962
964
965 are_4condensed_words = false;
966
967 break;
968
969
970 default:
971 generalwarning(
"In ROB 0x" << std::hex << robId <<
", FE 0x" << mLink <<
": Unknown word type found, 0x" << std::hex << rawDataWord << std::dec <<
", ignoring");
975
976 }
977 }
978
980
981
982 if (isIBLModule || isDBMModule) {
984 }
985
986
987 for (
size_t i=0; i<static_cast<size_t>(bsErrWord.size());
i++) {
988 if (bsErrWord[i]>0) {
989 decodingErrors.
setOrDrop(i,bsErrWord[i]);
990 }
991 }
992
993 if (
sc == StatusCode::RECOVERABLE) {
994
995 if (errorRecoverable == (3 << 20) ){
997 return StatusCode::SUCCESS;
998 }
999 ATH_MSG_DEBUG(
"Recoverable errors found in PixelRodDecoder, errorcode: " << errorRecoverable );
1000 }
1002}
#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.