From 47ff46de1eac0ec4a66d99f88d1422ca66ae0773 Mon Sep 17 00:00:00 2001 From: Maximiliano Puccio Date: Thu, 19 Dec 2024 16:51:13 +0100 Subject: [PATCH 1/2] 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. --- MC/config/PWGLF/pythia8/generator_pythia8_LF.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MC/config/PWGLF/pythia8/generator_pythia8_LF.C b/MC/config/PWGLF/pythia8/generator_pythia8_LF.C index 9b1d0f459..1d7626962 100644 --- a/MC/config/PWGLF/pythia8/generator_pythia8_LF.C +++ b/MC/config/PWGLF/pythia8/generator_pythia8_LF.C @@ -165,7 +165,7 @@ class GeneratorPythia8LF : public o2::eventgen::GeneratorPythia8 if (mGapBetweenInjection > 0) { if (mGapBetweenInjection == 1 && mEventCounter % 2 == 0) { doSignal = false; - } else if (mEventCounter % mGapBetweenInjection + 1 != 0) { + } else if (mEventCounter % (mGapBetweenInjection + 1) != 0) { doSignal = false; } } From 79a0671274198332a012e9408a2a50915a38651f Mon Sep 17 00:00:00 2001 From: Maximiliano Puccio Date: Thu, 19 Dec 2024 17:26:36 +0100 Subject: [PATCH 2/2] 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 1d7626962..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";