Skip to content

Commit d3d07dd

Browse files
committed
Protect its/mft decoder agains decreasing row in the same column
Discard cable data if this happens. A new error ChipPixelData::DecreasingRow is added.
1 parent 15dcbf6 commit d3d07dd

File tree

2 files changed

+34
-20
lines changed

2 files changed

+34
-20
lines changed

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

Lines changed: 31 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -273,33 +273,44 @@ class AlpideCoder
273273
uint16_t row = pixID >> 1;
274274
// abs id of left column in double column
275275
uint16_t colD = (region * NDColInReg + dColID) << 1; // TODO consider <<4 instead of *NDColInReg?
276-
bool rightC = (row & 0x1) ? !(pixID & 0x1) : (pixID & 0x1); // true for right column / lalse for left
276+
bool rightC = (row & 0x1) ? !(pixID & 0x1) : (pixID & 0x1); // true for right column / false for left
277277

278-
if (row == rowPrev && colD == colDPrev) {
279-
// this is a special test to exclude repeated data of the same pixel fired
278+
if (colD == colDPrev) {
279+
bool skip = false;
280+
if (row == rowPrev) { // this is a special test to exclude repeated data of the same pixel fired
281+
skip = true;
280282
#ifdef ALPIDE_DECODING_STAT
281-
chipData.setError(ChipStat::RepeatingPixel);
282-
chipData.addErrorInfo((uint64_t(colD + rightC) << 16) | uint64_t(row));
283+
chipData.setError(ChipStat::RepeatingPixel);
284+
chipData.addErrorInfo((uint64_t(colD + rightC) << 16) | uint64_t(row));
283285
#endif
284-
if ((dataS & (~MaskDColID)) == DATALONG) { // skip pattern w/o decoding
285-
uint8_t hitsPattern = 0;
286-
if (!buffer.next(hitsPattern)) {
286+
} else if (rowPrev < 0xffff && row < rowPrev) {
287287
#ifdef ALPIDE_DECODING_STAT
288-
chipData.setError(ChipStat::TruncatedLondData);
288+
chipData.setError(ChipStat::DecreasingRow);
289+
chipData.addErrorInfo((uint64_t(colD + rightC) << 16) | uint64_t(row));
289290
#endif
290-
return unexpectedEOF("CHIP_DATA_LONG:Pattern"); // abandon cable data
291-
}
292-
if (hitsPattern & (~MaskHitMap)) {
291+
return unexpectedEOF("DECREASING_ROW"); // abandon cable data
292+
}
293+
if (skip) {
294+
if ((dataS & (~MaskDColID)) == DATALONG) { // skip pattern w/o decoding
295+
uint8_t hitsPattern = 0;
296+
if (!buffer.next(hitsPattern)) {
293297
#ifdef ALPIDE_DECODING_STAT
294-
chipData.setError(ChipStat::WrongDataLongPattern);
298+
chipData.setError(ChipStat::TruncatedLondData);
295299
#endif
296-
return unexpectedEOF("CHIP_DATA_LONG:Pattern"); // abandon cable data
300+
return unexpectedEOF("CHIP_DATA_LONG:Pattern"); // abandon cable data
301+
}
302+
if (hitsPattern & (~MaskHitMap)) {
303+
#ifdef ALPIDE_DECODING_STAT
304+
chipData.setError(ChipStat::WrongDataLongPattern);
305+
#endif
306+
return unexpectedEOF("CHIP_DATA_LONG:Pattern"); // abandon cable data
307+
}
308+
LOGP(debug, "hitsPattern: {:#b} expect {:#b}", int(hitsPattern), int(expectInp));
297309
}
298-
LOGP(debug, "hitsPattern: {:#b} expect {:#b}", int(hitsPattern), int(expectInp));
310+
expectInp = ExpectChipTrailer | ExpectData | ExpectRegion;
311+
continue; // end of DATA(SHORT or LONG) processing
299312
}
300-
expectInp = ExpectChipTrailer | ExpectData | ExpectRegion;
301-
continue; // end of DATA(SHORT or LONG) processing
302-
} else if (colD != colDPrev) {
313+
} else {
303314
// if we start new double column, transfer the hits accumulated in the right column buffer of prev. double column
304315
if (colD < colDPrev && colDPrev != 0xffff) {
305316
#ifdef ALPIDE_DECODING_STAT
@@ -321,7 +332,7 @@ class AlpideCoder
321332
// are first collected in the temporary buffer
322333
// real columnt id is col = colD + 1;
323334
if (rightC) {
324-
rightColHits[nRightCHits++] = row; // col = colD+1
335+
rightColHits[nRightCHits++] = row;
325336
} else {
326337
addHit(chipData, row, colD); // col = colD, left column hits are added directly to the container
327338
}
@@ -355,7 +366,7 @@ class AlpideCoder
355366
if (rightC) { // same as above
356367
rightColHits[nRightCHits++] = rowE;
357368
} else {
358-
addHit(chipData, rowE, colD + rightC); // left column hits are added directly to the container
369+
addHit(chipData, rowE, colD); // left column hits are added directly to the container
359370
}
360371
}
361372
}

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ struct ChipStat {
6868
FlushedIncomplete, // ALPIDE MEB was flushed by the busy handling
6969
StrobeExtended, // ALPIDE received a second trigger while the strobe was still open
7070
WrongAlpideChipID, // Impossible for given cable ALPIDE ChipOnModule ID
71+
DecreasingRow, // Decreasing row in the same column
7172
NErrorsDefined
7273
};
7374

@@ -106,6 +107,7 @@ struct ChipStat {
106107
"FlushedIncomplete", // ALPIDE MEB was flushed by the busy handling
107108
"StrobeExtended", // ALPIDE received a second trigger while the strobe was still open
108109
"Wrong Alpide ChipID", // Impossible for given cable ALPIDE ChipOnModule ID
110+
"Decreasing row", // Decreasing row in the same column
109111
};
110112

111113
static constexpr std::array<uint32_t, NErrorsDefined> ErrActions = {
@@ -143,6 +145,7 @@ struct ChipStat {
143145
ErrActPropagate | ErrActDump, // ALPIDE MEB was flushed by the busy handling
144146
ErrActPropagate | ErrActDump, // ALPIDE received a second trigger while the strobe was still open
145147
ErrActPropagate | ErrActDump, // Impossible for given cable ALPIDE ChipOnModule ID
148+
ErrActPropagate | ErrActDump, // Decreasing row in the same column
146149
};
147150
uint16_t feeID = -1;
148151
size_t nHits = 0;

0 commit comments

Comments
 (0)