From 5a37580f92351484322cb7e6bd90c900b9cc54b7 Mon Sep 17 00:00:00 2001 From: Subhadeep Mandal Date: Wed, 25 Feb 2026 00:33:29 +0530 Subject: [PATCH] Optimised reflection process function --- PWGLF/Tasks/Resonances/kstar892LightIon.cxx | 106 +++++++++----------- 1 file changed, 47 insertions(+), 59 deletions(-) diff --git a/PWGLF/Tasks/Resonances/kstar892LightIon.cxx b/PWGLF/Tasks/Resonances/kstar892LightIon.cxx index 6badcceea3c..47a723d44d4 100644 --- a/PWGLF/Tasks/Resonances/kstar892LightIon.cxx +++ b/PWGLF/Tasks/Resonances/kstar892LightIon.cxx @@ -175,8 +175,6 @@ struct Kstar892LightIon { Configurable selectCentEstimator{"selectCentEstimator", 0, "Select centrality estimator: 0 - FT0M, 1 - FT0A, 2 - FT0C, 3 - FV0A"}; - Configurable reflectionType{"reflectionType", 0, "Reflection: 0=Rho, 1=Omega, 2=Phi, 3=Kstar (for processRecReflection)"}; - Configurable nchAcceptance{"nchAcceptance", 0.5, "Eta window to measure Nch MC for Nch vs Cent distribution"}; Configurable nBinsNch{"nBinsNch", 400, "N bins Nch (|eta|<0.8)"}; @@ -208,13 +206,6 @@ struct Kstar892LightIon { kProton }; - enum PartReflection { - kRho, - kOmega, - kPhi, - kKstar - }; - int noOfDaughters = 2; double pionPIDpTlow = 1, pionPIDpThigh = 2.5, kaonPIDpTlow = 0.7, kaonPIDpThigh = 2.5; @@ -384,7 +375,10 @@ struct Kstar892LightIon { } if (doprocessRecReflection) { - hMC.add("Reflections/hReflection", "Refelction template of Rho", kTH3F, {ptAxis, centralityAxis, invmassAxis}); + hMC.add("Reflections/hRhoToKpi", "Refelction template of Rho", kTH3F, {ptAxis, centralityAxis, invmassAxis}); + hMC.add("Reflections/hOmegaToKpi", "Refelction template of Omega", kTH3F, {ptAxis, centralityAxis, invmassAxis}); + hMC.add("Reflections/hPhiToKpi", "Refelction template of Phi", kTH3F, {ptAxis, centralityAxis, invmassAxis}); + hMC.add("Reflections/hKstarSelf", "Refelction template of Kstar", kTH3F, {ptAxis, centralityAxis, invmassAxis}); } if (doprocessMCCheck) { @@ -1905,6 +1899,8 @@ struct Kstar892LightIon { if (!selectionEvent(collision, false)) return; + centrality = -1.f; + if (selectCentEstimator == kFT0M) { centrality = collision.centFT0M(); } else if (selectCentEstimator == kFT0A) { @@ -1914,10 +1910,11 @@ struct Kstar892LightIon { } else if (selectCentEstimator == kFV0A) { centrality = collision.centFV0A(); } else { - centrality = collision.centFT0M(); // default + centrality = collision.centFT0M(); } - for (const auto& [track1, track2] : combinations(CombinationsFullIndexPolicy(tracks, tracks))) { + for (const auto& [track1, track2] : + combinations(CombinationsFullIndexPolicy(tracks, tracks))) { if (!selectionTrack(track1) || !selectionTrack(track2)) continue; @@ -1943,8 +1940,8 @@ struct Kstar892LightIon { for (const auto& m1 : mc1.mothers_as()) { for (const auto& m2 : mc2.mothers_as()) { if (m1.globalIndex() == m2.globalIndex()) { - motherPDG = std::abs(m1.pdgCode()); sameMother = true; + motherPDG = std::abs(m1.pdgCode()); break; } } @@ -1955,101 +1952,92 @@ struct Kstar892LightIon { if (!sameMother) continue; - if (reflectionType == kRho) { // Rho0 (770) -> pi pi -> K pi - if (motherPDG != PDG_t::kRho770_0) - continue; + int pdg1 = std::abs(mc1.pdgCode()); + int pdg2 = std::abs(mc2.pdgCode()); - if (std::abs(mc1.pdgCode()) != PDG_t::kPiPlus || - std::abs(mc2.pdgCode()) != PDG_t::kPiPlus) - continue; + // ===================================================== + // Rho0 (770) -> pi pi -> K pi + // ===================================================== + if (motherPDG == PDG_t::kRho770_0 && pdg1 == PDG_t::kPiPlus && pdg2 == PDG_t::kPiPlus) { - // ---- permutation 1: track1 -> K + // track 1 -> K ROOT::Math::PxPyPzMVector p1K(track1.px(), track1.py(), track1.pz(), massKa); ROOT::Math::PxPyPzMVector p2Pi(track2.px(), track2.py(), track2.pz(), massPi); - auto fake1 = p1K + p2Pi; if (fake1.Rapidity() > selectionConfig.motherRapidityMin && fake1.Rapidity() < selectionConfig.motherRapidityMax) - hMC.fill(HIST("Reflections/hReflection"), fake1.Pt(), centrality, fake1.M()); + hMC.fill(HIST("Reflections/hRhoToKpi"), fake1.Pt(), centrality, fake1.M()); - // ---- permutation 2: track2 -> K + // track 2 -> K ROOT::Math::PxPyPzMVector p1Pi(track1.px(), track1.py(), track1.pz(), massPi); ROOT::Math::PxPyPzMVector p2K(track2.px(), track2.py(), track2.pz(), massKa); - auto fake2 = p1Pi + p2K; if (fake2.Rapidity() > selectionConfig.motherRapidityMin && fake2.Rapidity() < selectionConfig.motherRapidityMax) - hMC.fill(HIST("Reflections/hReflection"), fake2.Pt(), centrality, fake2.M()); - - } else if (reflectionType == kOmega) { // Omega (782) -> pi pi (pi0) -> K pi - if (motherPDG != o2::constants::physics::kOmega) - continue; + hMC.fill(HIST("Reflections/hRhoToKpi"), fake2.Pt(), centrality, fake2.M()); + } - if (std::abs(mc1.pdgCode()) != PDG_t::kPiPlus || - std::abs(mc2.pdgCode()) != PDG_t::kPiPlus) - continue; + // ===================================================== + // Omega (782) -> pi pi(pi0) -> K pi + // ===================================================== + if (motherPDG == o2::constants::physics::kOmega && pdg1 == PDG_t::kPiPlus && pdg2 == PDG_t::kPiPlus) { - // same two permutations as rho + // track 1 -> K ROOT::Math::PxPyPzMVector p1K(track1.px(), track1.py(), track1.pz(), massKa); ROOT::Math::PxPyPzMVector p2Pi(track2.px(), track2.py(), track2.pz(), massPi); - auto fake1 = p1K + p2Pi; if (fake1.Rapidity() > selectionConfig.motherRapidityMin && fake1.Rapidity() < selectionConfig.motherRapidityMax) - hMC.fill(HIST("Reflections/hReflection"), fake1.Pt(), centrality, fake1.M()); + hMC.fill(HIST("Reflections/hOmegaToKpi"), fake1.Pt(), centrality, fake1.M()); + // track 2 -> K ROOT::Math::PxPyPzMVector p1Pi(track1.px(), track1.py(), track1.pz(), massPi); ROOT::Math::PxPyPzMVector p2K(track2.px(), track2.py(), track2.pz(), massKa); - auto fake2 = p1Pi + p2K; if (fake2.Rapidity() > selectionConfig.motherRapidityMin && fake2.Rapidity() < selectionConfig.motherRapidityMax) - hMC.fill(HIST("Reflections/hReflection"), fake2.Pt(), centrality, fake2.M()); - - } else if (reflectionType == kPhi) { // Phi (1020) -> K K -> K pi - if (motherPDG != o2::constants::physics::kPhi) - continue; + hMC.fill(HIST("Reflections/hOmegaToKpi"), fake2.Pt(), centrality, fake2.M()); + } - if (std::abs(mc1.pdgCode()) != PDG_t::kKPlus || std::abs(mc2.pdgCode()) != PDG_t::kKPlus) - continue; + // ===================================================== + // Phi (1020) -> KK -> K pi + // ===================================================== + if (motherPDG == o2::constants::physics::kPhi && pdg1 == PDG_t::kKPlus && pdg2 == PDG_t::kKPlus) { - // ---- permutation 1: track1 -> π + // track 1 -> pi ROOT::Math::PxPyPzMVector p1Pi(track1.px(), track1.py(), track1.pz(), massPi); ROOT::Math::PxPyPzMVector p2K(track2.px(), track2.py(), track2.pz(), massKa); - auto fake1 = p1Pi + p2K; if (fake1.Rapidity() > selectionConfig.motherRapidityMin && fake1.Rapidity() < selectionConfig.motherRapidityMax) - hMC.fill(HIST("Reflections/hReflection"), fake1.Pt(), centrality, fake1.M()); + hMC.fill(HIST("Reflections/hPhiToKpi"), fake1.Pt(), centrality, fake1.M()); - // ---- permutation 2: track2 -> π + // track 2 -> pi ROOT::Math::PxPyPzMVector p1K(track1.px(), track1.py(), track1.pz(), massKa); ROOT::Math::PxPyPzMVector p2Pi(track2.px(), track2.py(), track2.pz(), massPi); - auto fake2 = p1K + p2Pi; if (fake2.Rapidity() > selectionConfig.motherRapidityMin && fake2.Rapidity() < selectionConfig.motherRapidityMax) - hMC.fill(HIST("Reflections/hReflection"), fake2.Pt(), centrality, fake2.M()); - } else if (reflectionType == kKstar) { // K*0 (892) Self-Reflection (swap) - - if (motherPDG != o2::constants::physics::kK0Star892) - continue; + hMC.fill(HIST("Reflections/hPhiToKpi"), fake2.Pt(), centrality, fake2.M()); + } - if (!((std::abs(mc1.pdgCode()) == PDG_t::kPiPlus && std::abs(mc2.pdgCode()) == PDG_t::kKPlus) || (std::abs(mc1.pdgCode()) == PDG_t::kKPlus && std::abs(mc2.pdgCode()) == PDG_t::kPiPlus))) - continue; + // ===================================================== + // K*0 Self-reflection + // ===================================================== + if (motherPDG == o2::constants::physics::kK0Star892 && ((pdg1 == PDG_t::kPiPlus && pdg2 == PDG_t::kKPlus) || (pdg1 == PDG_t::kKPlus && pdg2 == PDG_t::kPiPlus))) { - ROOT::Math::PxPyPzMVector p1Swap(track1.px(), track1.py(), track1.pz(), std::abs(mc1.pdgCode()) == PDG_t::kKPlus ? massPi : massKa); + ROOT::Math::PxPyPzMVector p1Swap(track1.px(), track1.py(), track1.pz(), pdg1 == PDG_t::kKPlus ? massPi : massKa); - ROOT::Math::PxPyPzMVector p2Swap(track2.px(), track2.py(), track2.pz(), std::abs(mc2.pdgCode()) == PDG_t::kKPlus ? massPi : massKa); + ROOT::Math::PxPyPzMVector p2Swap(track2.px(), track2.py(), track2.pz(), pdg2 == PDG_t::kKPlus ? massPi : massKa); auto fake = p1Swap + p2Swap; if (fake.Rapidity() > selectionConfig.motherRapidityMin && fake.Rapidity() < selectionConfig.motherRapidityMax) - hMC.fill(HIST("Reflections/hReflection"), fake.Pt(), centrality, fake.M()); + hMC.fill(HIST("Reflections/hKstarSelf"), fake.Pt(), centrality, fake.M()); } } } - PROCESS_SWITCH(Kstar892LightIon, processRecReflection, "Process particle reflection", false); + PROCESS_SWITCH(Kstar892LightIon, processRecReflection, "Process reconstructed reflections", false); Service pdg;