From 704b321b65d8d3a3e8654e05cc0a431e20cedfe4 Mon Sep 17 00:00:00 2001 From: Marco Giacalone Date: Thu, 3 Sep 2026 13:25:40 +0200 Subject: [PATCH] Add protection against skipped loopers --- Generators/src/Generator.cxx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Generators/src/Generator.cxx b/Generators/src/Generator.cxx index 4e6f6dc91a723..7984f4f800206 100644 --- a/Generators/src/Generator.cxx +++ b/Generators/src/Generator.cxx @@ -248,12 +248,19 @@ Bool_t LOG(error) << "Failed to generate loopers event"; return kFALSE; } - if (mTPCLoopersGen->getNLoopers() == 0) { + const auto nCandidates = mTPCLoopersGen->getNLoopers(); + if (nCandidates == 0) { LOG(warning) << "No loopers generated for this event"; return kTRUE; } const auto& looperParticles = mTPCLoopersGen->importParticles(); + const auto skippedLoopers = mTPCLoopersGen->getNSkipped(); if (looperParticles.empty()) { + if (skippedLoopers == nCandidates) { + // all candidate loopers were dropped by the geometrical protection + LOG(debug) << "All " << skippedLoopers << " candidate loopers were outside the TPC active volume; none added for this event"; + return kTRUE; + } LOG(error) << "Failed to import loopers particles"; return kFALSE; } @@ -261,7 +268,6 @@ Bool_t mParticles.insert(mParticles.end(), looperParticles.begin(), looperParticles.end()); LOG(debug) << "Added " << looperParticles.size() << " looper particles"; - const auto skippedLoopers = mTPCLoopersGen->getNSkipped(); if (skippedLoopers > 0) { LOG(debug) << "Geometrical protection skipped " << skippedLoopers << " loopers outside the TPC active volume"; }