From c5094b9bcb1f19ce5dba100b4eddd33accbd7fd1 Mon Sep 17 00:00:00 2001 From: Francesca Ercolessi Date: Fri, 16 Jan 2026 17:48:08 +0100 Subject: [PATCH 1/3] add generator for LambdaB to deuteron --- .../GeneratorHFTrigger_LambdaBToDeuteron.ini | 6 ++ .../GeneratorHFTrigger_LambdaBToDeuteron.C | 56 ++++++++++++++ .../generator/pythia8_lambdab_probQQtoQ.cfg | 76 +++++++++++++++++++ 3 files changed, 138 insertions(+) create mode 100644 MC/config/PWGHF/ini/GeneratorHFTrigger_LambdaBToDeuteron.ini create mode 100644 MC/config/PWGHF/ini/tests/GeneratorHFTrigger_LambdaBToDeuteron.C create mode 100644 MC/config/PWGHF/pythia8/generator/pythia8_lambdab_probQQtoQ.cfg diff --git a/MC/config/PWGHF/ini/GeneratorHFTrigger_LambdaBToDeuteron.ini b/MC/config/PWGHF/ini/GeneratorHFTrigger_LambdaBToDeuteron.ini new file mode 100644 index 000000000..794191417 --- /dev/null +++ b/MC/config/PWGHF/ini/GeneratorHFTrigger_LambdaBToDeuteron.ini @@ -0,0 +1,6 @@ +### The external generator derives from GeneratorPythia8. +[GeneratorExternal] +fileName=${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGHF/external/generator/generator_pythia8_hfhadron_to_nuclei.C +funcName=generateHFHadToNuclei(3, {5122}, {1000010020}, true, 0.5) +[GeneratorPythia8] +config=${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGHF/pythia8/generator/pythia8_lambdab_probQQtoQ.cfg diff --git a/MC/config/PWGHF/ini/tests/GeneratorHFTrigger_LambdaBToDeuteron.C b/MC/config/PWGHF/ini/tests/GeneratorHFTrigger_LambdaBToDeuteron.C new file mode 100644 index 000000000..ea146e93f --- /dev/null +++ b/MC/config/PWGHF/ini/tests/GeneratorHFTrigger_LambdaBToDeuteron.C @@ -0,0 +1,56 @@ +int External() +{ + std::string path{"o2sim_Kine.root"}; + std::vector checkPdgHadron{5122}; // Lambda_b + std::vector nucleiDauPdg{1000010020}; // d, 3He, 3H + + 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"); + std::vector *tracks{}; + tree->SetBranchAddress("MCTrack", &tracks); + + int nSignals{}, nSignalGoodDecay{}; + auto nEvents = tree->GetEntries(); + + for (int i = 0; i < nEvents; i++) + { + tree->GetEntry(i); + for (auto &track : *tracks) + { + auto pdg = track.GetPdgCode(); + if (std::find(checkPdgHadron.begin(), checkPdgHadron.end(), std::abs(pdg)) != checkPdgHadron.end()) // found signal + { + // count signal PDG + if(std::abs(track.GetRapidity()) > 1.5) continue; // skip if outside rapidity window + nSignals++; + for (int j{track.getFirstDaughterTrackId()}; j <= track.getLastDaughterTrackId(); ++j) + { + auto pdgDau = tracks->at(j).GetPdgCode(); + if (std::find(nucleiDauPdg.begin(), nucleiDauPdg.end(), std::abs(pdgDau)) != nucleiDauPdg.end()) + { + nSignalGoodDecay++; + } + } + } + } + } + std::cout << "--------------------------------\n"; + std::cout << "# Events: " << nEvents << "\n"; + std::cout <<"# signal hadrons: " << nSignals << "\n"; + std::cout <<"# signal hadrons decaying into nuclei: " << nSignalGoodDecay << "\n"; + + float fracForcedDecays = float(nSignalGoodDecay) / nSignals; + if (fracForcedDecays < 0.8) // we put some tolerance (lambdaB in MB events do not coalesce) + { + std::cerr << "Fraction of signals decaying into nuclei: " << fracForcedDecays << ", lower than expected\n"; + return 1; + } + + return 0; +} diff --git a/MC/config/PWGHF/pythia8/generator/pythia8_lambdab_probQQtoQ.cfg b/MC/config/PWGHF/pythia8/generator/pythia8_lambdab_probQQtoQ.cfg new file mode 100644 index 000000000..58acb17c4 --- /dev/null +++ b/MC/config/PWGHF/pythia8/generator/pythia8_lambdab_probQQtoQ.cfg @@ -0,0 +1,76 @@ +### beams +Beams:idA 2212 # proton +Beams:idB 2212 # proton +Beams:eCM 13600. # GeV + +### processes +SoftQCD:inelastic on # all inelastic processes + +### decays +ParticleDecays:limitTau0 on +ParticleDecays:tau0Max 10. + +# enable deuteron production by coalescence collisions +HadronLevel:DeuteronProduction = on +DeuteronProduction:channels = {2212 2112 > 22} +DeuteronProduction:models = {0} +DeuteronProduction:norm = 1 +DeuteronProduction:parms = {0.5 1} # coalescence momentum p0 in GeV/c + +### switching on Pythia Mode2 +ColourReconnection:mode 1 +ColourReconnection:allowDoubleJunRem off +ColourReconnection:m0 0.3 +ColourReconnection:allowJunctions on +ColourReconnection:junctionCorrection 1.20 +ColourReconnection:timeDilationMode 2 +ColourReconnection:timeDilationPar 0.18 +StringPT:sigma 0.335 +StringZ:aLund 0.36 +StringZ:bLund 0.56 +#StringFlav:probQQtoQ 0.078 +StringFlav:probQQtoQ 0.17 +StringFlav:ProbStoUD 0.2 +StringFlav:probQQ1toQQ0join 0.0275,0.0275,0.0275,0.0275 +MultiPartonInteractions:pT0Ref 2.15 +BeamRemnants:remnantMode 1 +BeamRemnants:saturation 5 + +# Correct decay lengths (wrong in PYTHIA8 decay table) +# Lb +5122:tau0 = 0.4390 +# Xic0 +4132:tau0 = 0.0455 +# OmegaC +4332:tau0 = 0.0803 + +## Lb decay modes +5122:onMode = off +5122:oneChannel = 1 9.03e-05 0 2212 2212 -2212 -2212 2112 +5122:addChannel = 1 0.00181 0 2212 2212 -2212 -2212 2112 111 +5122:addChannel = 1 0.0181 0 2212 2212 -2212 -2212 2112 111 111 +5122:addChannel = 1 0.0271 0 2212 2212 -2212 -2212 2112 211 -211 +5122:addChannel = 1 0.0181 0 2212 2212 -2212 -2212 2112 211 211 -211 -211 +5122:addChannel = 1 0.181 0 2212 2212 -2212 -2212 2112 211 -211 111 +5122:addChannel = 1 0.199 0 2212 2212 -2212 -2212 2112 211 -211 111 111 +5122:addChannel = 1 0.0271 0 2212 2212 -2212 -2212 2112 211 211 -211 -211 111 +5122:addChannel = 1 0.00452 0 2212 2212 -2212 -2212 2112 211 111 +5122:addChannel = 1 0.0361 0 2212 2212 2112 -2212 -2112 -211 111 +5122:addChannel = 1 0.0452 0 2212 2212 2112 -2212 -2112 -211 111 111 +5122:addChannel = 1 0.0542 0 2212 2212 2112 -2212 -2112 -211 -211 211 +5122:addChannel = 1 0.361 0 2212 2212 2112 -2212 -2112 -211 -211 211 111 +5122:addChannel = 1 0.0271 0 2212 2212 2112 -2212 -2112 -211 -211 211 111 111 +5122:onIfMatch = 2212 2212 2212 2212 2112 +5122:onIfMatch = 2212 2212 2212 2212 2112 111 +5122:onIfMatch = 2212 2212 2212 2212 2112 111 111 +5122:onIfMatch = 2212 2212 2212 2212 2112 211 211 +5122:onIfMatch = 2212 2212 2212 2212 2112 211 211 211 211 +5122:onIfMatch = 2212 2212 2212 2212 2112 211 211 111 +5122:onIfMatch = 2212 2212 2212 2212 2112 211 211 111 111 +5122:onIfMatch = 2212 2212 2212 2212 2112 211 211 211 211 111 +5122:onIfMatch = 2212 2212 2212 2212 2112 211 111 +5122:onIfMatch = 2212 2212 2112 2212 2112 211 111 +5122:onIfMatch = 2212 2212 2112 2212 2112 211 111 111 +5122:onIfMatch = 2212 2212 2112 2212 2112 211 211 211 +5122:onIfMatch = 2212 2212 2112 2212 2112 211 211 211 111 +5122:onIfMatch = 2212 2212 2112 2212 2112 211 211 211 111 111 From 377d8a5f33032d6d37bb99fc7e0d9f6b497fd685 Mon Sep 17 00:00:00 2001 From: Francesca Ercolessi Date: Mon, 19 Jan 2026 09:39:43 +0100 Subject: [PATCH 2/3] Update MC/config/PWGHF/ini/GeneratorHFTrigger_LambdaBToDeuteron.ini Co-authored-by: Fabrizio --- MC/config/PWGHF/ini/GeneratorHFTrigger_LambdaBToDeuteron.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/MC/config/PWGHF/ini/GeneratorHFTrigger_LambdaBToDeuteron.ini b/MC/config/PWGHF/ini/GeneratorHFTrigger_LambdaBToDeuteron.ini index 794191417..fab061515 100644 --- a/MC/config/PWGHF/ini/GeneratorHFTrigger_LambdaBToDeuteron.ini +++ b/MC/config/PWGHF/ini/GeneratorHFTrigger_LambdaBToDeuteron.ini @@ -1,3 +1,4 @@ +#NEV_TEST> 10 ### The external generator derives from GeneratorPythia8. [GeneratorExternal] fileName=${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGHF/external/generator/generator_pythia8_hfhadron_to_nuclei.C From 3d977825240dc2d7b8715e04dde2deec5de2cae2 Mon Sep 17 00:00:00 2001 From: Francesca Ercolessi Date: Mon, 19 Jan 2026 09:40:00 +0100 Subject: [PATCH 3/3] Update MC/config/PWGHF/ini/tests/GeneratorHFTrigger_LambdaBToDeuteron.C Co-authored-by: Fabrizio --- .../PWGHF/ini/tests/GeneratorHFTrigger_LambdaBToDeuteron.C | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/MC/config/PWGHF/ini/tests/GeneratorHFTrigger_LambdaBToDeuteron.C b/MC/config/PWGHF/ini/tests/GeneratorHFTrigger_LambdaBToDeuteron.C index ea146e93f..3df607574 100644 --- a/MC/config/PWGHF/ini/tests/GeneratorHFTrigger_LambdaBToDeuteron.C +++ b/MC/config/PWGHF/ini/tests/GeneratorHFTrigger_LambdaBToDeuteron.C @@ -45,8 +45,9 @@ int External() std::cout <<"# signal hadrons: " << nSignals << "\n"; std::cout <<"# signal hadrons decaying into nuclei: " << nSignalGoodDecay << "\n"; - float fracForcedDecays = float(nSignalGoodDecay) / nSignals; - if (fracForcedDecays < 0.8) // we put some tolerance (lambdaB in MB events do not coalesce) + float fracForcedDecays = nSignals ? float(nSignalGoodDecay) / nSignals : 0.0f; + float uncFracForcedDecays = nSignals ? std::sqrt(fracForcedDecays * (1 - fracForcedDecays) / nSignals) : 1.0f; + if (1 - fracForcedDecays > 0.2 + uncFracForcedDecays) // we put some tolerance (lambdaB in MB events do not coalesce) { std::cerr << "Fraction of signals decaying into nuclei: " << fracForcedDecays << ", lower than expected\n"; return 1;