Skip to content

Commit a2cd581

Browse files
authored
MID: prevent crash when data from non-existent board is processed (AliceO2Group#7189)
1 parent febf4fd commit a2cd581

1 file changed

Lines changed: 19 additions & 12 deletions

File tree

Detectors/MUON/MID/Raw/src/DecodedDataAggregator.cxx

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -43,18 +43,22 @@ void DecodedDataAggregator::addData(const ROBoard& loc, size_t firstEntry, size_
4343
uint8_t uniqueLocId = loc.boardId;
4444
uint8_t crateId = raw::getCrateId(uniqueLocId);
4545
bool isRightSide = crateparams::isRightSide(crateId);
46-
uint16_t deBoardId = mCrateMapper.roLocalBoardToDE(crateId, raw::getLocId(loc.boardId));
47-
auto rpcLineId = mCrateMapper.getRPCLine(deBoardId);
48-
auto columnId = mCrateMapper.getColumnId(deBoardId);
49-
auto lineId = mCrateMapper.getLineId(deBoardId);
50-
for (int ich = 0; ich < 4; ++ich) {
51-
if (((loc.firedChambers >> ich) & 0x1) == 0) {
52-
continue;
46+
try {
47+
uint16_t deBoardId = mCrateMapper.roLocalBoardToDE(crateId, raw::getLocId(loc.boardId));
48+
auto rpcLineId = mCrateMapper.getRPCLine(deBoardId);
49+
auto columnId = mCrateMapper.getColumnId(deBoardId);
50+
auto lineId = mCrateMapper.getLineId(deBoardId);
51+
for (int ich = 0; ich < 4; ++ich) {
52+
if (((loc.firedChambers >> ich) & 0x1) == 0) {
53+
continue;
54+
}
55+
uint8_t deId = detparams::getDEId(isRightSide, ich, rpcLineId);
56+
auto& col = FindColumnData(deId, columnId, firstEntry, evtTypeIdx);
57+
col.setBendPattern(loc.patternsBP[ich], lineId);
58+
col.setNonBendPattern(col.getNonBendPattern() | loc.patternsNBP[ich]);
5359
}
54-
uint8_t deId = detparams::getDEId(isRightSide, ich, rpcLineId);
55-
auto& col = FindColumnData(deId, columnId, firstEntry, evtTypeIdx);
56-
col.setBendPattern(loc.patternsBP[ich], lineId);
57-
col.setNonBendPattern(col.getNonBendPattern() | loc.patternsNBP[ich]);
60+
} catch (const std::exception& except) {
61+
std::cerr << except.what() << "\n";
5862
}
5963
}
6064

@@ -86,7 +90,10 @@ void DecodedDataAggregator::process(gsl::span<const ROBoard> localBoards, gsl::s
8690
addData(localBoards[iloc], firstEntry, ievtType);
8791
}
8892
}
89-
mROFRecords[ievtType].emplace_back(rof->interactionRecord, rof->eventType, firstEntry, mData[ievtType].size() - firstEntry);
93+
auto nEntries = mData[ievtType].size() - firstEntry;
94+
if (nEntries > 0) {
95+
mROFRecords[ievtType].emplace_back(rof->interactionRecord, rof->eventType, firstEntry, nEntries);
96+
}
9097
}
9198
// Clear the inner objects when the computation is done
9299
mEventIndexes[ievtType].clear();

0 commit comments

Comments
 (0)