From 922c7bd8c257585e08ad54bff8273c1c28434c48 Mon Sep 17 00:00:00 2001 From: Hirak Koley Date: Wed, 25 Feb 2026 12:10:12 +0530 Subject: [PATCH 1/6] Update generator function to use exoticAll.json --- MC/config/PWGLF/ini/GeneratorLF_Resonances_pp_exoticAll.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MC/config/PWGLF/ini/GeneratorLF_Resonances_pp_exoticAll.ini b/MC/config/PWGLF/ini/GeneratorLF_Resonances_pp_exoticAll.ini index 5469e9975..64d174b68 100644 --- a/MC/config/PWGLF/ini/GeneratorLF_Resonances_pp_exoticAll.ini +++ b/MC/config/PWGLF/ini/GeneratorLF_Resonances_pp_exoticAll.ini @@ -1,6 +1,6 @@ [GeneratorExternal] fileName=${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator_pythia8_LF_rapidity.C -funcName=generateLFRapidity("${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/resonancelistgun_exotic.json", true, 4, false, false, "${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/pythia8_inel_136tev.cfg", "") +funcName=generateLFRapidity("${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/resonancelistgun_exoticAll.json", true, 4, false, false, "${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/pythia8_inel_136tev.cfg", "") [GeneratorPythia8] # if triggered then this will be used as the background event config=${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/pythia8_inel_136tev.cfg From 208910d737d49654a90961260d79bb78260425f6 Mon Sep 17 00:00:00 2001 From: Hirak Koley Date: Wed, 25 Feb 2026 12:11:36 +0530 Subject: [PATCH 2/6] Add Lambda and anti-Lambda entries to resonance list --- ...c.json => resonancelistgun_exoticAll.json} | 24 ++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) rename MC/config/PWGLF/pythia8/generator/{resonancelistgun_exotic.json => resonancelistgun_exoticAll.json} (87%) diff --git a/MC/config/PWGLF/pythia8/generator/resonancelistgun_exotic.json b/MC/config/PWGLF/pythia8/generator/resonancelistgun_exoticAll.json similarity index 87% rename from MC/config/PWGLF/pythia8/generator/resonancelistgun_exotic.json rename to MC/config/PWGLF/pythia8/generator/resonancelistgun_exoticAll.json index 2727376ca..70212867a 100644 --- a/MC/config/PWGLF/pythia8/generator/resonancelistgun_exotic.json +++ b/MC/config/PWGLF/pythia8/generator/resonancelistgun_exoticAll.json @@ -120,6 +120,28 @@ "rapidityMax": 1.2, "genDecayed": true }, + "Lambda(1520)0" : { + "pdg": 102134, + "n": 1, + "ptMin": 0.0, + "ptMax": 20, + "etaMin": -1.2, + "etaMax": 1.2, + "rapidityMin": -1.2, + "rapidityMax": 1.2, + "genDecayed": true + }, + "anti-Lambda(1520)0" : { + "pdg": -102134, + "n": 1, + "ptMin": 0.0, + "ptMax": 20, + "etaMin": -1.2, + "etaMax": 1.2, + "rapidityMin": -1.2, + "rapidityMax": 1.2, + "genDecayed": true + }, "Xi(1820)0": { "pdg": 123314, "n": 1, @@ -164,4 +186,4 @@ "rapidityMax": 1.2, "genDecayed": true } -} \ No newline at end of file +} From 0e15372706b836d59f5fdefb26cae69b1ad08fbc Mon Sep 17 00:00:00 2001 From: Hirak Koley Date: Wed, 25 Feb 2026 12:15:08 +0530 Subject: [PATCH 3/6] Added new generator for Lambda1520 --- MC/config/PWGLF/ini/GeneratorLF_Lambda1520_pp.ini | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 MC/config/PWGLF/ini/GeneratorLF_Lambda1520_pp.ini diff --git a/MC/config/PWGLF/ini/GeneratorLF_Lambda1520_pp.ini b/MC/config/PWGLF/ini/GeneratorLF_Lambda1520_pp.ini new file mode 100644 index 000000000..90fcfdccb --- /dev/null +++ b/MC/config/PWGLF/ini/GeneratorLF_Lambda1520_pp.ini @@ -0,0 +1,10 @@ +[GeneratorExternal] +fileName=\${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator_pythia8_LF_rapidity.C +funcName=generateLFRapidity("\${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/lambda1520gun_inj.json", true, 1, false, false, "${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/pythia8_inel_136tev.cfg", "") + +[GeneratorPythia8] +config=\${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/pythia8_inel_136tev.cfg + +[DecayerPythia8] +config[0]=\${O2DPG_MC_CONFIG_ROOT}/MC/config/common/pythia8/decayer/base.cfg +config[1]=\${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/lambda1520.cfg From f68b448b8a4f8e4fb1ac6202f611020a04bd2a43 Mon Sep 17 00:00:00 2001 From: Hirak Koley Date: Wed, 25 Feb 2026 13:36:42 +0530 Subject: [PATCH 4/6] Added test code --- .../ini/tests/GeneratorLF_Lambda1520_pp.C | 138 ++++++++++++++++++ 1 file changed, 138 insertions(+) create mode 100644 MC/config/PWGLF/ini/tests/GeneratorLF_Lambda1520_pp.C diff --git a/MC/config/PWGLF/ini/tests/GeneratorLF_Lambda1520_pp.C b/MC/config/PWGLF/ini/tests/GeneratorLF_Lambda1520_pp.C new file mode 100644 index 000000000..d8f1d8608 --- /dev/null +++ b/MC/config/PWGLF/ini/tests/GeneratorLF_Lambda1520_pp.C @@ -0,0 +1,138 @@ +int External() +{ + std::string path{"o2sim_Kine.root"}; + int numberOfInjectedSignalsPerEvent{1}; + int numberOfGapEvents{4}; + int numberOfEventsProcessed{0}; + int numberOfEventsProcessedWithoutInjection{0}; + std::vector injectedPDGs = { + 3124, // Lambda(1520)0 + -3124, // Lambda(1520)0bar + }; + std::vector> decayDaughters = { + {2212, -321}, // Lambda(1520)0 + {-2212, 321}, // Lambda(1520)0bar + }; + + auto nInjection = injectedPDGs.size(); + + 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); + + std::vector nSignal; + for (int i = 0; i < nInjection; i++) + { + nSignal.push_back(0); + } + std::vector> nDecays; + std::vector nNotDecayed; + for (int i = 0; i < nInjection; i++) + { + std::vector nDecay; + for (int j = 0; j < decayDaughters[i].size(); j++) + { + nDecay.push_back(0); + } + nDecays.push_back(nDecay); + nNotDecayed.push_back(0); + } + auto nEvents = tree->GetEntries(); + bool hasInjection = false; + for (int i = 0; i < nEvents; i++) + { + hasInjection = false; + numberOfEventsProcessed++; + auto check = tree->GetEntry(i); + for (int idxMCTrack = 0; idxMCTrack < tracks->size(); ++idxMCTrack) + { + auto track = tracks->at(idxMCTrack); + auto pdg = track.GetPdgCode(); + auto it = std::find(injectedPDGs.begin(), injectedPDGs.end(), pdg); + int index = std::distance(injectedPDGs.begin(), it); // index of injected PDG + if (it != injectedPDGs.end()) // found + { + // count signal PDG + nSignal[index]++; + if (track.getFirstDaughterTrackId() < 0) + { + nNotDecayed[index]++; + continue; + } + for (int j{track.getFirstDaughterTrackId()}; j <= track.getLastDaughterTrackId(); ++j) + { + auto pdgDau = tracks->at(j).GetPdgCode(); + bool foundDau = false; + // count decay PDGs + for (int idxDaughter = 0; idxDaughter < decayDaughters[index].size(); ++idxDaughter) + { + if (pdgDau == decayDaughters[index][idxDaughter]) + { + nDecays[index][idxDaughter]++; + foundDau = true; + hasInjection = true; + break; + } + } + if (!foundDau) + { + std::cerr << "Decay daughter not found: " << pdg << " -> " << pdgDau << "\n"; + } + } + } + } + if (!hasInjection) + { + numberOfEventsProcessedWithoutInjection++; + } + } + std::cout << "--------------------------------\n"; + std::cout << "# Events: " << nEvents << "\n"; + for (int i = 0; i < nInjection; i++) + { + std::cout << "# Mother \n"; + std::cout << injectedPDGs[i] << " generated: " << nSignal[i] << ", " << nNotDecayed[i] << " did not decay\n"; + if (nSignal[i] == 0) + { + std::cerr << "No generated: " << injectedPDGs[i] << "\n"; + // return 1; // At least one of the injected particles should be generated + } + for (int j = 0; j < decayDaughters[i].size(); j++) + { + std::cout << "# Daughter " << decayDaughters[i][j] << ": " << nDecays[i][j] << "\n"; + } + // if (nSignal[i] != nEvents * numberOfInjectedSignalsPerEvent) + // { + // std::cerr << "Number of generated: " << injectedPDGs[i] << ", lower than expected\n"; + // // return 1; // Don't need to return 1, since the number of generated particles is not the same for each event + // } + } + std::cout << "--------------------------------\n"; + std::cout << "Number of events processed: " << numberOfEventsProcessed << "\n"; + std::cout << "Number of input for the gap events: " << numberOfGapEvents << "\n"; + std::cout << "Number of events processed without injection: " << numberOfEventsProcessedWithoutInjection << "\n"; + // injected event + numberOfGapEvents*gap events + injected event + numberOfGapEvents*gap events + ... + // total fraction of the gap event: numberOfEventsProcessedWithoutInjection/numberOfEventsProcessed + float ratioOfNormalEvents = numberOfEventsProcessedWithoutInjection / numberOfEventsProcessed; + if (ratioOfNormalEvents > 0.75) + { + std::cout << "The number of injected event is loo low!!" << std::endl; + return 1; + } + + return 0; +} + +void GeneratorLF_Resonances_pp1360_injection() { External(); } From 6444ae3f6874730b576b64278af329e6e27d1115 Mon Sep 17 00:00:00 2001 From: Hirak Koley Date: Wed, 25 Feb 2026 16:16:46 +0530 Subject: [PATCH 5/6] Fix formatting in GeneratorLF_Lambda1520_pp.ini --- MC/config/PWGLF/ini/GeneratorLF_Lambda1520_pp.ini | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/MC/config/PWGLF/ini/GeneratorLF_Lambda1520_pp.ini b/MC/config/PWGLF/ini/GeneratorLF_Lambda1520_pp.ini index 90fcfdccb..5f2eb7dca 100644 --- a/MC/config/PWGLF/ini/GeneratorLF_Lambda1520_pp.ini +++ b/MC/config/PWGLF/ini/GeneratorLF_Lambda1520_pp.ini @@ -1,10 +1,10 @@ [GeneratorExternal] -fileName=\${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator_pythia8_LF_rapidity.C -funcName=generateLFRapidity("\${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/lambda1520gun_inj.json", true, 1, false, false, "${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/pythia8_inel_136tev.cfg", "") +fileName=${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator_pythia8_LF_rapidity.C +funcName=generateLFRapidity("${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/lambda1520gun_inj.json", true, 1, false, false, "${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/pythia8_inel_136tev.cfg", "") [GeneratorPythia8] -config=\${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/pythia8_inel_136tev.cfg +config=${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/pythia8_inel_136tev.cfg [DecayerPythia8] -config[0]=\${O2DPG_MC_CONFIG_ROOT}/MC/config/common/pythia8/decayer/base.cfg -config[1]=\${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/lambda1520.cfg +config[0]=${O2DPG_MC_CONFIG_ROOT}/MC/config/common/pythia8/decayer/base.cfg +config[1]=${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/lambda1520.cfg From 4ff4bf144de53b1290154a6fa1d6bd5130164e61 Mon Sep 17 00:00:00 2001 From: Hirak Koley Date: Wed, 25 Feb 2026 17:52:27 +0530 Subject: [PATCH 6/6] Update PDG codes for Lambda(1520) --- MC/config/PWGLF/ini/tests/GeneratorLF_Lambda1520_pp.C | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MC/config/PWGLF/ini/tests/GeneratorLF_Lambda1520_pp.C b/MC/config/PWGLF/ini/tests/GeneratorLF_Lambda1520_pp.C index d8f1d8608..6b02def64 100644 --- a/MC/config/PWGLF/ini/tests/GeneratorLF_Lambda1520_pp.C +++ b/MC/config/PWGLF/ini/tests/GeneratorLF_Lambda1520_pp.C @@ -6,8 +6,8 @@ int External() int numberOfEventsProcessed{0}; int numberOfEventsProcessedWithoutInjection{0}; std::vector injectedPDGs = { - 3124, // Lambda(1520)0 - -3124, // Lambda(1520)0bar + 102134, // Lambda(1520)0 + -102134, // Lambda(1520)0bar }; std::vector> decayDaughters = { {2212, -321}, // Lambda(1520)0