Skip to content

Commit 0e2cfe4

Browse files
committed
Protect its/mft decoder agains looping hits set
1 parent 348b194 commit 0e2cfe4

File tree

1 file changed

+19
-3
lines changed
  • Detectors/ITSMFT/common/reconstruction/include/ITSMFTReconstruction

1 file changed

+19
-3
lines changed

Detectors/ITSMFT/common/reconstruction/include/ITSMFTReconstruction/AlpideCoder.h

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,15 @@ class AlpideCoder
321321
// are first collected in the temporary buffer
322322
// real columnt id is col = colD + 1;
323323
if (rightC) {
324-
rightColHits[nRightCHits++] = row; // col = colD+1
324+
if (nRightCHits < NRows - 1) {
325+
rightColHits[nRightCHits++] = row;
326+
} else {
327+
#ifdef ALPIDE_DECODING_STAT
328+
chipData.setError(ChipStat::RepeatingPixel);
329+
chipData.addErrorInfo((uint64_t(colD + 1) << 16) | uint64_t(row));
330+
#endif
331+
return unexpectedEOF("ROW_OVERFLOW"); // abandon cable data
332+
}
325333
} else {
326334
addHit(chipData, row, colD); // col = colD, left column hits are added directly to the container
327335
}
@@ -353,9 +361,17 @@ class AlpideCoder
353361
rightC = ((rowE & 0x1) ? !(addr & 0x1) : (addr & 0x1)); // true for right column / lalse for left
354362
// the real columnt is int colE = colD + rightC;
355363
if (rightC) { // same as above
356-
rightColHits[nRightCHits++] = rowE;
364+
if (nRightCHits < NRows - 1) {
365+
rightColHits[nRightCHits++] = rowE;
366+
} else {
367+
#ifdef ALPIDE_DECODING_STAT
368+
chipData.setError(ChipStat::RepeatingPixel);
369+
chipData.addErrorInfo((uint64_t(colD + 1) << 16) | uint64_t(rowE));
370+
#endif
371+
return unexpectedEOF("ROW_OVERFLOW"); // abandon cable data
372+
}
357373
} else {
358-
addHit(chipData, rowE, colD + rightC); // left column hits are added directly to the container
374+
addHit(chipData, rowE, colD); // left column hits are added directly to the container
359375
}
360376
}
361377
}

0 commit comments

Comments
 (0)