diff --git a/Detectors/ITSMFT/common/reconstruction/include/ITSMFTReconstruction/AlpideCoder.h b/Detectors/ITSMFT/common/reconstruction/include/ITSMFTReconstruction/AlpideCoder.h index 321ed52258ff2..b14a6b3f6b62f 100644 --- a/Detectors/ITSMFT/common/reconstruction/include/ITSMFTReconstruction/AlpideCoder.h +++ b/Detectors/ITSMFT/common/reconstruction/include/ITSMFTReconstruction/AlpideCoder.h @@ -273,33 +273,44 @@ class AlpideCoder uint16_t row = pixID >> 1; // abs id of left column in double column uint16_t colD = (region * NDColInReg + dColID) << 1; // TODO consider <<4 instead of *NDColInReg? - bool rightC = (row & 0x1) ? !(pixID & 0x1) : (pixID & 0x1); // true for right column / lalse for left + bool rightC = (row & 0x1) ? !(pixID & 0x1) : (pixID & 0x1); // true for right column / false for left - if (row == rowPrev && colD == colDPrev) { - // this is a special test to exclude repeated data of the same pixel fired + if (colD == colDPrev) { + bool skip = false; + if (row == rowPrev) { // this is a special test to exclude repeated data of the same pixel fired + skip = true; #ifdef ALPIDE_DECODING_STAT - chipData.setError(ChipStat::RepeatingPixel); - chipData.addErrorInfo((uint64_t(colD + rightC) << 16) | uint64_t(row)); + chipData.setError(ChipStat::RepeatingPixel); + chipData.addErrorInfo((uint64_t(colD + rightC) << 16) | uint64_t(row)); #endif - if ((dataS & (~MaskDColID)) == DATALONG) { // skip pattern w/o decoding - uint8_t hitsPattern = 0; - if (!buffer.next(hitsPattern)) { + } else if (rowPrev < 0xffff && row < rowPrev) { #ifdef ALPIDE_DECODING_STAT - chipData.setError(ChipStat::TruncatedLondData); + chipData.setError(ChipStat::DecreasingRow); + chipData.addErrorInfo((uint64_t(colD + rightC) << 16) | uint64_t(row)); #endif - return unexpectedEOF("CHIP_DATA_LONG:Pattern"); // abandon cable data - } - if (hitsPattern & (~MaskHitMap)) { + return unexpectedEOF("DECREASING_ROW"); // abandon cable data + } + if (skip) { + if ((dataS & (~MaskDColID)) == DATALONG) { // skip pattern w/o decoding + uint8_t hitsPattern = 0; + if (!buffer.next(hitsPattern)) { #ifdef ALPIDE_DECODING_STAT - chipData.setError(ChipStat::WrongDataLongPattern); + chipData.setError(ChipStat::TruncatedLondData); #endif - return unexpectedEOF("CHIP_DATA_LONG:Pattern"); // abandon cable data + return unexpectedEOF("CHIP_DATA_LONG:Pattern"); // abandon cable data + } + if (hitsPattern & (~MaskHitMap)) { +#ifdef ALPIDE_DECODING_STAT + chipData.setError(ChipStat::WrongDataLongPattern); +#endif + return unexpectedEOF("CHIP_DATA_LONG:Pattern"); // abandon cable data + } + LOGP(debug, "hitsPattern: {:#b} expect {:#b}", int(hitsPattern), int(expectInp)); } - LOGP(debug, "hitsPattern: {:#b} expect {:#b}", int(hitsPattern), int(expectInp)); + expectInp = ExpectChipTrailer | ExpectData | ExpectRegion; + continue; // end of DATA(SHORT or LONG) processing } - expectInp = ExpectChipTrailer | ExpectData | ExpectRegion; - continue; // end of DATA(SHORT or LONG) processing - } else if (colD != colDPrev) { + } else { // if we start new double column, transfer the hits accumulated in the right column buffer of prev. double column if (colD < colDPrev && colDPrev != 0xffff) { #ifdef ALPIDE_DECODING_STAT @@ -321,7 +332,7 @@ class AlpideCoder // are first collected in the temporary buffer // real columnt id is col = colD + 1; if (rightC) { - rightColHits[nRightCHits++] = row; // col = colD+1 + rightColHits[nRightCHits++] = row; } else { addHit(chipData, row, colD); // col = colD, left column hits are added directly to the container } @@ -355,7 +366,7 @@ class AlpideCoder if (rightC) { // same as above rightColHits[nRightCHits++] = rowE; } else { - addHit(chipData, rowE, colD + rightC); // left column hits are added directly to the container + addHit(chipData, rowE, colD); // left column hits are added directly to the container } } } diff --git a/Detectors/ITSMFT/common/reconstruction/include/ITSMFTReconstruction/DecodingStat.h b/Detectors/ITSMFT/common/reconstruction/include/ITSMFTReconstruction/DecodingStat.h index 705e814fb4904..9a57228ddce1e 100644 --- a/Detectors/ITSMFT/common/reconstruction/include/ITSMFTReconstruction/DecodingStat.h +++ b/Detectors/ITSMFT/common/reconstruction/include/ITSMFTReconstruction/DecodingStat.h @@ -68,6 +68,7 @@ struct ChipStat { FlushedIncomplete, // ALPIDE MEB was flushed by the busy handling StrobeExtended, // ALPIDE received a second trigger while the strobe was still open WrongAlpideChipID, // Impossible for given cable ALPIDE ChipOnModule ID + DecreasingRow, // Decreasing row in the same column NErrorsDefined }; @@ -106,6 +107,7 @@ struct ChipStat { "FlushedIncomplete", // ALPIDE MEB was flushed by the busy handling "StrobeExtended", // ALPIDE received a second trigger while the strobe was still open "Wrong Alpide ChipID", // Impossible for given cable ALPIDE ChipOnModule ID + "Decreasing row", // Decreasing row in the same column }; static constexpr std::array ErrActions = { @@ -143,6 +145,7 @@ struct ChipStat { ErrActPropagate | ErrActDump, // ALPIDE MEB was flushed by the busy handling ErrActPropagate | ErrActDump, // ALPIDE received a second trigger while the strobe was still open ErrActPropagate | ErrActDump, // Impossible for given cable ALPIDE ChipOnModule ID + ErrActPropagate | ErrActDump, // Decreasing row in the same column }; uint16_t feeID = -1; size_t nHits = 0;