From d66d31ce1d385e201e3db2f535246bbfd97fe822 Mon Sep 17 00:00:00 2001 From: ldellost Date: Mon, 16 Nov 2026 16:40:32 +0000 Subject: [PATCH 1/8] Lstar ini files for gap trigger 3 and 4 --- .../PWGLF/ini/GeneratorLF_Strangeness_ppLStar_gap3.ini | 6 ++++++ .../PWGLF/ini/GeneratorLF_Strangeness_ppLStar_gap4.ini | 6 ++++++ 2 files changed, 12 insertions(+) create mode 100644 MC/config/PWGLF/ini/GeneratorLF_Strangeness_ppLStar_gap3.ini create mode 100644 MC/config/PWGLF/ini/GeneratorLF_Strangeness_ppLStar_gap4.ini diff --git a/MC/config/PWGLF/ini/GeneratorLF_Strangeness_ppLStar_gap3.ini b/MC/config/PWGLF/ini/GeneratorLF_Strangeness_ppLStar_gap3.ini new file mode 100644 index 000000000..b69b956c1 --- /dev/null +++ b/MC/config/PWGLF/ini/GeneratorLF_Strangeness_ppLStar_gap3.ini @@ -0,0 +1,6 @@ +[GeneratorExternal] +fileName=${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator_pythia8_Lstar.C +funcName=generator_Lstar(3) + +[GeneratorPythia8] +config=${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/pythia8_inel_forceLStar.cfg \ No newline at end of file diff --git a/MC/config/PWGLF/ini/GeneratorLF_Strangeness_ppLStar_gap4.ini b/MC/config/PWGLF/ini/GeneratorLF_Strangeness_ppLStar_gap4.ini new file mode 100644 index 000000000..d2d6f62fa --- /dev/null +++ b/MC/config/PWGLF/ini/GeneratorLF_Strangeness_ppLStar_gap4.ini @@ -0,0 +1,6 @@ +[GeneratorExternal] +fileName=${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator_pythia8_Lstar.C +funcName=generator_Lstar(4) + +[GeneratorPythia8] +config=${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/pythia8_inel_forceLStar.cfg \ No newline at end of file From 5b5dccfd2559858ca6d0edb60a6784193d657a2e Mon Sep 17 00:00:00 2001 From: ldellost Date: Mon, 16 Nov 2026 16:48:48 +0000 Subject: [PATCH 2/8] test files --- .../GeneratorLF_Strangeness_ppLStar_gap3.C | 95 +++++++++++++++++++ .../GeneratorLF_Strangeness_ppLStar_gap4.C | 95 +++++++++++++++++++ 2 files changed, 190 insertions(+) create mode 100644 MC/config/PWGLF/ini/tests/GeneratorLF_Strangeness_ppLStar_gap3.C create mode 100644 MC/config/PWGLF/ini/tests/GeneratorLF_Strangeness_ppLStar_gap4.C diff --git a/MC/config/PWGLF/ini/tests/GeneratorLF_Strangeness_ppLStar_gap3.C b/MC/config/PWGLF/ini/tests/GeneratorLF_Strangeness_ppLStar_gap3.C new file mode 100644 index 000000000..478e29ff4 --- /dev/null +++ b/MC/config/PWGLF/ini/tests/GeneratorLF_Strangeness_ppLStar_gap3.C @@ -0,0 +1,95 @@ +int External() +{ + std::string path{"o2sim_Kine.root"}; + const int pdgMother = 3124; // Lambda(1520)0 + const int triggerRatio = 3; // must match generator_Lstar(N) in the .ini file + + TFile file(path.c_str(), "READ"); + if (file.IsZombie()) { + std::cerr << "Cannot open ROOT file " << path << "\n"; + return 1; + } + auto tree = (TTree *)file.Get("o2sim"); + if (!tree) { + std::cerr << "Cannot find tree o2sim in file " << path << "\n"; + return 1; + } + std::vector *tracks{}; + tree->SetBranchAddress("MCTrack", &tracks); + + const auto nEvents = tree->GetEntries(); + int nMother = 0; + int nNotDecayed = 0; + int nBadDecay = 0; // mothers not decaying exactly to Lambda + gamma + int nEventsWrongCount = 0; // events with the wrong number of injected mothers + int nGapEvents = 0; // events expected to contain the injected mother + + for (int i = 0; i < nEvents; i++) { + tree->GetEntry(i); + + // the generator injects in every triggerRatio-th event (it counts events from 1) + const bool isGapEvent = ((i + 1) % triggerRatio == 0); + if (isGapEvent) { + nGapEvents++; + } + + int nInEvent = 0; + for (auto &track : *tracks) { + const int pdg = track.GetPdgCode(); + if (std::abs(pdg) != pdgMother) { + continue; + } + nInEvent++; + nMother++; + + if (track.getFirstDaughterTrackId() < 0) { + nNotDecayed++; + continue; + } + const int expectedLambda = (pdg > 0) ? 3122 : -3122; + int nLambda = 0, nGamma = 0, nDau = 0; + for (int j = track.getFirstDaughterTrackId(); j <= track.getLastDaughterTrackId(); ++j) { + const int pdgDau = tracks->at(j).GetPdgCode(); + nDau++; + if (pdgDau == expectedLambda) nLambda++; + if (pdgDau == 22) nGamma++; + } + if (nDau != 2 || nLambda != 1 || nGamma != 1) { + nBadDecay++; + std::cerr << "Unexpected decay of " << pdg << " (" << nDau << " daughters)\n"; + } + } + + const int nExpected = isGapEvent ? 1 : 0; + if (nInEvent != nExpected) { + nEventsWrongCount++; + std::cerr << "Event " << i << ": found " << nInEvent + << " Lambda(1520), expected " << nExpected << "\n"; + } + } + + std::cout << "--------------------------------\n"; + std::cout << "# Events: " << nEvents << "\n"; + std::cout << "# Gap-trigger events: " << nGapEvents << " (ratio " << triggerRatio << ")\n"; + std::cout << "# Lambda(1520) + anti: " << nMother << "\n"; + std::cout << "# not decayed: " << nNotDecayed << "\n"; + std::cout << "# unexpected decays: " << nBadDecay << "\n"; + std::cout << "# events wrong count: " << nEventsWrongCount << "\n"; + std::cout << "--------------------------------\n"; + + if (nMother != nGapEvents) { + std::cerr << "Expected one injected Lambda(1520) per gap-trigger event\n"; + return 1; + } + if (nEventsWrongCount > 0) { + std::cerr << "Lambda(1520) must appear in every gap-triggered events\n"; + return 1; + } + if (nNotDecayed > 0 || nBadDecay > 0) { + std::cerr << "Lambda(1520) must always decay to Lambda + gamma\n"; + return 1; + } + return 0; +} + +void GeneratorLF_Strangeness_ppLStar() { External(); } \ No newline at end of file diff --git a/MC/config/PWGLF/ini/tests/GeneratorLF_Strangeness_ppLStar_gap4.C b/MC/config/PWGLF/ini/tests/GeneratorLF_Strangeness_ppLStar_gap4.C new file mode 100644 index 000000000..f214baed9 --- /dev/null +++ b/MC/config/PWGLF/ini/tests/GeneratorLF_Strangeness_ppLStar_gap4.C @@ -0,0 +1,95 @@ +int External() +{ + std::string path{"o2sim_Kine.root"}; + const int pdgMother = 3124; // Lambda(1520)0 + const int triggerRatio = 4; // must match generator_Lstar(N) in the .ini file + + TFile file(path.c_str(), "READ"); + if (file.IsZombie()) { + std::cerr << "Cannot open ROOT file " << path << "\n"; + return 1; + } + auto tree = (TTree *)file.Get("o2sim"); + if (!tree) { + std::cerr << "Cannot find tree o2sim in file " << path << "\n"; + return 1; + } + std::vector *tracks{}; + tree->SetBranchAddress("MCTrack", &tracks); + + const auto nEvents = tree->GetEntries(); + int nMother = 0; + int nNotDecayed = 0; + int nBadDecay = 0; // mothers not decaying exactly to Lambda + gamma + int nEventsWrongCount = 0; // events with the wrong number of injected mothers + int nGapEvents = 0; // events expected to contain the injected mother + + for (int i = 0; i < nEvents; i++) { + tree->GetEntry(i); + + // the generator injects in every triggerRatio-th event (it counts events from 1) + const bool isGapEvent = ((i + 1) % triggerRatio == 0); + if (isGapEvent) { + nGapEvents++; + } + + int nInEvent = 0; + for (auto &track : *tracks) { + const int pdg = track.GetPdgCode(); + if (std::abs(pdg) != pdgMother) { + continue; + } + nInEvent++; + nMother++; + + if (track.getFirstDaughterTrackId() < 0) { + nNotDecayed++; + continue; + } + const int expectedLambda = (pdg > 0) ? 3122 : -3122; + int nLambda = 0, nGamma = 0, nDau = 0; + for (int j = track.getFirstDaughterTrackId(); j <= track.getLastDaughterTrackId(); ++j) { + const int pdgDau = tracks->at(j).GetPdgCode(); + nDau++; + if (pdgDau == expectedLambda) nLambda++; + if (pdgDau == 22) nGamma++; + } + if (nDau != 2 || nLambda != 1 || nGamma != 1) { + nBadDecay++; + std::cerr << "Unexpected decay of " << pdg << " (" << nDau << " daughters)\n"; + } + } + + const int nExpected = isGapEvent ? 1 : 0; + if (nInEvent != nExpected) { + nEventsWrongCount++; + std::cerr << "Event " << i << ": found " << nInEvent + << " Lambda(1520), expected " << nExpected << "\n"; + } + } + + std::cout << "--------------------------------\n"; + std::cout << "# Events: " << nEvents << "\n"; + std::cout << "# Gap-trigger events: " << nGapEvents << " (ratio " << triggerRatio << ")\n"; + std::cout << "# Lambda(1520) + anti: " << nMother << "\n"; + std::cout << "# not decayed: " << nNotDecayed << "\n"; + std::cout << "# unexpected decays: " << nBadDecay << "\n"; + std::cout << "# events wrong count: " << nEventsWrongCount << "\n"; + std::cout << "--------------------------------\n"; + + if (nMother != nGapEvents) { + std::cerr << "Expected one injected Lambda(1520) per gap-trigger event\n"; + return 1; + } + if (nEventsWrongCount > 0) { + std::cerr << "Lambda(1520) must appear in every gap-triggered events\n"; + return 1; + } + if (nNotDecayed > 0 || nBadDecay > 0) { + std::cerr << "Lambda(1520) must always decay to Lambda + gamma\n"; + return 1; + } + return 0; +} + +void GeneratorLF_Strangeness_ppLStar() { External(); } \ No newline at end of file From 157e4de408256e808ac0a5e5de3b800e0c625c59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Jacazio?= Date: Mon, 16 Nov 2026 17:52:41 +0100 Subject: [PATCH 3/8] Delete MC/config/PWGLF/ini/tests/GeneratorLF_Strangeness_ppLStar_gap3.C --- .../GeneratorLF_Strangeness_ppLStar_gap3.C | 95 ------------------- 1 file changed, 95 deletions(-) delete mode 100644 MC/config/PWGLF/ini/tests/GeneratorLF_Strangeness_ppLStar_gap3.C diff --git a/MC/config/PWGLF/ini/tests/GeneratorLF_Strangeness_ppLStar_gap3.C b/MC/config/PWGLF/ini/tests/GeneratorLF_Strangeness_ppLStar_gap3.C deleted file mode 100644 index 478e29ff4..000000000 --- a/MC/config/PWGLF/ini/tests/GeneratorLF_Strangeness_ppLStar_gap3.C +++ /dev/null @@ -1,95 +0,0 @@ -int External() -{ - std::string path{"o2sim_Kine.root"}; - const int pdgMother = 3124; // Lambda(1520)0 - const int triggerRatio = 3; // must match generator_Lstar(N) in the .ini file - - TFile file(path.c_str(), "READ"); - if (file.IsZombie()) { - std::cerr << "Cannot open ROOT file " << path << "\n"; - return 1; - } - auto tree = (TTree *)file.Get("o2sim"); - if (!tree) { - std::cerr << "Cannot find tree o2sim in file " << path << "\n"; - return 1; - } - std::vector *tracks{}; - tree->SetBranchAddress("MCTrack", &tracks); - - const auto nEvents = tree->GetEntries(); - int nMother = 0; - int nNotDecayed = 0; - int nBadDecay = 0; // mothers not decaying exactly to Lambda + gamma - int nEventsWrongCount = 0; // events with the wrong number of injected mothers - int nGapEvents = 0; // events expected to contain the injected mother - - for (int i = 0; i < nEvents; i++) { - tree->GetEntry(i); - - // the generator injects in every triggerRatio-th event (it counts events from 1) - const bool isGapEvent = ((i + 1) % triggerRatio == 0); - if (isGapEvent) { - nGapEvents++; - } - - int nInEvent = 0; - for (auto &track : *tracks) { - const int pdg = track.GetPdgCode(); - if (std::abs(pdg) != pdgMother) { - continue; - } - nInEvent++; - nMother++; - - if (track.getFirstDaughterTrackId() < 0) { - nNotDecayed++; - continue; - } - const int expectedLambda = (pdg > 0) ? 3122 : -3122; - int nLambda = 0, nGamma = 0, nDau = 0; - for (int j = track.getFirstDaughterTrackId(); j <= track.getLastDaughterTrackId(); ++j) { - const int pdgDau = tracks->at(j).GetPdgCode(); - nDau++; - if (pdgDau == expectedLambda) nLambda++; - if (pdgDau == 22) nGamma++; - } - if (nDau != 2 || nLambda != 1 || nGamma != 1) { - nBadDecay++; - std::cerr << "Unexpected decay of " << pdg << " (" << nDau << " daughters)\n"; - } - } - - const int nExpected = isGapEvent ? 1 : 0; - if (nInEvent != nExpected) { - nEventsWrongCount++; - std::cerr << "Event " << i << ": found " << nInEvent - << " Lambda(1520), expected " << nExpected << "\n"; - } - } - - std::cout << "--------------------------------\n"; - std::cout << "# Events: " << nEvents << "\n"; - std::cout << "# Gap-trigger events: " << nGapEvents << " (ratio " << triggerRatio << ")\n"; - std::cout << "# Lambda(1520) + anti: " << nMother << "\n"; - std::cout << "# not decayed: " << nNotDecayed << "\n"; - std::cout << "# unexpected decays: " << nBadDecay << "\n"; - std::cout << "# events wrong count: " << nEventsWrongCount << "\n"; - std::cout << "--------------------------------\n"; - - if (nMother != nGapEvents) { - std::cerr << "Expected one injected Lambda(1520) per gap-trigger event\n"; - return 1; - } - if (nEventsWrongCount > 0) { - std::cerr << "Lambda(1520) must appear in every gap-triggered events\n"; - return 1; - } - if (nNotDecayed > 0 || nBadDecay > 0) { - std::cerr << "Lambda(1520) must always decay to Lambda + gamma\n"; - return 1; - } - return 0; -} - -void GeneratorLF_Strangeness_ppLStar() { External(); } \ No newline at end of file From 7485a1f8098438e230facf7a6f9ee295be9b9fff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Jacazio?= Date: Mon, 16 Nov 2026 17:53:01 +0100 Subject: [PATCH 4/8] Delete MC/config/PWGLF/ini/tests/GeneratorLF_Strangeness_ppLStar_gap4.C --- .../GeneratorLF_Strangeness_ppLStar_gap4.C | 95 ------------------- 1 file changed, 95 deletions(-) delete mode 100644 MC/config/PWGLF/ini/tests/GeneratorLF_Strangeness_ppLStar_gap4.C diff --git a/MC/config/PWGLF/ini/tests/GeneratorLF_Strangeness_ppLStar_gap4.C b/MC/config/PWGLF/ini/tests/GeneratorLF_Strangeness_ppLStar_gap4.C deleted file mode 100644 index f214baed9..000000000 --- a/MC/config/PWGLF/ini/tests/GeneratorLF_Strangeness_ppLStar_gap4.C +++ /dev/null @@ -1,95 +0,0 @@ -int External() -{ - std::string path{"o2sim_Kine.root"}; - const int pdgMother = 3124; // Lambda(1520)0 - const int triggerRatio = 4; // must match generator_Lstar(N) in the .ini file - - TFile file(path.c_str(), "READ"); - if (file.IsZombie()) { - std::cerr << "Cannot open ROOT file " << path << "\n"; - return 1; - } - auto tree = (TTree *)file.Get("o2sim"); - if (!tree) { - std::cerr << "Cannot find tree o2sim in file " << path << "\n"; - return 1; - } - std::vector *tracks{}; - tree->SetBranchAddress("MCTrack", &tracks); - - const auto nEvents = tree->GetEntries(); - int nMother = 0; - int nNotDecayed = 0; - int nBadDecay = 0; // mothers not decaying exactly to Lambda + gamma - int nEventsWrongCount = 0; // events with the wrong number of injected mothers - int nGapEvents = 0; // events expected to contain the injected mother - - for (int i = 0; i < nEvents; i++) { - tree->GetEntry(i); - - // the generator injects in every triggerRatio-th event (it counts events from 1) - const bool isGapEvent = ((i + 1) % triggerRatio == 0); - if (isGapEvent) { - nGapEvents++; - } - - int nInEvent = 0; - for (auto &track : *tracks) { - const int pdg = track.GetPdgCode(); - if (std::abs(pdg) != pdgMother) { - continue; - } - nInEvent++; - nMother++; - - if (track.getFirstDaughterTrackId() < 0) { - nNotDecayed++; - continue; - } - const int expectedLambda = (pdg > 0) ? 3122 : -3122; - int nLambda = 0, nGamma = 0, nDau = 0; - for (int j = track.getFirstDaughterTrackId(); j <= track.getLastDaughterTrackId(); ++j) { - const int pdgDau = tracks->at(j).GetPdgCode(); - nDau++; - if (pdgDau == expectedLambda) nLambda++; - if (pdgDau == 22) nGamma++; - } - if (nDau != 2 || nLambda != 1 || nGamma != 1) { - nBadDecay++; - std::cerr << "Unexpected decay of " << pdg << " (" << nDau << " daughters)\n"; - } - } - - const int nExpected = isGapEvent ? 1 : 0; - if (nInEvent != nExpected) { - nEventsWrongCount++; - std::cerr << "Event " << i << ": found " << nInEvent - << " Lambda(1520), expected " << nExpected << "\n"; - } - } - - std::cout << "--------------------------------\n"; - std::cout << "# Events: " << nEvents << "\n"; - std::cout << "# Gap-trigger events: " << nGapEvents << " (ratio " << triggerRatio << ")\n"; - std::cout << "# Lambda(1520) + anti: " << nMother << "\n"; - std::cout << "# not decayed: " << nNotDecayed << "\n"; - std::cout << "# unexpected decays: " << nBadDecay << "\n"; - std::cout << "# events wrong count: " << nEventsWrongCount << "\n"; - std::cout << "--------------------------------\n"; - - if (nMother != nGapEvents) { - std::cerr << "Expected one injected Lambda(1520) per gap-trigger event\n"; - return 1; - } - if (nEventsWrongCount > 0) { - std::cerr << "Lambda(1520) must appear in every gap-triggered events\n"; - return 1; - } - if (nNotDecayed > 0 || nBadDecay > 0) { - std::cerr << "Lambda(1520) must always decay to Lambda + gamma\n"; - return 1; - } - return 0; -} - -void GeneratorLF_Strangeness_ppLStar() { External(); } \ No newline at end of file From a61cf2f5f256f08870062afa21efcf37025d8384 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Jacazio?= Date: Mon, 16 Nov 2026 17:54:17 +0100 Subject: [PATCH 5/8] Update GeneratorLF_Strangeness_ppLStar_gap3.ini --- MC/config/PWGLF/ini/GeneratorLF_Strangeness_ppLStar_gap3.ini | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/MC/config/PWGLF/ini/GeneratorLF_Strangeness_ppLStar_gap3.ini b/MC/config/PWGLF/ini/GeneratorLF_Strangeness_ppLStar_gap3.ini index b69b956c1..d96b90e48 100644 --- a/MC/config/PWGLF/ini/GeneratorLF_Strangeness_ppLStar_gap3.ini +++ b/MC/config/PWGLF/ini/GeneratorLF_Strangeness_ppLStar_gap3.ini @@ -1,6 +1,7 @@ +#---> GeneratorLF_Strangeness_ppLStar [GeneratorExternal] fileName=${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator_pythia8_Lstar.C funcName=generator_Lstar(3) [GeneratorPythia8] -config=${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/pythia8_inel_forceLStar.cfg \ No newline at end of file +config=${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/pythia8_inel_forceLStar.cfg From c4b086e67928253b65ce870e0fd03bbbc7f0c5da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Jacazio?= Date: Mon, 16 Nov 2026 17:54:33 +0100 Subject: [PATCH 6/8] Add comment header to GeneratorLF_Strangeness_ini file --- MC/config/PWGLF/ini/GeneratorLF_Strangeness_ppLStar_gap4.ini | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/MC/config/PWGLF/ini/GeneratorLF_Strangeness_ppLStar_gap4.ini b/MC/config/PWGLF/ini/GeneratorLF_Strangeness_ppLStar_gap4.ini index d2d6f62fa..3f57505d4 100644 --- a/MC/config/PWGLF/ini/GeneratorLF_Strangeness_ppLStar_gap4.ini +++ b/MC/config/PWGLF/ini/GeneratorLF_Strangeness_ppLStar_gap4.ini @@ -1,6 +1,7 @@ +#---> GeneratorLF_Strangeness_ppLStar [GeneratorExternal] fileName=${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator_pythia8_Lstar.C funcName=generator_Lstar(4) [GeneratorPythia8] -config=${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/pythia8_inel_forceLStar.cfg \ No newline at end of file +config=${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/pythia8_inel_forceLStar.cfg From 1940e6db3aad9668d45242ff1ac24b1099e5685d Mon Sep 17 00:00:00 2001 From: ldellost Date: Tue, 17 Nov 2026 08:25:39 +0000 Subject: [PATCH 7/8] generalize the test for different gap triggers --- .../tests/GeneratorLF_Strangeness_ppLStar.C | 56 ++++++++++++------- 1 file changed, 35 insertions(+), 21 deletions(-) diff --git a/MC/config/PWGLF/ini/tests/GeneratorLF_Strangeness_ppLStar.C b/MC/config/PWGLF/ini/tests/GeneratorLF_Strangeness_ppLStar.C index c69a84d5d..3b4982996 100644 --- a/MC/config/PWGLF/ini/tests/GeneratorLF_Strangeness_ppLStar.C +++ b/MC/config/PWGLF/ini/tests/GeneratorLF_Strangeness_ppLStar.C @@ -1,8 +1,7 @@ int External() { std::string path{"o2sim_Kine.root"}; - const int pdgMother = 3124; // Lambda(1520)0 - const int triggerRatio = 5; // must match generator_Lstar(N) in the .ini file + const int pdgMother = 3124; // Lambda(1520)0 TFile file(path.c_str(), "READ"); if (file.IsZombie()) { @@ -20,19 +19,12 @@ int External() const auto nEvents = tree->GetEntries(); int nMother = 0; int nNotDecayed = 0; - int nBadDecay = 0; // mothers not decaying exactly to Lambda + gamma - int nEventsWrongCount = 0; // events with the wrong number of injected mothers - int nGapEvents = 0; // events expected to contain the injected mother + int nBadDecay = 0; // mothers not decaying exactly to Lambda + gamma + std::vector motherPerEvent; // number of injected mothers in each event for (int i = 0; i < nEvents; i++) { tree->GetEntry(i); - // the generator injects in every triggerRatio-th event (it counts events from 1) - const bool isGapEvent = ((i + 1) % triggerRatio == 0); - if (isGapEvent) { - nGapEvents++; - } - int nInEvent = 0; for (auto &track : *tracks) { const int pdg = track.GetPdgCode(); @@ -59,30 +51,52 @@ int External() std::cerr << "Unexpected decay of " << pdg << " (" << nDau << " daughters)\n"; } } + motherPerEvent.push_back(nInEvent); + } - const int nExpected = isGapEvent ? 1 : 0; - if (nInEvent != nExpected) { - nEventsWrongCount++; - std::cerr << "Event " << i << ": found " << nInEvent - << " Lambda(1520), expected " << nExpected << "\n"; + // the trigger ratio is inferred from the first event containing a mother + // (the generator counts events from 1 and injects every triggerRatio-th event) + int triggerRatio = 0; + for (int i = 0; i < nEvents; i++) { + if (motherPerEvent[i] > 0) { + triggerRatio = i + 1; + break; + } + } + + int nEventsWrongCount = 0; + int nGapEvents = 0; + if (triggerRatio > 0) { + for (int i = 0; i < nEvents; i++) { + const bool isGapEvent = ((i + 1) % triggerRatio == 0); + if (isGapEvent) { + nGapEvents++; + } + const int nExpected = isGapEvent ? 1 : 0; + if (motherPerEvent[i] != nExpected) { + nEventsWrongCount++; + std::cerr << "Event " << i << ": found " << motherPerEvent[i] + << " Lambda(1520), expected " << nExpected << "\n"; + } } } std::cout << "--------------------------------\n"; std::cout << "# Events: " << nEvents << "\n"; - std::cout << "# Gap-trigger events: " << nGapEvents << " (ratio " << triggerRatio << ")\n"; + std::cout << "# Inferred trigger ratio: " << triggerRatio << "\n"; + std::cout << "# Gap-trigger events: " << nGapEvents << "\n"; std::cout << "# Lambda(1520) + anti: " << nMother << "\n"; std::cout << "# not decayed: " << nNotDecayed << "\n"; std::cout << "# unexpected decays: " << nBadDecay << "\n"; std::cout << "# events wrong count: " << nEventsWrongCount << "\n"; std::cout << "--------------------------------\n"; - if (nMother != nGapEvents) { - std::cerr << "Expected one injected Lambda(1520) per gap-trigger event\n"; + if (triggerRatio == 0) { + std::cerr << "No Lambda(1520) found in any event\n"; return 1; } - if (nEventsWrongCount > 0) { - std::cerr << "Lambda(1520) must appear in every gap-triggered events\n"; + if (nMother != nGapEvents || nEventsWrongCount > 0) { + std::cerr << "Lambda(1520) must appear exactly once every triggerRatio events\n"; return 1; } if (nNotDecayed > 0 || nBadDecay > 0) { From 3ed3e82269740176fe16a194aa9d41fb1f88465b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Jacazio?= Date: Tue, 17 Nov 2026 11:12:27 +0100 Subject: [PATCH 8/8] Include Logger.h and modify preprocessor directives Added Logger.h include and updated preprocessor directives. --- MC/config/PWGLF/pythia8/generator_pythia8_Lstar.C | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/MC/config/PWGLF/pythia8/generator_pythia8_Lstar.C b/MC/config/PWGLF/pythia8/generator_pythia8_Lstar.C index 3a732db28..aec043dfe 100644 --- a/MC/config/PWGLF/pythia8/generator_pythia8_Lstar.C +++ b/MC/config/PWGLF/pythia8/generator_pythia8_Lstar.C @@ -1,3 +1,7 @@ +#include "Framework/Logger.h" + +#if !defined(__CLING__) || defined(__ROOTCLING__) + #include "Pythia8/Pythia.h" #include "Pythia8/HeavyIons.h" #include "FairGenerator.h" @@ -5,12 +9,11 @@ #include "Generators/GeneratorPythia8.h" #include "TF1.h" #include "TRandom3.h" -//#include "TParticlePDG.h" -//#include "TDatabasePDG.h" - #include #include +#endif + class GeneratorPythia8ExtraStrangeness : public o2::eventgen::GeneratorPythia8 { public: @@ -268,4 +271,4 @@ private: { auto myGen = new GeneratorPythia8ExtraStrangeness(3124, inputTriggerRatio); return myGen; - } \ No newline at end of file + }