Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
}
Expand Down Expand Up @@ -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
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
};

Expand Down Expand Up @@ -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<uint32_t, NErrorsDefined> ErrActions = {
Expand Down Expand Up @@ -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;
Expand Down
Loading