Skip to content

Commit b0cec48

Browse files
sawenzelclaude
andcommitted
Let the MCH digitiser accept a timeframe without collisions
This fixes a segmentation fault in MCHDPLDigitizerTask when the collision context of a timeframe is empty. - The noise-only signal range was taken from eventRecords.front() and eventRecords.back(), which is undefined behaviour on an empty vector. - A timeframe holds no collision whenever the interaction rate is low. - The range now comes from HBFUtils in that case, so the noise covers the timeframe that is actually being digitised. https://its.cern.ch/jira/browse/O2-7132 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
1 parent 98a5696 commit b0cec48

1 file changed

Lines changed: 15 additions & 3 deletions

File tree

Steer/DigitizerWorkflow/src/MCHDigitizerSpec.cxx

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include "DataFormatsMCH/ROFRecord.h"
1616
#include "DataFormatsParameters/GRPObject.h"
1717
#include "DetectorsBase/BaseDPLDigitizer.h"
18+
#include "DetectorsRaw/HBFUtils.h"
1819
#include "Framework/ConfigParamRegistry.h"
1920
#include "Framework/ControlService.h"
2021
#include "Framework/DataProcessorSpec.h"
@@ -102,9 +103,20 @@ class MCHDPLDigitizerTask : public o2::base::BaseDPLDigitizer
102103
}
103104
}
104105

105-
// generate noise-only signals between first and last collisions ± 100 BC (= 25 ADC samples)
106-
auto firstIR = InteractionRecord::long2IR(std::max(int64_t(0), eventRecords.front().toLong() - timeOffset - 100));
107-
auto lastIR = InteractionRecord::long2IR(std::max(int64_t(0), eventRecords.back().toLong() - timeOffset + 100));
106+
// 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();
117+
}
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));
108120
mDigitizer->addNoise(firstIR, lastIR);
109121

110122
// digitize

0 commit comments

Comments
 (0)