Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HCAL unpacker: adding more protection against corrupted data #43011

Merged
merged 1 commit into from
Oct 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions EventFilter/HcalRawToDigi/interface/AMC13Header.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ namespace hcal {
inline bool AMCMore(int i) const { return ((modulesHeaders[i] >> 61) & 0x1) != 0; }
/** Segmented data? */
inline bool AMCSegmented(int i) const { return ((modulesHeaders[i] >> 60) & 0x1) != 0; }
/** Was the length as expected? */
inline bool AMCLengthOk(int i) const { return ((modulesHeaders[i] >> 62) & 0x1) != 0; }
/** Was the length as expected? (logic appears inverted in firmware) */
inline bool AMCLengthOk(int i) const { return ((modulesHeaders[i] >> 62) & 0x1) == 0; }
/** Was the CRC correct as received by the AMC13? */
inline bool AMCCRCOk(int i) const { return ((modulesHeaders[i] >> 56) & 0x1) != 0; }
/** Is there data for this AMC? */
Expand Down
3 changes: 2 additions & 1 deletion EventFilter/HcalRawToDigi/interface/HcalUHTRData.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ class HcalUHTRData {
inline uint32_t slot() const { return uint32_t(m_raw64[1] >> 8) & 0xF; }
/** \brief Get the presamples */
inline uint32_t presamples() const { return uint32_t(m_raw64[1] >> 12) & 0xF; }

/** \brief Get the length from the uHTR header */
inline uint32_t length64_uhtr() const { return uint32_t(m_raw64[0]) & 0xFFFFF; }
/** \brief Was this channel passed as part of Mark&Pass ZS?*/
bool wasMarkAndPassZS(int fiber, int fiberchan) const;
/** \brief Was this channel passed as part of Mark&Pass ZS?*/
Expand Down
10 changes: 9 additions & 1 deletion EventFilter/HcalRawToDigi/src/HcalUnpacker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include "DataFormats/HcalDigi/interface/HcalQIESample.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "EventFilter/HcalRawToDigi/interface/HcalTTPUnpacker.h"

#include <iomanip>
//#define DebugLog

namespace HcalUnpacker_impl {
Expand Down Expand Up @@ -713,6 +713,14 @@ void HcalUnpacker::unpackUTCA(const FEDRawData& raw,
continue;
}

if (!amc13->AMCLengthOk(iamc)) {
if (!silent)
edm::LogWarning("Invalid Data") << "Length mismatch between uHTR and AMC13 observed on iamc " << iamc
<< " of AMC13 with source id " << amc13->sourceId();
report.countSpigotFormatError();
continue;
}

// ok, now we're work-able
int slot = amc13->AMCSlot(iamc);
int crate = amc13->AMCId(iamc) & 0xFF;
Expand Down