diff --git a/core/detectors/rich/CbmMcbm2018RichPar.cxx b/core/detectors/rich/CbmMcbm2018RichPar.cxx index 6a92b499a72a8b32c27f6bf8794be07126109a89..16ab08a7f383b8ed972f165d83d1c4c941c63ed7 100644 --- a/core/detectors/rich/CbmMcbm2018RichPar.cxx +++ b/core/detectors/rich/CbmMcbm2018RichPar.cxx @@ -67,15 +67,17 @@ void CbmMcbm2018RichPar::LoadInternalContainers() } } -Int_t CbmMcbm2018RichPar::GetAddressIdx(Int_t addr) const +Int_t CbmMcbm2018RichPar::GetAddressIdx(Int_t addr, bool bVerbose) const { auto it = fTRBaddrMap.find(addr); if (fTRBaddrMap.end() == it) { - LOG(warning) << "CbmMcbm2018RichPar::GetAddressIdx => Unknown TRB address 0x" << std::hex << std::setw(4) << addr - << std::dec << ", probably corrupted data!"; - LOG(warning) << "Nb available TRB addresses: " << GetNaddresses(); + if (bVerbose) { + LOG(warning) << "CbmMcbm2018RichPar::GetAddressIdx => Unknown TRB address 0x" << std::hex << std::setw(4) << addr + << std::dec << ", probably corrupted data!"; + LOG(warning) << "Nb available TRB addresses: " << GetNaddresses(); - Print(); + Print(); + } return -1; } diff --git a/core/detectors/rich/CbmMcbm2018RichPar.h b/core/detectors/rich/CbmMcbm2018RichPar.h index d2bcdb27e3b9cd162bab183b6c2b2d8f93b9535d..13a9350771193d80738765218a0bebd6f6aa2478 100644 --- a/core/detectors/rich/CbmMcbm2018RichPar.h +++ b/core/detectors/rich/CbmMcbm2018RichPar.h @@ -40,7 +40,7 @@ public: public: Int_t GetNaddresses(void) const { return fTRBaddresses.GetSize(); } - Int_t GetAddressIdx(Int_t addr) const; + Int_t GetAddressIdx(Int_t addr, bool bVerbose = true) const; Int_t GetAddress(Int_t ind) const; diff --git a/reco/detectors/rich/unpack/CbmRichUnpackAlgo2022.cxx b/reco/detectors/rich/unpack/CbmRichUnpackAlgo2022.cxx index d40f0c5abab4dd754144bb7cde53bb0e69e664f2..b84cd2c388e5f6280cb733a25abbadf8ec6e00e6 100644 --- a/reco/detectors/rich/unpack/CbmRichUnpackAlgo2022.cxx +++ b/reco/detectors/rich/unpack/CbmRichUnpackAlgo2022.cxx @@ -193,16 +193,34 @@ void CbmRichUnpackAlgo2022::processSubSubEvent(CbmRichUnpackAlgoMicrosliceReader bool DiRICH_masked = false; if (checkMaskedDiRICH(subSubEventId)) { DiRICH_masked = true; } + // catch unknown DiRICH addresses (Corrupt data or CTS) + // TODO: properly handle/skip CTS subsubevents + bool DiRICH_unknown = false; + if (-1 == fUnpackPar.GetAddressIdx(subSubEventId, false)) { + DiRICH_unknown = true; + if (0x8000 != (subSubEventId & 0xF000)) { + // No log for CTS subsubevents + LOG(debug) << "Unknown DiRICH ID 0x" << std::hex << subSubEventId << std::dec; + } + } + for (int i = 0; i < nofTimeWords; i++) { uint32_t word = reader.NextWord(); - if (DiRICH_masked) continue; + // Skip masked/unknown DiRICH + if (DiRICH_masked || DiRICH_unknown) continue; CbmRichUnpackAlgoTdcWordType type = CbmRichUnpackAlgoTdcWordReader::GetTdcWordType(word); if (type == CbmRichUnpackAlgoTdcWordType::TimeData) { if (!wasHeader || !wasEpoch || wasTrailer) { - LOG(error) << getLogHeader(reader) << "DiRICH 0x" << std::hex << subSubEventId << std::dec - << ": illegal position of TDC Time (before header/epoch or after trailer)"; + LOG(debug) << getLogHeader(reader) << "DiRICH 0x" << std::hex << subSubEventId << std::dec + << ": illegal position of TDC Time (before header/epoch or after trailer), skip subsubevent" + << " " << wasHeader << "|" << wasEpoch << "|" << wasTrailer; errorInData = true; + // Currently skip the subsubevent + // TODO: Check if possible to only skip to next Epoch and continue from there + for (; i < nofTimeWords - 1; i++) { + reader.NextWord(); + } continue; } wasTime = true; @@ -210,9 +228,14 @@ void CbmRichUnpackAlgo2022::processSubSubEvent(CbmRichUnpackAlgoMicrosliceReader } else if (type == CbmRichUnpackAlgoTdcWordType::Epoch) { if (!wasHeader || wasTrailer) { - LOG(error) << getLogHeader(reader) << "DiRICH 0x" << std::hex << subSubEventId << std::dec - << ": illegal position of TDC Epoch (before header or after trailer)"; + LOG(debug) << getLogHeader(reader) << "DiRICH 0x" << std::hex << subSubEventId << std::dec + << ": illegal position of TDC Epoch (before header or after trailer), skip subsubevent"; errorInData = true; + // Currently skip the subsubevent + // TODO: Check if possible to only skip to next Epoch and continue from there + for (; i < nofTimeWords - 1; i++) { + reader.NextWord(); + } continue; } wasEpoch = true; @@ -221,9 +244,12 @@ void CbmRichUnpackAlgo2022::processSubSubEvent(CbmRichUnpackAlgoMicrosliceReader } else if (type == CbmRichUnpackAlgoTdcWordType::Header) { if (wasEpoch || wasTime || wasTrailer) { - LOG(error) << getLogHeader(reader) << "DiRICH 0x" << std::hex << subSubEventId << std::dec - << ": illegal position of TDC Header (after time/epoch/trailer)"; + LOG(debug) << getLogHeader(reader) << "DiRICH 0x" << std::hex << subSubEventId << std::dec + << ": illegal position of TDC Header (after time/epoch/trailer), skip subsubevent"; errorInData = true; + for (; i < nofTimeWords - 1; i++) { + reader.NextWord(); + } continue; } wasHeader = true; @@ -233,9 +259,12 @@ void CbmRichUnpackAlgo2022::processSubSubEvent(CbmRichUnpackAlgoMicrosliceReader } else if (type == CbmRichUnpackAlgoTdcWordType::Trailer) { if (!wasEpoch || !wasTime || !wasHeader) { - LOG(error) << getLogHeader(reader) << "DiRICH 0x" << std::hex << subSubEventId << std::dec - << ": illegal position of TDC Trailer (before time/epoch/header)"; + LOG(debug) << getLogHeader(reader) << "DiRICH 0x" << std::hex << subSubEventId << std::dec + << ": illegal position of TDC Trailer (before time/epoch/header), skip subsubevent"; errorInData = true; + for (; i < nofTimeWords - 1; i++) { + reader.NextWord(); + } continue; } wasTrailer = true;