Skip to content

Commit af60a67

Browse files
committed
Account EmptyChips in active chips status
1 parent f7351c9 commit af60a67

File tree

5 files changed

+22
-19
lines changed

5 files changed

+22
-19
lines changed

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ class AlpideCoder
122122

123123
/// decode alpide data for the next non-empty chip from the buffer
124124
template <class T, typename CG>
125-
static int decodeChip(ChipPixelData& chipData, T& buffer, CG cidGetter)
125+
static int decodeChip(ChipPixelData& chipData, T& buffer, std::vector<uint16_t>& seenChips, CG cidGetter)
126126
{
127127
// read record for single non-empty chip, updating on change module and cycle.
128128
// return number of records filled (>0), EOFFlag or Error
@@ -198,6 +198,7 @@ class AlpideCoder
198198
#endif
199199
return unexpectedEOF("CHIP_EMPTY:Timestamp"); // abandon cable data
200200
}
201+
seenChips.push_back(chipIDGlo);
201202
chipData.resetChipID();
202203
expectInp = ExpectChipHeader | ExpectChipEmpty;
203204
continue;
@@ -438,6 +439,9 @@ class AlpideCoder
438439
prevPix = currPix++;
439440
}
440441
}
442+
if (chipData.getData().size()) {
443+
seenChips.push_back(chipData.getChipID());
444+
}
441445
return chipData.getData().size();
442446
}
443447

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ struct RUDecodeData {
3636

3737
std::array<PayLoadCont, MaxCablesPerRU> cableData{}; // cable data in compressed ALPIDE format
3838
std::vector<o2::itsmft::ChipPixelData> chipsData{}; // fully decoded data in 1st nChipsFired chips
39+
std::vector<uint16_t> seenChipIDs{}; // IDs of all chips seen during ROF decoding, including empty ones
3940
std::array<int, MaxLinksPerRU> links{}; // link entry RSTODO: consider removing this and using pointer
4041
std::array<uint8_t, MaxCablesPerRU> cableHWID{}; // HW ID of cable whose data is in the corresponding slot of cableData
4142
std::array<uint8_t, MaxCablesPerRU> cableLinkID{}; // ID of the GBT link transmitting this cable data
@@ -79,6 +80,7 @@ int RUDecodeData::decodeROF(const Mapping& mp, const o2::InteractionRecord ir)
7980

8081
std::array<bool, Mapping::getNChips()> doneChips{};
8182
auto* chipData = &chipsData[0];
83+
seenChipIDs.clear();
8284
for (int icab = 0; icab < ruInfo->nCables; icab++) { // cableData is ordered in such a way to have chipIDs in increasing order
8385
if (!cableData[icab].getSize()) {
8486
continue;
@@ -95,7 +97,7 @@ int RUDecodeData::decodeROF(const Mapping& mp, const o2::InteractionRecord ir)
9597
int ret = 0;
9698
// dumpcabledata(icab);
9799

98-
while ((ret = AlpideCoder::decodeChip(*chipData, cableData[icab], chIdGetter)) || chipData->isErrorSet()) { // we register only chips with hits or errors flags set
100+
while ((ret = AlpideCoder::decodeChip(*chipData, cableData[icab], seenChipIDs, chIdGetter)) || chipData->isErrorSet()) { // we register only chips with hits or errors flags set
99101
setROFInfo(chipData, cableLinkPtr[icab]);
100102
auto nhits = chipData->getData().size();
101103
if (nhits && doneChips[chipData->getChipID()]) {

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

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ class RawPixelDecoder final : public PixelReader
6060
void collectROFCableData(int iru);
6161
int decodeNextTrigger() final;
6262

63-
template <class DigitContainer, class ROFContainer, class STATVEC>
64-
int fillDecodedDigits(DigitContainer& digits, ROFContainer& rofs, STATVEC& chipStatus);
63+
template <class DigitContainer, class ROFContainer>
64+
int fillDecodedDigits(DigitContainer& digits, ROFContainer& rofs);
6565

6666
template <class STATVEC>
6767
void fillChipsStatus(STATVEC& chipStatus);
@@ -128,6 +128,7 @@ class RawPixelDecoder final : public PixelReader
128128

129129
uint16_t getSquashingDepth() { return 0; }
130130
bool doIRMajorityPoll();
131+
bool isRampUpStage() const { return mROFRampUpStage; }
131132
void reset();
132133

133134
private:
@@ -179,8 +180,8 @@ class RawPixelDecoder final : public PixelReader
179180
///______________________________________________________________
180181
/// Fill decoded digits to global vector
181182
template <class Mapping>
182-
template <class DigitContainer, class ROFContainer, class STATVEC>
183-
int RawPixelDecoder<Mapping>::fillDecodedDigits(DigitContainer& digits, ROFContainer& rofs, STATVEC& chipStatus)
183+
template <class DigitContainer, class ROFContainer>
184+
int RawPixelDecoder<Mapping>::fillDecodedDigits(DigitContainer& digits, ROFContainer& rofs)
184185
{
185186
if (mInteractionRecord.isDummy()) {
186187
return 0; // nothing was decoded
@@ -190,7 +191,6 @@ int RawPixelDecoder<Mapping>::fillDecodedDigits(DigitContainer& digits, ROFConta
190191
for (unsigned int iru = 0; iru < mRUDecodeVec.size(); iru++) {
191192
for (int ic = 0; ic < mRUDecodeVec[iru].nChipsFired; ic++) {
192193
const auto& chip = mRUDecodeVec[iru].chipsData[ic];
193-
chipStatus[chip.getChipID()] = 1;
194194
for (const auto& hit : mRUDecodeVec[iru].chipsData[ic].getData()) {
195195
digits.emplace_back(chip.getChipID(), hit.getRow(), hit.getCol());
196196
}
@@ -205,8 +205,8 @@ int RawPixelDecoder<Mapping>::fillDecodedDigits(DigitContainer& digits, ROFConta
205205
///______________________________________________________________
206206
/// Fill decoded digits to global vector
207207
template <>
208-
template <class DigitContainer, class ROFContainer, class STATVEC>
209-
int RawPixelDecoder<ChipMappingMFT>::fillDecodedDigits(DigitContainer& digits, ROFContainer& rofs, STATVEC& chipStatus)
208+
template <class DigitContainer, class ROFContainer>
209+
int RawPixelDecoder<ChipMappingMFT>::fillDecodedDigits(DigitContainer& digits, ROFContainer& rofs)
210210
{
211211
if (mInteractionRecord.isDummy()) {
212212
return 0; // nothing was decoded
@@ -216,7 +216,6 @@ int RawPixelDecoder<ChipMappingMFT>::fillDecodedDigits(DigitContainer& digits, R
216216
for (auto chipData = mOrderedChipsPtr.rbegin(); chipData != mOrderedChipsPtr.rend(); ++chipData) {
217217
assert(mLastReadChipID < (*chipData)->getChipID());
218218
mLastReadChipID = (*chipData)->getChipID();
219-
chipStatus[mLastReadChipID] = 1;
220219
for (const auto& hit : (*chipData)->getData()) {
221220
digits.emplace_back(mLastReadChipID, hit.getRow(), hit.getCol());
222221
}
@@ -233,13 +232,12 @@ template <class Mapping>
233232
template <class STATVEC>
234233
void RawPixelDecoder<Mapping>::fillChipsStatus(STATVEC& chipStatus)
235234
{
236-
if (mInteractionRecord.isDummy()) {
235+
if (mInteractionRecord.isDummy() || mROFRampUpStage) {
237236
return; // nothing was decoded
238237
}
239238
for (unsigned int iru = 0; iru < mRUDecodeVec.size(); iru++) {
240-
for (int ic = 0; ic < mRUDecodeVec[iru].nChipsFired; ic++) {
241-
const auto& chip = mRUDecodeVec[iru].chipsData[ic];
242-
chipStatus[chip.getChipID()] = 1;
239+
for (auto chID : mRUDecodeVec[iru].seenChipIDs) {
240+
chipStatus[chID] = 1;
243241
}
244242
}
245243
}

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1256,7 +1256,8 @@ class RawPixelReader : public PixelReader
12561256
auto chIdGetter = [this, cabHW, ri](int cid) {
12571257
return this->mMAP.getGlobalChipID(cid, cabHW, *ri);
12581258
};
1259-
while ((res = mCoder.decodeChip(*chipData, cableData, chIdGetter))) { // we register only chips with hits or errors flags set
1259+
std::vector<uint16_t> dummyStat;
1260+
while ((res = mCoder.decodeChip(*chipData, cableData, dummyStat, chIdGetter))) { // we register only chips with hits or errors flags set
12601261
if (res > 0) {
12611262
#ifdef _RAW_READER_ERROR_CHECKS_
12621263
// for the IB staves check if the cable ID is the same as the chip ID on the module

Detectors/ITSMFT/common/workflow/src/STFDecoderSpec.cxx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -171,14 +171,12 @@ void STFDecoder<Mapping>::run(ProcessingContext& pc)
171171
continue;
172172
}
173173
lastIR = mDecoder->getInteractionRecord();
174+
mDecoder->fillChipsStatus(chipStatus);
174175
if (mDoDigits || mClusterer->getMaxROFDepthToSquash()) { // call before clusterization, since the latter will hide the digits
175-
mDecoder->fillDecodedDigits(digVec, digROFVec, chipStatus); // lot of copying involved
176-
176+
mDecoder->fillDecodedDigits(digVec, digROFVec); // lot of copying involved
177177
if (mDoCalibData) {
178178
mDecoder->fillCalibData(calVec);
179179
}
180-
} else {
181-
mDecoder->fillChipsStatus(chipStatus);
182180
}
183181
if (mDoClusters && !mClusterer->getMaxROFDepthToSquash()) { // !!! THREADS !!!
184182
mClusterer->process(mNThreads, *mDecoder.get(), &clusCompVec, mDoPatterns ? &clusPattVec : nullptr, &clusROFVec);

0 commit comments

Comments
 (0)