From 8ab6cfa90c95db571f746d16d5fa3c6b7a0ace31 Mon Sep 17 00:00:00 2001 From: sawankumawat Date: Thu, 30 Apr 2026 23:35:35 +0530 Subject: [PATCH 1/4] Added PDG checks for Kstar and Phi daughters --- PWGLF/Tasks/QC/mcParticlePrediction.cxx | 99 ++++++++++++++++++++++--- 1 file changed, 87 insertions(+), 12 deletions(-) diff --git a/PWGLF/Tasks/QC/mcParticlePrediction.cxx b/PWGLF/Tasks/QC/mcParticlePrediction.cxx index 11ac33586be..dc4d5941f3a 100644 --- a/PWGLF/Tasks/QC/mcParticlePrediction.cxx +++ b/PWGLF/Tasks/QC/mcParticlePrediction.cxx @@ -41,6 +41,7 @@ #include #include +#include #include #include @@ -446,6 +447,9 @@ struct mcParticlePrediction { return nMult; } + int noOfDaughters = 2; + float rapidityMother = 0.5; + void process(aod::McCollision const& mcCollision, aod::McParticles const& mcParticles) { @@ -493,9 +497,9 @@ struct mcParticlePrediction { continue; } - if (!particle.isPhysicalPrimary()) { - continue; - } + // if (!particle.isPhysicalPrimary()) { + // continue; + // } TParticlePDG* p = pdgDB->GetParticle(particle.pdgCode()); if (p) { @@ -506,21 +510,92 @@ struct mcParticlePrediction { } } - if (std::abs(particle.y()) > 0.5) { + if (std::abs(particle.y()) >= rapidityMother) { continue; } - histos.fill(HIST("particles/vtx/x"), particle.vx()); - histos.fill(HIST("particles/vtx/y"), particle.vy()); - histos.fill(HIST("particles/vtx/z"), particle.vz() - mcCollision.posZ()); + if (particle.pdgCode() == o2::constants::physics::kK0Star892) { + auto kDaughters = particle.daughters_as(); + if (kDaughters.size() != noOfDaughters) { + continue; + } + + auto passkaon = false; + auto passpion = false; + for (const auto& kCurrentDaughter : kDaughters) { + if (!kCurrentDaughter.isPhysicalPrimary()) { + continue; + } + + if (std::abs(kCurrentDaughter.pdgCode()) == PDG_t::kKPlus) { + passkaon = true; + } else if (std::abs(kCurrentDaughter.pdgCode()) == PDG_t::kPiPlus) { + passpion = true; + } + } + if (passkaon && passpion) { + histos.fill(HIST("particles/vtx/x"), particle.vx()); + histos.fill(HIST("particles/vtx/y"), particle.vy()); + histos.fill(HIST("particles/vtx/z"), particle.vz() - mcCollision.posZ()); + + histos.fill(HIST("particles/yields"), id); + for (int i = 0; i < Estimators::nEstimators; i++) { + if (!enabledEstimatorsArray[i]) { + continue; + } + hpt[i][id]->Fill(particle.pt(), nMult[i]); + hyield[i][id]->Fill(nMult[i]); + } + } + } else if (particle.pdgCode() == o2::constants::physics::kPhi) { + auto kDaughters = particle.daughters_as(); + if (kDaughters.size() != noOfDaughters) { + continue; + } - histos.fill(HIST("particles/yields"), id); - for (int i = 0; i < Estimators::nEstimators; i++) { - if (!enabledEstimatorsArray[i]) { + auto passkaonPos = false; + auto passkaonNeg = false; + for (const auto& kCurrentDaughter : kDaughters) { + if (!kCurrentDaughter.isPhysicalPrimary()) { + continue; + } + + if (kCurrentDaughter.pdgCode() == PDG_t::kKPlus) { + passkaonPos = true; + } else if (kCurrentDaughter.pdgCode() == PDG_t::kKMinus) { + passkaonNeg = true; + } + } + if (passkaonPos && passkaonNeg) { + histos.fill(HIST("particles/vtx/x"), particle.vx()); + histos.fill(HIST("particles/vtx/y"), particle.vy()); + histos.fill(HIST("particles/vtx/z"), particle.vz() - mcCollision.posZ()); + + histos.fill(HIST("particles/yields"), id); + for (int i = 0; i < Estimators::nEstimators; i++) { + if (!enabledEstimatorsArray[i]) { + continue; + } + hpt[i][id]->Fill(particle.pt(), nMult[i]); + hyield[i][id]->Fill(nMult[i]); + } + } + } else { + if (!particle.isPhysicalPrimary()) { continue; } - hpt[i][id]->Fill(particle.pt(), nMult[i]); - hyield[i][id]->Fill(nMult[i]); + histos.fill(HIST("particles/vtx/x"), particle.vx()); + histos.fill(HIST("particles/vtx/y"), particle.vy()); + histos.fill(HIST("particles/vtx/z"), particle.vz() - mcCollision.posZ()); + + histos.fill(HIST("particles/yields"), id); + for (int i = 0; i < Estimators::nEstimators; i++) { + if (!enabledEstimatorsArray[i]) { + continue; + } + hpt[i][id]->Fill(particle.pt(), nMult[i]); + hyield[i][id]->Fill(nMult[i]); + } } } } From 7ad8a90503646d69e8efbde9c47f4d978cc8e8b6 Mon Sep 17 00:00:00 2001 From: sawan <124118453+sawankumawat@users.noreply.github.com> Date: Sat, 2 May 2026 11:58:06 +0530 Subject: [PATCH 2/4] Physical primary check for the daughters of decaying particles --- PWGLF/Tasks/QC/mcParticlePrediction.cxx | 105 ++++++------------------ 1 file changed, 26 insertions(+), 79 deletions(-) diff --git a/PWGLF/Tasks/QC/mcParticlePrediction.cxx b/PWGLF/Tasks/QC/mcParticlePrediction.cxx index dc4d5941f3a..8bb61488cc3 100644 --- a/PWGLF/Tasks/QC/mcParticlePrediction.cxx +++ b/PWGLF/Tasks/QC/mcParticlePrediction.cxx @@ -41,7 +41,6 @@ #include #include -#include #include #include @@ -195,6 +194,7 @@ struct mcParticlePrediction { Configurable enableVsEta05Histograms{"enableVsEta05Histograms", true, "Enables the correlation between ETA05 and other estimators"}; Configurable enableVsEta08Histograms{"enableVsEta08Histograms", true, "Enables the correlation between ETA08 and other estimators"}; Configurable enableVsImpactParameterHistograms{"enableVsImpactParameterHistograms", true, "Enables the correlation between impact parameter and other estimators"}; + Configurable rapidityMother{"rapidityMother", 0.5, "Mother particle rapidity"}; Service pdgDB; o2::pwglf::ParticleCounter mCounter; @@ -447,9 +447,6 @@ struct mcParticlePrediction { return nMult; } - int noOfDaughters = 2; - float rapidityMother = 0.5; - void process(aod::McCollision const& mcCollision, aod::McParticles const& mcParticles) { @@ -514,88 +511,38 @@ struct mcParticlePrediction { continue; } - if (particle.pdgCode() == o2::constants::physics::kK0Star892) { - auto kDaughters = particle.daughters_as(); - if (kDaughters.size() != noOfDaughters) { - continue; - } - - auto passkaon = false; - auto passpion = false; - for (const auto& kCurrentDaughter : kDaughters) { - if (!kCurrentDaughter.isPhysicalPrimary()) { - continue; - } + // Check if particle has daughters (not a final state particle) + auto daughters = particle.daughters_as(); + bool isValid = false; - if (std::abs(kCurrentDaughter.pdgCode()) == PDG_t::kKPlus) { - passkaon = true; - } else if (std::abs(kCurrentDaughter.pdgCode()) == PDG_t::kPiPlus) { - passpion = true; + if (daughters.size() > 0) { + isValid = true; + for (const auto& daughter : daughters) { + if (!daughter.isPhysicalPrimary()) { + isValid = false; + break; } } - if (passkaon && passpion) { - histos.fill(HIST("particles/vtx/x"), particle.vx()); - histos.fill(HIST("particles/vtx/y"), particle.vy()); - histos.fill(HIST("particles/vtx/z"), particle.vz() - mcCollision.posZ()); - - histos.fill(HIST("particles/yields"), id); - for (int i = 0; i < Estimators::nEstimators; i++) { - if (!enabledEstimatorsArray[i]) { - continue; - } - hpt[i][id]->Fill(particle.pt(), nMult[i]); - hyield[i][id]->Fill(nMult[i]); - } - } - } else if (particle.pdgCode() == o2::constants::physics::kPhi) { - auto kDaughters = particle.daughters_as(); - if (kDaughters.size() != noOfDaughters) { - continue; - } + } else { + // Final state particle - check if particle itself is physical primary + isValid = particle.isPhysicalPrimary(); + } - auto passkaonPos = false; - auto passkaonNeg = false; - for (const auto& kCurrentDaughter : kDaughters) { - if (!kCurrentDaughter.isPhysicalPrimary()) { - continue; - } + if (!isValid) { + continue; + } - if (kCurrentDaughter.pdgCode() == PDG_t::kKPlus) { - passkaonPos = true; - } else if (kCurrentDaughter.pdgCode() == PDG_t::kKMinus) { - passkaonNeg = true; - } - } - if (passkaonPos && passkaonNeg) { - histos.fill(HIST("particles/vtx/x"), particle.vx()); - histos.fill(HIST("particles/vtx/y"), particle.vy()); - histos.fill(HIST("particles/vtx/z"), particle.vz() - mcCollision.posZ()); - - histos.fill(HIST("particles/yields"), id); - for (int i = 0; i < Estimators::nEstimators; i++) { - if (!enabledEstimatorsArray[i]) { - continue; - } - hpt[i][id]->Fill(particle.pt(), nMult[i]); - hyield[i][id]->Fill(nMult[i]); - } - } - } else { - if (!particle.isPhysicalPrimary()) { + histos.fill(HIST("particles/vtx/x"), particle.vx()); + histos.fill(HIST("particles/vtx/y"), particle.vy()); + histos.fill(HIST("particles/vtx/z"), particle.vz() - mcCollision.posZ()); + + histos.fill(HIST("particles/yields"), id); + for (int i = 0; i < Estimators::nEstimators; i++) { + if (!enabledEstimatorsArray[i]) { continue; } - histos.fill(HIST("particles/vtx/x"), particle.vx()); - histos.fill(HIST("particles/vtx/y"), particle.vy()); - histos.fill(HIST("particles/vtx/z"), particle.vz() - mcCollision.posZ()); - - histos.fill(HIST("particles/yields"), id); - for (int i = 0; i < Estimators::nEstimators; i++) { - if (!enabledEstimatorsArray[i]) { - continue; - } - hpt[i][id]->Fill(particle.pt(), nMult[i]); - hyield[i][id]->Fill(nMult[i]); - } + hpt[i][id]->Fill(particle.pt(), nMult[i]); + hyield[i][id]->Fill(nMult[i]); } } } From e1fc40bce509413b5cb5361933d003706ae9fc43 Mon Sep 17 00:00:00 2001 From: SCHOTTER Romain <47983209+romainschotter@users.noreply.github.com> Date: Sat, 2 May 2026 18:00:28 +0200 Subject: [PATCH 3/4] Rename rapidityCut configurable and fix O2Linter errors --- PWGLF/Tasks/QC/mcParticlePrediction.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/PWGLF/Tasks/QC/mcParticlePrediction.cxx b/PWGLF/Tasks/QC/mcParticlePrediction.cxx index 8bb61488cc3..2019a6fb4d4 100644 --- a/PWGLF/Tasks/QC/mcParticlePrediction.cxx +++ b/PWGLF/Tasks/QC/mcParticlePrediction.cxx @@ -180,6 +180,7 @@ struct mcParticlePrediction { "Estimators enabled"}; Configurable selectInelGt0{"selectInelGt0", true, "Select only inelastic events"}; Configurable selectPrimaries{"selectPrimaries", true, "Select only primary particles"}; + Configurable rapidityCut{"rapidityCut", 0.5, "Select only particles within |y| < cut"}; Configurable requireCoincidenceEstimators{"requireCoincidenceEstimators", false, "Asks for a coincidence when two estimators are used"}; Configurable discardkIsGoodZvtxFT0vsPV{"discardkIsGoodZvtxFT0vsPV", false, "Select only collisions with matching BC and MC BC"}; Configurable discardMismatchedBCs{"discardMismatchedBCs", false, "Select only collisions with matching BC and MC BC"}; @@ -194,7 +195,6 @@ struct mcParticlePrediction { Configurable enableVsEta05Histograms{"enableVsEta05Histograms", true, "Enables the correlation between ETA05 and other estimators"}; Configurable enableVsEta08Histograms{"enableVsEta08Histograms", true, "Enables the correlation between ETA08 and other estimators"}; Configurable enableVsImpactParameterHistograms{"enableVsImpactParameterHistograms", true, "Enables the correlation between impact parameter and other estimators"}; - Configurable rapidityMother{"rapidityMother", 0.5, "Mother particle rapidity"}; Service pdgDB; o2::pwglf::ParticleCounter mCounter; @@ -507,7 +507,7 @@ struct mcParticlePrediction { } } - if (std::abs(particle.y()) >= rapidityMother) { + if (std::abs(particle.y()) >= rapidityCut) { continue; } @@ -694,10 +694,10 @@ struct mcParticlePrediction { float nMultRecoMCBC[Estimators::nEstimators] = {0}; if (mcBC.has_ft0()) { const auto& ft0 = mcBC.ft0(); - for (auto amplitude : ft0.amplitudeA()) { + for (const auto amplitude : ft0.amplitudeA()) { nMultRecoMCBC[Estimators::FT0A] += amplitude; } - for (auto amplitude : ft0.amplitudeC()) { + for (const auto amplitude : ft0.amplitudeC()) { nMultRecoMCBC[Estimators::FT0C] += amplitude; } nMultRecoMCBC[Estimators::FT0AC] = nMultRecoMCBC[Estimators::FT0A] + nMultRecoMCBC[Estimators::FT0C]; From 3bd30c8caec020095fababd325116586f60bfcd5 Mon Sep 17 00:00:00 2001 From: SCHOTTER Romain <47983209+romainschotter@users.noreply.github.com> Date: Sat, 2 May 2026 18:02:23 +0200 Subject: [PATCH 4/4] Fix missing references --- PWGLF/Tasks/QC/mcParticlePrediction.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PWGLF/Tasks/QC/mcParticlePrediction.cxx b/PWGLF/Tasks/QC/mcParticlePrediction.cxx index 2019a6fb4d4..0da77c92ee9 100644 --- a/PWGLF/Tasks/QC/mcParticlePrediction.cxx +++ b/PWGLF/Tasks/QC/mcParticlePrediction.cxx @@ -694,10 +694,10 @@ struct mcParticlePrediction { float nMultRecoMCBC[Estimators::nEstimators] = {0}; if (mcBC.has_ft0()) { const auto& ft0 = mcBC.ft0(); - for (const auto amplitude : ft0.amplitudeA()) { + for (const auto& amplitude : ft0.amplitudeA()) { nMultRecoMCBC[Estimators::FT0A] += amplitude; } - for (const auto amplitude : ft0.amplitudeC()) { + for (const auto& amplitude : ft0.amplitudeC()) { nMultRecoMCBC[Estimators::FT0C] += amplitude; } nMultRecoMCBC[Estimators::FT0AC] = nMultRecoMCBC[Estimators::FT0A] + nMultRecoMCBC[Estimators::FT0C];