From c23cfd2861a648e0a5fb4c0439aa885ff26ee727 Mon Sep 17 00:00:00 2001 From: Maximiliano Puccio Date: Fri, 20 Dec 2024 14:13:35 +0100 Subject: [PATCH] Fix injection gap math (#1859) * Fix injection gap math The change introduced in #1431 had the side effect that no signal events were present in recent productions using this generator, as for operator precedence one could never satisfy the condition of the if regulating the generation of signal events. * Further simplify the code --- MC/config/PWGLF/pythia8/generator_pythia8_LF.C | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/MC/config/PWGLF/pythia8/generator_pythia8_LF.C b/MC/config/PWGLF/pythia8/generator_pythia8_LF.C index 9b1d0f459..f2befb6e6 100644 --- a/MC/config/PWGLF/pythia8/generator_pythia8_LF.C +++ b/MC/config/PWGLF/pythia8/generator_pythia8_LF.C @@ -161,14 +161,7 @@ class GeneratorPythia8LF : public o2::eventgen::GeneratorPythia8 LOG(info) << "Using config container "; cfg.print(); if (mUseTriggering) { // Do the triggering - bool doSignal = true; // Do signal or gap - if (mGapBetweenInjection > 0) { - if (mGapBetweenInjection == 1 && mEventCounter % 2 == 0) { - doSignal = false; - } else if (mEventCounter % mGapBetweenInjection + 1 != 0) { - doSignal = false; - } - } + bool doSignal{mEventCounter % (mGapBetweenInjection + 1) == 0}; // Do signal or gap if (doSignal) { LOG(info) << "Generating triggered signal event for particle";