From 9d404f5e87380044ee53c63a01dd2cee533b8724 Mon Sep 17 00:00:00 2001 From: shahoian Date: Mon, 24 Jun 2024 21:03:56 +0200 Subject: [PATCH] Sort hits addresses before adding to raw stream --- .../ITSMFT/common/reconstruction/src/AlpideCoder.cxx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Detectors/ITSMFT/common/reconstruction/src/AlpideCoder.cxx b/Detectors/ITSMFT/common/reconstruction/src/AlpideCoder.cxx index cfea32eb383a9..33966203ae6af 100644 --- a/Detectors/ITSMFT/common/reconstruction/src/AlpideCoder.cxx +++ b/Detectors/ITSMFT/common/reconstruction/src/AlpideCoder.cxx @@ -76,7 +76,7 @@ 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 hits; int nHits = 0, nData = 0; // int nr = mFirstInRow.size(); @@ -84,9 +84,12 @@ int AlpideCoder::procDoubleCol(PayLoadCont& buffer, short reg, short dcol) 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; @@ -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;