From a14a83a93d7a40ab2926eff9500d57db657b6244 Mon Sep 17 00:00:00 2001 From: aferrero2707 Date: Tue, 20 Sep 2022 15:07:23 +0200 Subject: [PATCH 1/8] [MCH] improved detection of TimeFrame start --- .../MUON/MCH/Workflow/src/cru-page-reader-workflow.cxx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Detectors/MUON/MCH/Workflow/src/cru-page-reader-workflow.cxx b/Detectors/MUON/MCH/Workflow/src/cru-page-reader-workflow.cxx index a3ae4284d88bc..b8f425856e8c8 100644 --- a/Detectors/MUON/MCH/Workflow/src/cru-page-reader-workflow.cxx +++ b/Detectors/MUON/MCH/Workflow/src/cru-page-reader-workflow.cxx @@ -320,9 +320,10 @@ class FileReaderTask } if (mPrint) { - std::cout << "Sending TF" << std::endl + std::cout << "Sending TF " << orbitMin << " (previous " << mLastTForbit << " delta " << orbitMin-mLastTForbit << ")" << std::endl << std::endl; } + mLastTForbit = orbitMin; auto freefct = [](void* data, void* /*hint*/) { free(data); }; pc.outputs().adoptChunk(Output{"RDT", "RAWDATA"}, outBuf, outSize, freefct, nullptr); @@ -448,7 +449,7 @@ class FileReaderTask // increment the total buffer size mTimeFrameSizes[feeID][linkID] += pageSize; - if ((triggerType & 0x800) != 0 && stopBit == 0 && pageCounter == 0 && bc == 0) { + if ((triggerType & 0x800) != 0 && /*stopBit == 0 && pageCounter == 0 &&*/ bc == 0) { // This is the start of a new TimeFrame, so we need to push a new empty TimeFrame in the queue if (mPrint) { std::cout << "tfQueue.size(): " << tfQueue.size() << std::endl; @@ -615,6 +616,7 @@ class FileReaderTask bool mFullTF; ///< send full time frames bool mSaveTF; ///< save individual time frames to file int mOverlap; ///< overlap between contiguous TimeFrames + int mLastTForbit{ 0 }; bool mPrint = false; ///< print debug messages o2::dataformats::TFIDInfo mTFIDInfo{}; // struct to modify output headers From b1b377d6f149a115a017f4acc2579505e1585926 Mon Sep 17 00:00:00 2001 From: aferrero2707 Date: Tue, 20 Sep 2022 23:19:40 +0200 Subject: [PATCH 2/8] [MCH] improved error detection in raw decoder - badly formatted SYNC words - SAMPA packet headers consistency - chip address and e-link index compatibility - num of 10-bit words multiple of 4 in cluster sum mode --- .../include/MCHRawDecoder/ErrorCodes.h | 21 +++++----- .../MUON/MCH/Raw/Decoder/src/ErrorCodes.cxx | 13 ++++--- .../Raw/Decoder/src/UserLogicElinkDecoder.cxx | 38 +++++++++++++++++++ .../Raw/Decoder/src/UserLogicElinkDecoder.h | 17 +++++++-- 4 files changed, 71 insertions(+), 18 deletions(-) diff --git a/Detectors/MUON/MCH/Raw/Decoder/include/MCHRawDecoder/ErrorCodes.h b/Detectors/MUON/MCH/Raw/Decoder/include/MCHRawDecoder/ErrorCodes.h index 43d977a9dfd14..e06b894cf685e 100644 --- a/Detectors/MUON/MCH/Raw/Decoder/include/MCHRawDecoder/ErrorCodes.h +++ b/Detectors/MUON/MCH/Raw/Decoder/include/MCHRawDecoder/ErrorCodes.h @@ -25,16 +25,17 @@ enum ErrorCodes { ErrorParity = 1, // 1 ErrorHammingCorrectable = 1 << 1, // 2 ErrorHammingUncorrectable = 1 << 2, // 4 - ErrorBadClusterSize = 1 << 3, // 8 - ErrorBadPacketType = 1 << 4, // 16 - ErrorBadHeartBeatPacket = 1 << 5, // 32 - ErrorBadIncompleteWord = 1 << 6, // 64 - ErrorTruncatedData = 1 << 7, // 128 - ErrorBadELinkID = 1 << 8, // 256 - ErrorBadLinkID = 1 << 9, // 512 - ErrorUnknownLinkID = 1 << 10, // 1024 - ErrorInvalidDigitTime = 1 << 11, // 2048 - ErrorNonRecoverableDecodingError = 1 << 12 // 4096 + ErrorBadSyncPacket = 1 << 3, // 8 + ErrorBadHeartBeatPacket = 1 << 4, // 16 + ErrorBadDataPacket = 1 << 5, // 32 + ErrorBadClusterSize = 1 << 6, // 64 + ErrorBadIncompleteWord = 1 << 7, // 128 + ErrorTruncatedData = 1 << 8, // 256 + ErrorBadELinkID = 1 << 9, // 512 + ErrorBadLinkID = 1 << 10, // 1024 + ErrorUnknownLinkID = 1 << 11, // 2048 + ErrorBadHBTime = 1 << 12, // 4096 + ErrorNonRecoverableDecodingError = 1 << 13 // 8192 }; uint32_t getErrorCodesSize(); diff --git a/Detectors/MUON/MCH/Raw/Decoder/src/ErrorCodes.cxx b/Detectors/MUON/MCH/Raw/Decoder/src/ErrorCodes.cxx index 9edf841c3f275..49b838f034539 100644 --- a/Detectors/MUON/MCH/Raw/Decoder/src/ErrorCodes.cxx +++ b/Detectors/MUON/MCH/Raw/Decoder/src/ErrorCodes.cxx @@ -20,7 +20,7 @@ namespace raw uint32_t getErrorCodesSize() { - return 13; + return 14; } void append(const char* msg, std::string& to) @@ -49,12 +49,15 @@ std::string errorCodeAsString(uint32_t ec) if (ec & ErrorBadClusterSize) { append("Cluster Size", msg); } - if (ec & ErrorBadPacketType) { - append("Bad Packet Type", msg); + if (ec & ErrorBadSyncPacket) { + append("Bad Sync Packet", msg); } if (ec & ErrorBadHeartBeatPacket) { append("Bad HB Packet", msg); } + if (ec & ErrorBadDataPacket) { + append("Bad Data Packet", msg); + } if (ec & ErrorBadIncompleteWord) { append("Bad Incomplete Word", msg); } @@ -70,8 +73,8 @@ std::string errorCodeAsString(uint32_t ec) if (ec & ErrorUnknownLinkID) { append("Unknown Link ID", msg); } - if (ec & ErrorInvalidDigitTime) { - append("Invalid Digit Time", msg); + if (ec & ErrorBadHBTime) { + append("Bad HB Time", msg); } if (ec & ErrorNonRecoverableDecodingError) { append("Non Recoverable", msg); diff --git a/Detectors/MUON/MCH/Raw/Decoder/src/UserLogicElinkDecoder.cxx b/Detectors/MUON/MCH/Raw/Decoder/src/UserLogicElinkDecoder.cxx index 86eb5477d1ef7..606ea5d06afa8 100644 --- a/Detectors/MUON/MCH/Raw/Decoder/src/UserLogicElinkDecoder.cxx +++ b/Detectors/MUON/MCH/Raw/Decoder/src/UserLogicElinkDecoder.cxx @@ -38,4 +38,42 @@ void UserLogicElinkDecoder::prepareAndSendCluster() mSamples.clear(); } +template <> +bool UserLogicElinkDecoder::checkDataHeader() +{ + int chipAddMin = mDsId.elinkIndexInGroup() * 2; + int chipAddMax = chipAddMin + 1; + + // the chip address from the SAMPA header must be consistent with + // the e-Link index + int chipAdd = mSampaHeader.chipAddress(); + if (chipAdd < chipAddMin || chipAdd > chipAddMax) { + return false; + } + + return true; +} + +template <> +bool UserLogicElinkDecoder::checkDataHeader() +{ + int chipAddMin = mDsId.elinkIndexInGroup() * 2; + int chipAddMax = chipAddMin + 1; + + // the chip address from the SAMPA header must be consistent with + // the e-Link index + int chipAdd = mSampaHeader.chipAddress(); + if (chipAdd < chipAddMin || chipAdd > chipAddMax) { + return false; + } + + // in cluster sum mode the number of 10-bit words must be a multiple of 4 + int nof10BitWords = mSampaHeader.nof10BitWords(); + if ((nof10BitWords % 4) != 0) { + return false; + } + + return true; +} + } // namespace o2::mch::raw diff --git a/Detectors/MUON/MCH/Raw/Decoder/src/UserLogicElinkDecoder.h b/Detectors/MUON/MCH/Raw/Decoder/src/UserLogicElinkDecoder.h index bba31cdaf94a7..33f53863a47e5 100644 --- a/Detectors/MUON/MCH/Raw/Decoder/src/UserLogicElinkDecoder.h +++ b/Detectors/MUON/MCH/Raw/Decoder/src/UserLogicElinkDecoder.h @@ -73,6 +73,7 @@ class UserLogicElinkDecoder void completeHeader(); void oneLess10BitWord(); void prepareAndSendCluster(); + bool checkDataHeader(); void sendCluster(const SampaCluster& sc) const; void sendHBPacket(); void sendError(int8_t chip, uint32_t error) const; @@ -185,7 +186,11 @@ bool UserLogicElinkDecoder::append10(uint10_t data10) setHeaderPart(data10); if (isHeaderComplete()) { completeHeader(); - if (isSync(mSampaHeader.uint64())) { + if (mSampaHeader.packetType() == SampaPacketType::Sync) { + if (!isSync(mSampaHeader.uint64())) { + mErrorMessage = "badly formatted Sync packet"; + sendError(static_cast(mSampaHeader.chipAddress()), static_cast(ErrorBadSyncPacket)); + } reset(); } else if (mSampaHeader.packetType() == SampaPacketType::HeartBeat) { if (mSampaHeader.isHeartbeat()) { @@ -198,9 +203,15 @@ bool UserLogicElinkDecoder::append10(uint10_t data10) reset(); } } else { - if (mSampaHeader.nof10BitWords() > 2) { - transition(State::WaitingSize); + if (checkDataHeader()) { + if (mSampaHeader.nof10BitWords() > 2) { + transition(State::WaitingSize); + } else { + reset(); + } } else { + mErrorMessage = "badly formatted Data packet"; + sendError(static_cast(mSampaHeader.chipAddress()), static_cast(ErrorBadDataPacket)); reset(); } } From 3039213c9e1f0c9adfe1f96a59ac8c753daed743 Mon Sep 17 00:00:00 2001 From: aferrero2707 Date: Wed, 21 Sep 2022 08:36:41 +0200 Subject: [PATCH 3/8] [MCH] removed check of digits time in DataDecoder This is because the corresponding "Bad digit time" error type has been removed, because it is redundant. The digit time can be checked offline with `digit.getTime() != DataDecoder::tfTimeInvalid` --- .../Decoder/include/MCHRawDecoder/DataDecoder.h | 1 - .../MUON/MCH/Raw/Decoder/src/DataDecoder.cxx | 15 --------------- .../MUON/MCH/Workflow/src/DataDecoderSpec.cxx | 1 - 3 files changed, 17 deletions(-) diff --git a/Detectors/MUON/MCH/Raw/Decoder/include/MCHRawDecoder/DataDecoder.h b/Detectors/MUON/MCH/Raw/Decoder/include/MCHRawDecoder/DataDecoder.h index 70e1e59ee8f33..fbd5501af11e4 100644 --- a/Detectors/MUON/MCH/Raw/Decoder/include/MCHRawDecoder/DataDecoder.h +++ b/Detectors/MUON/MCH/Raw/Decoder/include/MCHRawDecoder/DataDecoder.h @@ -177,7 +177,6 @@ class DataDecoder /// Compute the time of all the digits that have been decoded in the current TimeFrame void computeDigitsTimeBCRst(); void computeDigitsTime(); - void checkDigitsTime(); /// Get the vector of digits that have been decoded in the current TimeFrame const RawDigitVector& getDigits() const { return mDigits; } diff --git a/Detectors/MUON/MCH/Raw/Decoder/src/DataDecoder.cxx b/Detectors/MUON/MCH/Raw/Decoder/src/DataDecoder.cxx index e523ce5fec73d..2cb69e543b45e 100644 --- a/Detectors/MUON/MCH/Raw/Decoder/src/DataDecoder.cxx +++ b/Detectors/MUON/MCH/Raw/Decoder/src/DataDecoder.cxx @@ -814,21 +814,6 @@ void DataDecoder::computeDigitsTimeBCRst() //_________________________________________________________________________________________________ -void DataDecoder::checkDigitsTime() -{ - for (auto& digit : mDigits) { - auto& d = digit.digit; - auto& info = digit.info; - auto tfTime = d.getTime(); - if (tfTime == DataDecoder::tfTimeInvalid) { - // add invalid digit time error - mErrors.emplace_back(o2::mch::DecoderError(info.solar, info.ds, info.chip, ErrorInvalidDigitTime)); - } - } -} - -//_________________________________________________________________________________________________ - void DataDecoder::computeDigitsTime() { switch (mTimeRecoMode) { diff --git a/Detectors/MUON/MCH/Workflow/src/DataDecoderSpec.cxx b/Detectors/MUON/MCH/Workflow/src/DataDecoderSpec.cxx index fb80fde805bae..402544d5f8b15 100644 --- a/Detectors/MUON/MCH/Workflow/src/DataDecoderSpec.cxx +++ b/Detectors/MUON/MCH/Workflow/src/DataDecoderSpec.cxx @@ -243,7 +243,6 @@ class DataDecoderTask } } mDecoder->computeDigitsTime(); - mDecoder->checkDigitsTime(); auto tEnd = std::chrono::high_resolution_clock::now(); mTimeDecoding += tEnd - tStart; From 846f3b851d2900f9ea443ea2264257f571444b9c Mon Sep 17 00:00:00 2001 From: aferrero2707 Date: Wed, 21 Sep 2022 09:58:48 +0200 Subject: [PATCH 4/8] [MCH] skip HB decoding when not needed --- Detectors/MUON/MCH/Raw/Decoder/src/DataDecoder.cxx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Detectors/MUON/MCH/Raw/Decoder/src/DataDecoder.cxx b/Detectors/MUON/MCH/Raw/Decoder/src/DataDecoder.cxx index 2cb69e543b45e..001e60d555589 100644 --- a/Detectors/MUON/MCH/Raw/Decoder/src/DataDecoder.cxx +++ b/Detectors/MUON/MCH/Raw/Decoder/src/DataDecoder.cxx @@ -548,6 +548,10 @@ void DataDecoder::decodePage(gsl::span page) uint32_t linkId; auto heartBeatHandler = [&](DsElecId dsElecId, uint8_t chip, uint32_t bunchCrossing) { + if (mTimeRecoMode != TimeRecoMode::HBPackets) { + return; + } + auto ds = dsElecId.elinkId(); auto solar = dsElecId.solarId(); uint64_t chipId = getChipId(solar, ds, chip); From b15f1c723ea41539da7e3522975d31c0ef6cb923 Mon Sep 17 00:00:00 2001 From: aferrero2707 Date: Wed, 21 Sep 2022 10:15:42 +0200 Subject: [PATCH 5/8] [MCH] fixed clang formatting --- Detectors/MUON/MCH/Workflow/src/cru-page-reader-workflow.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Detectors/MUON/MCH/Workflow/src/cru-page-reader-workflow.cxx b/Detectors/MUON/MCH/Workflow/src/cru-page-reader-workflow.cxx index b8f425856e8c8..da11113fdc364 100644 --- a/Detectors/MUON/MCH/Workflow/src/cru-page-reader-workflow.cxx +++ b/Detectors/MUON/MCH/Workflow/src/cru-page-reader-workflow.cxx @@ -320,7 +320,7 @@ class FileReaderTask } if (mPrint) { - std::cout << "Sending TF " << orbitMin << " (previous " << mLastTForbit << " delta " << orbitMin-mLastTForbit << ")" << std::endl + std::cout << "Sending TF " << orbitMin << " (previous " << mLastTForbit << " delta " << (orbitMin - mLastTForbit) << ")" << std::endl << std::endl; } mLastTForbit = orbitMin; @@ -616,7 +616,7 @@ class FileReaderTask bool mFullTF; ///< send full time frames bool mSaveTF; ///< save individual time frames to file int mOverlap; ///< overlap between contiguous TimeFrames - int mLastTForbit{ 0 }; + int mLastTForbit{0}; ///< first orbit number of last transmitted TimeFrame bool mPrint = false; ///< print debug messages o2::dataformats::TFIDInfo mTFIDInfo{}; // struct to modify output headers From b03f092488273f06170fc0f710328c9583af490d Mon Sep 17 00:00:00 2001 From: aferrero2707 Date: Thu, 22 Sep 2022 19:27:38 +0200 Subject: [PATCH 6/8] [MCH] added detection of mis-placed SYNC packet --- .../include/MCHRawDecoder/ErrorCodes.h | 11 ++++++----- .../MUON/MCH/Raw/Decoder/src/ErrorCodes.cxx | 5 ++++- .../Raw/Decoder/src/UserLogicElinkDecoder.cxx | 12 +++++++++++- .../Raw/Decoder/src/UserLogicElinkDecoder.h | 19 +++++++++++++++---- .../src/testUserLogicEndpointDecoder.cxx | 7 ++++--- 5 files changed, 40 insertions(+), 14 deletions(-) diff --git a/Detectors/MUON/MCH/Raw/Decoder/include/MCHRawDecoder/ErrorCodes.h b/Detectors/MUON/MCH/Raw/Decoder/include/MCHRawDecoder/ErrorCodes.h index e06b894cf685e..52d5300bffa3e 100644 --- a/Detectors/MUON/MCH/Raw/Decoder/include/MCHRawDecoder/ErrorCodes.h +++ b/Detectors/MUON/MCH/Raw/Decoder/include/MCHRawDecoder/ErrorCodes.h @@ -31,11 +31,12 @@ enum ErrorCodes { ErrorBadClusterSize = 1 << 6, // 64 ErrorBadIncompleteWord = 1 << 7, // 128 ErrorTruncatedData = 1 << 8, // 256 - ErrorBadELinkID = 1 << 9, // 512 - ErrorBadLinkID = 1 << 10, // 1024 - ErrorUnknownLinkID = 1 << 11, // 2048 - ErrorBadHBTime = 1 << 12, // 4096 - ErrorNonRecoverableDecodingError = 1 << 13 // 8192 + ErrorUnexpectedSyncPacket = 1 << 9, // 512 + ErrorBadELinkID = 1 << 10, // 1024 + ErrorBadLinkID = 1 << 11, // 2048 + ErrorUnknownLinkID = 1 << 12, // 4096 + ErrorBadHBTime = 1 << 13, // 8192 + ErrorNonRecoverableDecodingError = 1 << 14 // 16384 }; uint32_t getErrorCodesSize(); diff --git a/Detectors/MUON/MCH/Raw/Decoder/src/ErrorCodes.cxx b/Detectors/MUON/MCH/Raw/Decoder/src/ErrorCodes.cxx index 49b838f034539..6d3ca8eef7df0 100644 --- a/Detectors/MUON/MCH/Raw/Decoder/src/ErrorCodes.cxx +++ b/Detectors/MUON/MCH/Raw/Decoder/src/ErrorCodes.cxx @@ -20,7 +20,7 @@ namespace raw uint32_t getErrorCodesSize() { - return 14; + return 15; } void append(const char* msg, std::string& to) @@ -52,6 +52,9 @@ std::string errorCodeAsString(uint32_t ec) if (ec & ErrorBadSyncPacket) { append("Bad Sync Packet", msg); } + if (ec & ErrorUnexpectedSyncPacket) { + append("Unexpected Sync", msg); + } if (ec & ErrorBadHeartBeatPacket) { append("Bad HB Packet", msg); } diff --git a/Detectors/MUON/MCH/Raw/Decoder/src/UserLogicElinkDecoder.cxx b/Detectors/MUON/MCH/Raw/Decoder/src/UserLogicElinkDecoder.cxx index 606ea5d06afa8..e719671c50894 100644 --- a/Detectors/MUON/MCH/Raw/Decoder/src/UserLogicElinkDecoder.cxx +++ b/Detectors/MUON/MCH/Raw/Decoder/src/UserLogicElinkDecoder.cxx @@ -51,6 +51,12 @@ bool UserLogicElinkDecoder::checkDataHeader() return false; } + // we expect at least 3 10-bit words + int nof10BitWords = mSampaHeader.nof10BitWords(); + if (nof10BitWords <= 2) { + return false; + } + return true; } @@ -67,8 +73,12 @@ bool UserLogicElinkDecoder::checkDataHeader() return false; } - // in cluster sum mode the number of 10-bit words must be a multiple of 4 + // we expect at least 3 10-bit words int nof10BitWords = mSampaHeader.nof10BitWords(); + if (nof10BitWords <= 2) { + return false; + } + // in cluster sum mode the number of 10-bit words must be a multiple of 4 if ((nof10BitWords % 4) != 0) { return false; } diff --git a/Detectors/MUON/MCH/Raw/Decoder/src/UserLogicElinkDecoder.h b/Detectors/MUON/MCH/Raw/Decoder/src/UserLogicElinkDecoder.h index 33f53863a47e5..b10dbef53e588 100644 --- a/Detectors/MUON/MCH/Raw/Decoder/src/UserLogicElinkDecoder.h +++ b/Detectors/MUON/MCH/Raw/Decoder/src/UserLogicElinkDecoder.h @@ -119,10 +119,18 @@ void UserLogicElinkDecoder::append(uint64_t data50, uint8_t error, bo if (isSync(data50)) { #ifdef ULDEBUG - debugHeader() << (*this) << fmt::format(" --> SYNC word found {:013x}\n", data50); + debugHeader() << (*this) << fmt::format(" --> SYNC word found {:013x} state={}\n", data50, asString(mState)); #endif - clear(); - transition(State::WaitingHeader); + if (mState != State::WaitingHeader && mState != State::WaitingSync) { +#ifdef ULDEBUG + debugHeader() << (*this) << " SYNC word found while decoding payload --> resetting\n" +#endif + sendError(static_cast(mSampaHeader.chipAddress()), static_cast(ErrorUnexpectedSyncPacket)); + reset(); + } else { + clear(); + transition(State::WaitingHeader); + } return; } @@ -179,7 +187,7 @@ bool UserLogicElinkDecoder::append10(uint10_t data10) { bool result = false; #ifdef ULDEBUG - debugHeader() << (*this) << fmt::format(" --> data10 {:d}\n", data10); + debugHeader() << (*this) << fmt::format(" --> data10 {:d} state {}\n", data10, asString(mState)); #endif switch (mState) { case State::WaitingHeader: @@ -276,6 +284,9 @@ std::string UserLogicElinkDecoder::asString(State s) const case State::WaitingSample: return "WaitingSample"; break; + default: + return "Unknown"; + break; }; } diff --git a/Detectors/MUON/MCH/Raw/Decoder/src/testUserLogicEndpointDecoder.cxx b/Detectors/MUON/MCH/Raw/Decoder/src/testUserLogicEndpointDecoder.cxx index 750808aaeb5c7..43aefe520cb6e 100644 --- a/Detectors/MUON/MCH/Raw/Decoder/src/testUserLogicEndpointDecoder.cxx +++ b/Detectors/MUON/MCH/Raw/Decoder/src/testUserLogicEndpointDecoder.cxx @@ -367,9 +367,10 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(SyncInTheMiddleChargeSumModeTwoChannels, V, testTy DsElecId{361, 6, 2}, 63, {cl1, cl2}, DsElecId{361, 6, 2}, 47, {cl3, cl4}, 5); - BOOST_CHECK_EQUAL(r, - "S361-J6-DS2-ch-63-ts-345-q-123456-cs-789\n" - "S361-J6-DS2-ch-63-ts-346-q-789012-cs-345\n"); + std::string r2 = "S361-J6-DS2-ch-63-ts-345-q-123456-cs-789\n"; + r2 += "S361-J6-DS2-ch-63-ts-346-q-789012-cs-345\n"; + r2 += fmt::format("S361-J6-DS2-chip-5-error-{}\n", ErrorUnexpectedSyncPacket); + BOOST_CHECK_EQUAL(r, r2); } BOOST_AUTO_TEST_CASE_TEMPLATE(TestCruPageOK, V, testTypes) From 7f9037cd362406ff5222044350b40020dad8d597 Mon Sep 17 00:00:00 2001 From: aferrero2707 Date: Thu, 22 Sep 2022 21:55:22 +0200 Subject: [PATCH 7/8] [MCH] corrected typo --- Detectors/MUON/MCH/Raw/Decoder/src/UserLogicElinkDecoder.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Detectors/MUON/MCH/Raw/Decoder/src/UserLogicElinkDecoder.h b/Detectors/MUON/MCH/Raw/Decoder/src/UserLogicElinkDecoder.h index b10dbef53e588..7246ebe36d717 100644 --- a/Detectors/MUON/MCH/Raw/Decoder/src/UserLogicElinkDecoder.h +++ b/Detectors/MUON/MCH/Raw/Decoder/src/UserLogicElinkDecoder.h @@ -123,7 +123,7 @@ void UserLogicElinkDecoder::append(uint64_t data50, uint8_t error, bo #endif if (mState != State::WaitingHeader && mState != State::WaitingSync) { #ifdef ULDEBUG - debugHeader() << (*this) << " SYNC word found while decoding payload --> resetting\n" + debugHeader() << (*this) << " SYNC word found while decoding payload --> resetting\n"; #endif sendError(static_cast(mSampaHeader.chipAddress()), static_cast(ErrorUnexpectedSyncPacket)); reset(); From 22d4fdb1b4e1bea1e9a22b0355c29c1136b16098 Mon Sep 17 00:00:00 2001 From: aferrero2707 Date: Tue, 4 Oct 2022 21:40:42 +0200 Subject: [PATCH 8/8] [MCH] send HB packets regardless of mTimeRecoMode value --- Detectors/MUON/MCH/Raw/Decoder/src/DataDecoder.cxx | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/Detectors/MUON/MCH/Raw/Decoder/src/DataDecoder.cxx b/Detectors/MUON/MCH/Raw/Decoder/src/DataDecoder.cxx index 001e60d555589..b0285abaf72cb 100644 --- a/Detectors/MUON/MCH/Raw/Decoder/src/DataDecoder.cxx +++ b/Detectors/MUON/MCH/Raw/Decoder/src/DataDecoder.cxx @@ -548,10 +548,6 @@ void DataDecoder::decodePage(gsl::span page) uint32_t linkId; auto heartBeatHandler = [&](DsElecId dsElecId, uint8_t chip, uint32_t bunchCrossing) { - if (mTimeRecoMode != TimeRecoMode::HBPackets) { - return; - } - auto ds = dsElecId.elinkId(); auto solar = dsElecId.solarId(); uint64_t chipId = getChipId(solar, ds, chip); @@ -568,8 +564,9 @@ void DataDecoder::decodePage(gsl::span page) mHBPackets.emplace_back(solar, ds, chip, bunchCrossing); - if (!mTimeFrameStartRecords[chipId].update(mFirstOrbitInTF, bunchCrossing)) { - if (mErrorCount < MCH_DECODER_MAX_ERROR_COUNT) { + if (mTimeRecoMode == TimeRecoMode::HBPackets) { + bool isOk = mTimeFrameStartRecords[chipId].update(mFirstOrbitInTF, bunchCrossing); + if (!isOk && mErrorCount < MCH_DECODER_MAX_ERROR_COUNT) { auto s = asString(dsElecId); LOGP(warning, "Bad HeartBeat packet received: {}-CHIP{} {}/{} (last {}/{})", s, chip, mFirstOrbitInTF, bunchCrossing, mTimeFrameStartRecords[chipId].mOrbitPrev, mTimeFrameStartRecords[chipId].mBunchCrossingPrev);