Skip to content

Commit 0ef801a

Browse files
Kirill Naumovshahor02
authored andcommitted
ITS: Fixing reporting of TrailerAfterHeader error in decoder
The current implementation of the code flow would never thigger this error, instead hitting an UnknownWord error.
1 parent e471096 commit 0ef801a

1 file changed

Lines changed: 13 additions & 16 deletions

File tree

  • Detectors/ITSMFT/common/reconstruction/include/ITSMFTReconstruction

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

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,6 @@ class AlpideCoder
160160
uint32_t expectInp = ExpectNextChip; // data must always start with chip header or chip empty flag
161161

162162
chipData.clear();
163-
bool dataSeen = false;
164163
LOG(debug) << "NewEntry";
165164
while (buffer.next(dataC)) {
166165
//
@@ -223,7 +222,6 @@ class AlpideCoder
223222
return unexpectedEOF("CHIP_HEADER"); // abandon cable data
224223
}
225224
expectInp = ExpectRegion; // now expect region info
226-
dataSeen = false;
227225
continue;
228226
}
229227

@@ -250,19 +248,11 @@ class AlpideCoder
250248
addHit(chipData, rightColHits[ihr], colDPrev);
251249
}
252250
}
253-
254-
if (!dataSeen && !chipData.isErrorSet()) {
255-
#ifdef ALPIDE_DECODING_STAT
256-
chipData.setError(ChipStat::TrailerAfterHeader);
257-
#endif
258-
return unexpectedEOF("Trailer after header"); // abandon cable data
259-
}
260251
break;
261252
}
262253

263254
// hit info ?
264255
if ((expectInp & ExpectData)) {
265-
dataSeen = true;
266256
if (isData(dataC)) { // region header was seen, expect data
267257
// note that here we are checking on the byte rather than the short, need complete to ushort
268258
dataS = dataC << 8;
@@ -392,12 +382,19 @@ class AlpideCoder
392382
return unexpectedEOF("Abandon on 0-padding"); // abandon cable data
393383
}
394384

395-
// in case of BUSY VIOLATION the Trailer may come directly after the Header
396-
if ((expectInp & ExpectRegion) && isChipTrailer(dataC) && (dataC & MaskROFlags)) {
397-
expectInp = ExpectNextChip;
398-
chipData.setROFlags(dataC & MaskROFlags);
399-
roErrHandler(dataC & MaskROFlags);
400-
break;
385+
if ((expectInp & ExpectRegion) && isChipTrailer(dataC)) {
386+
if (dataC & MaskROFlags) {
387+
// in case of BUSY VIOLATION the Trailer may come directly after the Header
388+
expectInp = ExpectNextChip;
389+
chipData.setROFlags(dataC & MaskROFlags);
390+
roErrHandler(dataC & MaskROFlags);
391+
break;
392+
} else {
393+
#ifdef ALPIDE_DECODING_STAT
394+
chipData.setError(ChipStat::TrailerAfterHeader);
395+
#endif
396+
return unexpectedEOF("Trailer after header"); // abandon cable data
397+
}
401398
}
402399

403400
// check for APE errors, see https://alice.its.cern.ch/jira/browse/O2-1717?focusedCommentId=274714&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-274714

0 commit comments

Comments
 (0)