Skip to content

Commit 86c4a93

Browse files
committed
small changes in handling empty TF
1 parent aec41d2 commit 86c4a93

3 files changed

Lines changed: 16 additions & 17 deletions

File tree

Detectors/MUON/MCH/IO/src/DigitReaderSpec.cxx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,11 @@ class DigitsReaderDeviceDPL
152152
// get the IR frames to select
153153
auto irFrames = pc.inputs().get<gsl::span<dataformats::IRFrame>>("driverInfo");
154154

155-
if (!irFrames.empty()) {
155+
if (mTreeReader.GetEntries() == 0) {
156+
// A timeframe holds no collision at all whenever the interaction rate is low enough, and the
157+
// digit tree then has no entry. Nothing to select. Send empty containers.
158+
LOG(info) << "digit tree has no entry, sending empty output";
159+
} else if (!irFrames.empty()) {
156160
utils::IRFrameSelector irfSel{};
157161
irfSel.setSelectedIRFrames(irFrames, 0, 0, -mTimeOffset, true);
158162
const auto irMin = irfSel.getIRFrames().front().getMin();

Detectors/MUON/MID/Workflow/src/DigitReaderSpec.cxx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,11 @@ class DigitsReaderDeviceDPL
146146
// get the IR frames to select
147147
auto irFrames = pc.inputs().get<gsl::span<dataformats::IRFrame>>("driverInfo");
148148

149-
if (!irFrames.empty()) {
149+
if (mTreeReader.GetEntries() == 0) {
150+
// A timeframe holds no collision at all whenever the interaction rate is low enough, and the
151+
// digit tree then has no entry. Nothing to select. Send empty containers.
152+
LOG(info) << "digit tree has no entry, sending empty output";
153+
} else if (!irFrames.empty()) {
150154
utils::IRFrameSelector irfSel{};
151155
irfSel.setSelectedIRFrames(irFrames, 0, 0, 0, true);
152156
const auto irMin = irfSel.getIRFrames().front().getMin();

Steer/DigitizerWorkflow/src/MCHDigitizerSpec.cxx

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
#include "DataFormatsMCH/ROFRecord.h"
1616
#include "DataFormatsParameters/GRPObject.h"
1717
#include "DetectorsBase/BaseDPLDigitizer.h"
18-
#include "DetectorsRaw/HBFUtils.h"
1918
#include "Framework/ConfigParamRegistry.h"
2019
#include "Framework/ControlService.h"
2120
#include "Framework/DataProcessorSpec.h"
@@ -63,7 +62,7 @@ class MCHDPLDigitizerTask : public o2::base::BaseDPLDigitizer
6362
if (labels.getIndexedSize() != digits.size()) {
6463
LOGP(error, "Number of labels != number of digits");
6564
}
66-
LOGP(info, "Number of signal pileup : {} ({} %)", nPileup, 100. * nPileup / digits.size());
65+
LOGP(info, "Number of signal pileup : {} ({} %)", nPileup, digits.empty() ? 0. : 100.* nPileup / digits.size());
6766
auto tEnd = std::chrono::high_resolution_clock::now();
6867
auto duration = tEnd - start;
6968
auto d = std::chrono::duration_cast<std::chrono::milliseconds>(duration).count();
@@ -104,20 +103,12 @@ class MCHDPLDigitizerTask : public o2::base::BaseDPLDigitizer
104103
}
105104

106105
// generate noise-only signals between first and last collisions ± 100 BC (= 25 ADC samples).
107-
// A timeframe can hold no collision at all when the interaction rate is low; take the range
108-
// from the timeframe itself in that case, since there are no collisions to take it from.
109-
int64_t firstLong, lastLong;
110-
if (eventRecords.empty()) {
111-
const auto& hbf = o2::raw::HBFUtils::Instance();
112-
firstLong = InteractionRecord(0, hbf.orbitFirstSampled).toLong();
113-
lastLong = InteractionRecord(0, hbf.orbitFirstSampled + hbf.nHBFPerTF).toLong();
114-
} else {
115-
firstLong = eventRecords.front().toLong();
116-
lastLong = eventRecords.back().toLong();
106+
// A timeframe can hold no collision at all when the interaction rate is low; skip it in that case.
107+
if (!eventRecords.empty()) {
108+
auto firstIR = InteractionRecord::long2IR(std::max(int64_t(0), eventRecords.front().toLong() - timeOffset - 100));
109+
auto lastIR = InteractionRecord::long2IR(std::max(int64_t(0), eventRecords.back().toLong() - timeOffset + 100));
110+
mDigitizer->addNoise(firstIR, lastIR);
117111
}
118-
auto firstIR = InteractionRecord::long2IR(std::max(int64_t(0), firstLong - timeOffset - 100));
119-
auto lastIR = InteractionRecord::long2IR(std::max(int64_t(0), lastLong - timeOffset + 100));
120-
mDigitizer->addNoise(firstIR, lastIR);
121112

122113
// digitize
123114
std::vector<Digit> digits{};

0 commit comments

Comments
 (0)