Skip to content

Commit

Permalink
Sort hits addresses before adding to raw stream
Browse files Browse the repository at this point in the history
  • Loading branch information
shahor02 committed Jun 25, 2024
1 parent a611544 commit 9d404f5
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions Detectors/ITSMFT/common/reconstruction/src/AlpideCoder.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -76,17 +76,20 @@ int AlpideCoder::encodeChip(PayLoadCont& buffer, const o2::itsmft::ChipPixelData
int AlpideCoder::procDoubleCol(PayLoadCont& buffer, short reg, short dcol)
{
// process double column: encoding
short hits[2 * NRows];
std::array<short, 2 * NRows> hits;
int nHits = 0, nData = 0;
//
int nr = mFirstInRow.size();
short col0 = ((reg * NDColInReg + dcol) << 1), col1 = col0 + 1; // 1st,2nd column of double column
int prevRow = -1;
for (int ir = 0; ir < nr; ir++) {
int linkID = mFirstInRow[ir];
if (linkID == -1 || mPix2Encode[linkID].col > col1) { // no pixels left on this row or higher column IDs
if (linkID == -1) { // no pixels left on this row
continue;
}
if (mPix2Encode[linkID].col > col1) { // all following hits will have higher columns
break;
}
short rowID = mPix2Encode[linkID].row;
// process fired pixels
bool left = 0, right = 0;
Expand Down Expand Up @@ -122,6 +125,9 @@ int AlpideCoder::procDoubleCol(PayLoadCont& buffer, short reg, short dcol)
}
//
int ih = 0;
if (nHits > 1) {
std::sort(hits.begin(), hits.begin() + nHits);
}
while ((ih < nHits)) {
short addrE, addrW = hits[ih++]; // address of the reference hit
uint8_t mask = 0;
Expand Down

0 comments on commit 9d404f5

Please sign in to comment.