From e8094e7f06f2a7089c490c871a3927a9a41de3b3 Mon Sep 17 00:00:00 2001 From: Fabrizio Grosa Date: Tue, 28 Oct 2025 19:56:23 +0100 Subject: [PATCH 1/3] Add possibility to reject particles from background event --- PWGHF/Tasks/taskMcGenPtRapShapes.cxx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/PWGHF/Tasks/taskMcGenPtRapShapes.cxx b/PWGHF/Tasks/taskMcGenPtRapShapes.cxx index 849b32b2c66..a321169a0d2 100644 --- a/PWGHF/Tasks/taskMcGenPtRapShapes.cxx +++ b/PWGHF/Tasks/taskMcGenPtRapShapes.cxx @@ -56,6 +56,7 @@ struct HfTaskMcGenPtRapShapes { ConfigurableAxis axisPtBeauty{"axisPtBeauty", {3000, 0.f, 300.f}, "Binning for the pT axis of beauty hadrons"}; ConfigurableAxis axisRapCharm{"axisRapCharm", {100, -1.f, 1.f}, "Binning for the y axis of charm hadrons"}; ConfigurableAxis axisRapBeauty{"axisRapBeauty", {100, -1.f, 1.f}, "Binning for the y axis of beauty hadrons"}; + Configurable rejectBackground{"rejectBackground", false, "Reject particles from background events"}; std::array, nCharmHadrons> histRapVsPtCharmPrompt{}; std::array, nCharmHadrons> histRapVsPtCharmNonPrompt{}; @@ -81,6 +82,9 @@ struct HfTaskMcGenPtRapShapes { void process(aod::McParticles const& mcParticles) { for (auto const& mcParticle : mcParticles) { + if (rejectBackground and mcParticle.fromBackgroundEvent()) { + continue; + } int const absPdgCode = std::abs(mcParticle.pdgCode()); float const pt = mcParticle.pt(); float const rap = mcParticle.y(); From bd10d39639b3b9a0ee1a192d329836a9def01115 Mon Sep 17 00:00:00 2001 From: Fabrizio Grosa Date: Tue, 28 Oct 2025 19:58:45 +0100 Subject: [PATCH 2/3] Respect conventions --- PWGHF/Tasks/taskMcGenPtRapShapes.cxx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/PWGHF/Tasks/taskMcGenPtRapShapes.cxx b/PWGHF/Tasks/taskMcGenPtRapShapes.cxx index a321169a0d2..17ef49ac63b 100644 --- a/PWGHF/Tasks/taskMcGenPtRapShapes.cxx +++ b/PWGHF/Tasks/taskMcGenPtRapShapes.cxx @@ -52,11 +52,12 @@ constexpr std::array PdgCodesBeauty = {Pdg::kB0, Pdg::kBPlu struct HfTaskMcGenPtRapShapes { + Configurable rejectBackground{"rejectBackground", false, "Reject particles from background events"}; + Configurable absRapidityMax{"absRapidityMax", 0.5, "Absolute maximum rapidity"}; ConfigurableAxis axisPtCharm{"axisPtCharm", {1000, 0.f, 100.f}, "Binning for the pT axis of charm hadrons"}; ConfigurableAxis axisPtBeauty{"axisPtBeauty", {3000, 0.f, 300.f}, "Binning for the pT axis of beauty hadrons"}; ConfigurableAxis axisRapCharm{"axisRapCharm", {100, -1.f, 1.f}, "Binning for the y axis of charm hadrons"}; ConfigurableAxis axisRapBeauty{"axisRapBeauty", {100, -1.f, 1.f}, "Binning for the y axis of beauty hadrons"}; - Configurable rejectBackground{"rejectBackground", false, "Reject particles from background events"}; std::array, nCharmHadrons> histRapVsPtCharmPrompt{}; std::array, nCharmHadrons> histRapVsPtCharmNonPrompt{}; @@ -98,7 +99,7 @@ struct HfTaskMcGenPtRapShapes { histRapVsPtCharmPrompt[idxCharm]->Fill(pt, rap); } else if (origin == RecoDecay::OriginType::NonPrompt) { histRapVsPtCharmNonPrompt[idxCharm]->Fill(pt, rap); - if (std::abs(rap) < 0.5) { + if (std::abs(rap) < absRapidityMax) { auto bMother = mcParticles.rawIteratorAt(idxBhadMothers[0]); histPtCharmVsPtBeautyNonPrompt[idxCharm]->Fill(bMother.pt(), pt); } From b64080d2fd91a96ee7df197c1940bdb33234ed4c Mon Sep 17 00:00:00 2001 From: Fabrizio Grosa Date: Tue, 28 Oct 2025 20:05:13 +0100 Subject: [PATCH 3/3] Make Megalinter happy --- PWGHF/Tasks/taskMcGenPtRapShapes.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGHF/Tasks/taskMcGenPtRapShapes.cxx b/PWGHF/Tasks/taskMcGenPtRapShapes.cxx index 17ef49ac63b..fef12e8dd14 100644 --- a/PWGHF/Tasks/taskMcGenPtRapShapes.cxx +++ b/PWGHF/Tasks/taskMcGenPtRapShapes.cxx @@ -83,7 +83,7 @@ struct HfTaskMcGenPtRapShapes { void process(aod::McParticles const& mcParticles) { for (auto const& mcParticle : mcParticles) { - if (rejectBackground and mcParticle.fromBackgroundEvent()) { + if (rejectBackground && mcParticle.fromBackgroundEvent()) { continue; } int const absPdgCode = std::abs(mcParticle.pdgCode());