Skip to content

Commit e8910de

Browse files
sawenzelclaude
andcommitted
Let the TPC digitiser accept a timeframe without collisions
This fixes a crash of the TPC digitiser when a timeframe holds no collision. - process() returned as soon as the collision context was empty, so with --tpc-chunked-writer, which is what the MC workflow uses, the caller then wrote through a null tree pointer and the device segfaulted. - The sector now runs through its normal final flush and writes one empty entry, giving the digit file the shape of an ordinary timeframe that happens to contain nothing. - setStartTime read the first interaction record without checking that there is one. https://its.cern.ch/jira/browse/O2-7132 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
1 parent 998e066 commit e8910de

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

Steer/DigitizerWorkflow/src/TPCDigitizerSpec.cxx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -287,10 +287,11 @@ class TPCDPLDigitizerTask : public BaseDPLDigitizer
287287
auto context = pc.inputs().get<o2::steer::DigitizationContext*>(inputref);
288288
context->initSimChains(o2::detectors::DetID::TPC, mSimChains);
289289
auto& irecords = context->getEventRecords();
290+
// A timeframe holds no collision at all whenever the interaction rate is low enough. Do not
291+
// return here: the sector still has to produce its usual output, an empty one, so that the
292+
// digit file has the same shape as an ordinary timeframe that happens to contain nothing.
293+
// Returning also left the chunked writer without a file and a null tree to flush.
290294
LOG(info) << "TPC: Processing " << irecords.size() << " collisions";
291-
if (irecords.size() == 0) {
292-
return;
293-
}
294295
auto const* dh = DataRefUtils::getHeader<o2::header::DataHeader*>(inputref);
295296

296297
bool isContinuous = mDigitizer.isContinuousReadout();
@@ -411,7 +412,9 @@ class TPCDPLDigitizerTask : public BaseDPLDigitizer
411412
auto& hbfu = o2::raw::HBFUtils::Instance();
412413
double time = hbfu.getFirstIRofTF(o2::InteractionRecord(0, hbfu.orbitFirstSampled)).bc2ns() / 1000.;
413414
mDigitizer.setOutputDigitTimeOffset(time);
414-
mDigitizer.setStartTime(irecords[0].getTimeNS() / 1000.f);
415+
if (!irecords.empty()) {
416+
mDigitizer.setStartTime(irecords[0].getTimeNS() / 1000.f);
417+
}
415418
}
416419

417420
TStopwatch timer;

0 commit comments

Comments
 (0)