Commit 3d421a7e authored by Peter Berta's avatar Peter Berta
Browse files

Merge branch 'ATLASRECTS-6624_22.0-mc20_handle_fragments_with_invalid_ndata' into '22.0-mc20'

Check for invalid number of data words in Pixel ROB fragments.

See merge request atlas/athena!48173
parents b72773b8 eecbc26d
......@@ -11,7 +11,6 @@
#include "PixelByteStreamModuleMask.h"
#include "ByteStreamData/RawEvent.h"
#include "eformat/SourceIdentifier.h"
#include "PixelConditionsData/PixelByteStreamErrors.h"
#include "xAODEventInfo/EventInfo.h"
#include <fstream>
......@@ -111,6 +110,26 @@ StatusCode PixelRodDecoder::finalize() {
return StatusCode::SUCCESS;
}
void PixelRodDecoder::propagateROBErrorsToModules(const PixelCablingCondData *pixCabling,
uint32_t robId,
std::array<uint64_t, PixelRodDecoder::ERROR_CONTAINER_MAX> &bsErrWord,
IDCInDetBSErrContainer& decodingErrors,
PixelByteStreamErrors::PixelErrorsEnum error_code,
const char *error_description) const {
assert( pixCabling);
const std::deque<Identifier> offlineIdList = pixCabling->find_entry_offlineList(robId);
for (const Identifier& id: offlineIdList) {
IdentifierHash idHash = m_pixel_id->wafer_hash(id);
PixelByteStreamErrors::addError(bsErrWord[static_cast<int>(idHash)],error_code);
}
ATH_MSG_DEBUG("ROB status word for robid 0x"<< std::hex << robId << std::dec <<" indicates " << error_description << ".");
assert( bsErrWord.size() <= decodingErrors.maxSize() );
for (size_t i=0; i<static_cast<size_t>(bsErrWord.size()); i++) {
if (bsErrWord[i]>0) {
decodingErrors.setOrDrop(i,bsErrWord[i]);
}
}
}
//---------------------------------------------------------------------------------------------------- fillCixollection
StatusCode PixelRodDecoder::fillCollection( const ROBFragment *robFrag, IPixelRDO_Container* rdoIdc, IDCInDetBSErrContainer& decodingErrors, std::vector<IdentifierHash>* vecHash) const {
......@@ -151,35 +170,21 @@ StatusCode PixelRodDecoder::fillCollection( const ROBFragment *robFrag, IPixelRD
Definition of the status words in a ROB fragment header is found in
https://twiki.cern.ch/twiki/bin/view/Atlas/ROBINFragmentErrors#Definition_of_the_first_status_e
*/
if (((*rob_status) >> 27) & 0x1) {
const std::deque<Identifier> offlineIdList = pixCabling->find_entry_offlineList(robId);
for (const Identifier& id: offlineIdList) {
IdentifierHash idHash = m_pixel_id->wafer_hash(id);
PixelByteStreamErrors::addError(bsErrWord[static_cast<int>(idHash)],PixelByteStreamErrors::TruncatedROB);
}
ATH_MSG_DEBUG("ROB status word for robid 0x"<< std::hex << robId << std::dec <<" indicates data truncation.");
assert( bsErrWord.size() <= decodingErrors.maxSize() );
for (size_t i=0; i<static_cast<size_t>(bsErrWord.size()); i++) {
if (bsErrWord[i]>0) {
decodingErrors.setOrDrop(i,bsErrWord[i]);
}
}
return StatusCode::RECOVERABLE;
if ((*rob_status) & (0x1 << 27)) {
propagateROBErrorsToModules(pixCabling.cptr(),robId,bsErrWord,decodingErrors,PixelByteStreamErrors::TruncatedROB, "data truncation");
return StatusCode::RECOVERABLE;
}
if (((*rob_status) >> 31) & 0x1) {
const std::deque<Identifier> offlineIdList = pixCabling->find_entry_offlineList(robId);
for (const Identifier& id: offlineIdList) {
IdentifierHash idHash = m_pixel_id->wafer_hash(id);
PixelByteStreamErrors::addError(bsErrWord[static_cast<int>(idHash)],PixelByteStreamErrors::MaskedROB);
}
ATH_MSG_DEBUG( "ROB status word for robid 0x"<< std::hex << robId<< std::dec <<" indicates resource was masked off.");
assert( bsErrWord.size() <= decodingErrors.maxSize() );
for (size_t i=0; i<static_cast<size_t>(bsErrWord.size()); i++) {
if (bsErrWord[i]>0) {
decodingErrors.setOrDrop(i,bsErrWord[i]);
}
}
return StatusCode::RECOVERABLE;
if ((*rob_status) & (0x1 << 31)) {
propagateROBErrorsToModules(pixCabling.cptr(),robId,bsErrWord,decodingErrors,PixelByteStreamErrors::MaskedROB, "resource was masked off");
return StatusCode::RECOVERABLE;
}
// in case the ROB fragment has a seemingly invalid size check the fragment and reject it if the check is not passed.
// Note: there are usable ROB fragments (i.e. ROB fragments which contribute pixel hits to tracks) which do not pass the check, so
// rejecting all fragments which do not pass the test would reject also seemingly "good" data.
if (robFrag->rod_ndata() > robFrag->payload_size_word() && !robFrag->check_rod_noex(robFrag->rod_version() >> 16)) {
propagateROBErrorsToModules(pixCabling.cptr(),robId,bsErrWord,decodingErrors,PixelByteStreamErrors::TruncatedROB,
" invalid ROD fragment, invalid payload size");
return StatusCode::RECOVERABLE;
}
}
}
......
......@@ -14,6 +14,7 @@
#include "PixelConditionsData/PixelCablingCondData.h"
#include "PixelConditionsData/PixelHitDiscCnfgData.h"
#include "PixelConditionsData/PixelByteStreamErrors.h"
#include "StoreGate/ReadCondHandleKey.h"
class IPixelCablingSvc;
......@@ -157,6 +158,14 @@ class PixelRodDecoder : virtual public IPixelRodDecoder, public AthAlgTool {
//!< if the check duplicated RDO flag is true, check that this RDO is unique (returns true if unique)
inline bool thisRdoIsUnique(const Identifier & pixelRdo, std::unordered_set<Identifier> & pixelRdosSeenSoFar) const;
//!< in case of invalid ROB fragments set corresponding error flags in all linked modules.
void propagateROBErrorsToModules(const PixelCablingCondData *pixCabling,
uint32_t robId,
std::array<uint64_t, PixelRodDecoder::ERROR_CONTAINER_MAX> &bsErrWord,
IDCInDetBSErrContainer& decodingErrors,
PixelByteStreamErrors::PixelErrorsEnum error_code,
const char *error_description) const;
};
bool
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment