diff --git a/Detectors/MUON/MCH/IO/src/DigitReaderSpec.cxx b/Detectors/MUON/MCH/IO/src/DigitReaderSpec.cxx index af13460a42dd0..f7e13767476b1 100644 --- a/Detectors/MUON/MCH/IO/src/DigitReaderSpec.cxx +++ b/Detectors/MUON/MCH/IO/src/DigitReaderSpec.cxx @@ -152,7 +152,11 @@ class DigitsReaderDeviceDPL // get the IR frames to select auto irFrames = pc.inputs().get>("driverInfo"); - if (!irFrames.empty()) { + if (mTreeReader.GetEntries() == 0) { + // A timeframe holds no collision at all whenever the interaction rate is low enough, and the + // digit tree then has no entry. Nothing to select. Send empty containers. + LOG(info) << "digit tree has no entry, sending empty output"; + } else if (!irFrames.empty()) { utils::IRFrameSelector irfSel{}; irfSel.setSelectedIRFrames(irFrames, 0, 0, -mTimeOffset, true); const auto irMin = irfSel.getIRFrames().front().getMin(); diff --git a/Detectors/MUON/MID/Workflow/src/DigitReaderSpec.cxx b/Detectors/MUON/MID/Workflow/src/DigitReaderSpec.cxx index 0479452bcd6f5..83d363b290cf8 100644 --- a/Detectors/MUON/MID/Workflow/src/DigitReaderSpec.cxx +++ b/Detectors/MUON/MID/Workflow/src/DigitReaderSpec.cxx @@ -146,7 +146,11 @@ class DigitsReaderDeviceDPL // get the IR frames to select auto irFrames = pc.inputs().get>("driverInfo"); - if (!irFrames.empty()) { + if (mTreeReader.GetEntries() == 0) { + // A timeframe holds no collision at all whenever the interaction rate is low enough, and the + // digit tree then has no entry. Nothing to select. Send empty containers. + LOG(info) << "digit tree has no entry, sending empty output"; + } else if (!irFrames.empty()) { utils::IRFrameSelector irfSel{}; irfSel.setSelectedIRFrames(irFrames, 0, 0, 0, true); const auto irMin = irfSel.getIRFrames().front().getMin(); diff --git a/Steer/DigitizerWorkflow/src/MCHDigitizerSpec.cxx b/Steer/DigitizerWorkflow/src/MCHDigitizerSpec.cxx index 51102ce2421ca..f4685c9bbe0fd 100644 --- a/Steer/DigitizerWorkflow/src/MCHDigitizerSpec.cxx +++ b/Steer/DigitizerWorkflow/src/MCHDigitizerSpec.cxx @@ -15,7 +15,6 @@ #include "DataFormatsMCH/ROFRecord.h" #include "DataFormatsParameters/GRPObject.h" #include "DetectorsBase/BaseDPLDigitizer.h" -#include "DetectorsRaw/HBFUtils.h" #include "Framework/ConfigParamRegistry.h" #include "Framework/ControlService.h" #include "Framework/DataProcessorSpec.h" @@ -63,7 +62,7 @@ class MCHDPLDigitizerTask : public o2::base::BaseDPLDigitizer if (labels.getIndexedSize() != digits.size()) { LOGP(error, "Number of labels != number of digits"); } - LOGP(info, "Number of signal pileup : {} ({} %)", nPileup, 100. * nPileup / digits.size()); + LOGP(info, "Number of signal pileup : {} ({} %)", nPileup, digits.empty() ? 0. : 100. * nPileup / digits.size()); auto tEnd = std::chrono::high_resolution_clock::now(); auto duration = tEnd - start; auto d = std::chrono::duration_cast(duration).count(); @@ -104,20 +103,12 @@ class MCHDPLDigitizerTask : public o2::base::BaseDPLDigitizer } // generate noise-only signals between first and last collisions ± 100 BC (= 25 ADC samples). - // A timeframe can hold no collision at all when the interaction rate is low; take the range - // from the timeframe itself in that case, since there are no collisions to take it from. - int64_t firstLong, lastLong; - if (eventRecords.empty()) { - const auto& hbf = o2::raw::HBFUtils::Instance(); - firstLong = InteractionRecord(0, hbf.orbitFirstSampled).toLong(); - lastLong = InteractionRecord(0, hbf.orbitFirstSampled + hbf.nHBFPerTF).toLong(); - } else { - firstLong = eventRecords.front().toLong(); - lastLong = eventRecords.back().toLong(); + // A timeframe can hold no collision at all when the interaction rate is low; skip it in that case. + if (!eventRecords.empty()) { + auto firstIR = InteractionRecord::long2IR(std::max(int64_t(0), eventRecords.front().toLong() - timeOffset - 100)); + auto lastIR = InteractionRecord::long2IR(std::max(int64_t(0), eventRecords.back().toLong() - timeOffset + 100)); + mDigitizer->addNoise(firstIR, lastIR); } - auto firstIR = InteractionRecord::long2IR(std::max(int64_t(0), firstLong - timeOffset - 100)); - auto lastIR = InteractionRecord::long2IR(std::max(int64_t(0), lastLong - timeOffset + 100)); - mDigitizer->addNoise(firstIR, lastIR); // digitize std::vector digits{};