Skip to content

Commit aed1af5

Browse files
committed
Set ITS/MFT global chip ID during decoding
1 parent 762aa3a commit aed1af5

3 files changed

Lines changed: 16 additions & 20 deletions

File tree

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,8 @@ class AlpideCoder
118118
static void setNoiseThreshold(int t) { mNoiseThreshold = t; }
119119

120120
/// decode alpide data for the next non-empty chip from the buffer
121-
template <class T>
122-
static int decodeChip(ChipPixelData& chipData, T& buffer)
121+
template <class T, typename CG>
122+
static int decodeChip(ChipPixelData& chipData, T& buffer, CG cidGetter)
123123
{
124124
// read record for single non-empty chip, updating on change module and cycle.
125125
// return number of records filled (>0), EOFFlag or Error
@@ -141,7 +141,7 @@ class AlpideCoder
141141
uint8_t dataCM = dataC & (~MaskChipID);
142142
//
143143
if ((expectInp & ExpectChipEmpty) && dataCM == CHIPEMPTY) { // empty chip was expected
144-
//chipData.setChipID(dataC & MaskChipID); // here we set the chip ID within the module // now set upstream
144+
chipData.setChipID(cidGetter(dataC & MaskChipID)); // here we set the global chip ID
145145
if (!buffer.next(timestamp)) {
146146
#ifdef ALPIDE_DECODING_STAT
147147
chipData.setError(ChipStat::TruncatedChipEmpty);
@@ -153,7 +153,7 @@ class AlpideCoder
153153
}
154154

155155
if ((expectInp & ExpectChipHeader) && dataCM == CHIPHEADER) { // chip header was expected
156-
//chipData.setChipID(dataC & MaskChipID); // here we set the chip ID within the module // now set upstream
156+
chipData.setChipID(cidGetter(dataC & MaskChipID)); // here we set the global chip ID
157157
if (!buffer.next(timestamp)) {
158158
#ifdef ALPIDE_DECODING_STAT
159159
chipData.setError(ChipStat::TruncatedChipHeader);

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

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -73,26 +73,18 @@ int RUDecodeData::decodeROF(const Mapping& mp)
7373
if (!cableData[icab].getSize()) {
7474
continue;
7575
}
76-
int cid = AlpideCoder::getChipID(cableData[icab]);
77-
if (cid < 0) {
78-
continue;
79-
}
80-
chipData->setChipID(mp.getGlobalChipID(cid, cableHWID[icab], *ruInfo));
81-
while (AlpideCoder::decodeChip(*chipData, cableData[icab]) || chipData->isErrorSet()) { // we register only chips with hits or errors flags set
82-
// convert HW chip id within the module to absolute chip id
83-
//chipData->setChipID(mp.getGlobalChipID(chipData->getChipID(), cableHWID[icab], *ruInfo));
76+
auto cabHW = cableHWID[icab];
77+
auto chIdGetter = [this, &mp, cabHW](int cid) {
78+
return mp.getGlobalChipID(cid, cabHW, *this->ruInfo);
79+
};
80+
while (AlpideCoder::decodeChip(*chipData, cableData[icab], chIdGetter) || chipData->isErrorSet()) { // we register only chips with hits or errors flags set
8481
setROFInfo(chipData, cableLinkPtr[icab]);
8582
ntot += chipData->getData().size();
8683
#ifdef ALPIDE_DECODING_STAT
8784
fillChipStatistics(icab, chipData);
8885
#endif
8986
if (++nChipsFired < chipsData.size()) { // fetch next free chip
9087
chipData = &chipsData[nChipsFired];
91-
cid = AlpideCoder::getChipID(cableData[icab]);
92-
if (cid < 0) {
93-
continue;
94-
}
95-
chipData->setChipID(mp.getGlobalChipID(cid, cableHWID[icab], *ruInfo));
9688
} else {
9789
break; // last chip decoded
9890
}

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

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1256,8 +1256,12 @@ class RawPixelReader : public PixelReader
12561256
RDHUtils::printRDH(reinterpret_cast<const o2::header::RAWDataHeader*>(getGBTLink(decData.links[decData.cableLinkID[icab]])->lastRDH));
12571257
}
12581258
#endif
1259-
1260-
while ((res = mCoder.decodeChip(*chipData, cableData))) { // we register only chips with hits or errors flags set
1259+
auto cabHW = decData.cableHWID[icab];
1260+
auto ri = decData.ruInfo;
1261+
auto chIdGetter = [this, cabHW, ri](int cid) {
1262+
return this->mMAP.getGlobalChipID(cid, cabHW, *ri);
1263+
};
1264+
while ((res = mCoder.decodeChip(*chipData, cableData, chIdGetter))) { // we register only chips with hits or errors flags set
12611265
if (res > 0) {
12621266
#ifdef _RAW_READER_ERROR_CHECKS_
12631267
// for the IB staves check if the cable ID is the same as the chip ID on the module
@@ -1271,7 +1275,7 @@ class RawPixelReader : public PixelReader
12711275
}
12721276
#endif
12731277
// convert HW chip id within the module to absolute chip id
1274-
chipData->setChipID(mMAP.getGlobalChipID(chipData->getChipID(), decData.cableHWID[icab], *decData.ruInfo));
1278+
// chipData->setChipID(mMAP.getGlobalChipID(chipData->getChipID(), decData.cableHWID[icab], *decData.ruInfo));
12751279
chipData->setInteractionRecord(mInteractionRecord);
12761280
chipData->setTrigger(mTrigger);
12771281
mDecodingStat.nNonEmptyChips++;

0 commit comments

Comments
 (0)