From 0a4fa69051717640ca447f13d528c092c5f75c28 Mon Sep 17 00:00:00 2001 From: fchinu Date: Tue, 17 Nov 2026 10:01:09 +0100 Subject: [PATCH] Add abscos3muK variable for B+ to J/Psi K analysis --- PWGHF/Core/HfHelper.h | 78 ++++++++++++++------- PWGHF/D2H/Tasks/taskBplusToJpsiKReduced.cxx | 3 + 2 files changed, 54 insertions(+), 27 deletions(-) diff --git a/PWGHF/Core/HfHelper.h b/PWGHF/Core/HfHelper.h index 155dfda35f2..2bbe1adab7c 100644 --- a/PWGHF/Core/HfHelper.h +++ b/PWGHF/Core/HfHelper.h @@ -309,44 +309,42 @@ struct HfHelper { return std::abs(massKKPairDsToPiKK(candidate) - o2::constants::physics::MassPhi); } - /// Calculate the cosine of the angle between the pion and the opposite sign kaon in the phi rest frame - /// \param candidate Ds candidate from aod::HfCand3Prong table - /// \param option mass hypothesis considered: 0 = KKPi, 1 = PiKK - /// \return cosine of pion-kaon angle in the phi rest frame + /// Calculate the cosine of the angle between two particles in the rest frame of two particles + /// \param candidate Candidate with three prongs + /// \param massHypo mass array of the three prongs in the order of prong0, prong1, prong2 + /// \param prong0ForRestFrame index of the first prong to define the rest frame (0, 1, or 2) + /// \param prong1ForRestFrame index of the second prong to define the rest frame (0, 1, or 2) + /// \return cosine of the angle between the two particles in the rest frame of two particles template - static auto cosPiKPhiRestFrame(const T& candidate, int option) + static auto cosABInRestFrame(const T& candidate, std::array massHypo, int prong0ForRestFrame, int prong1ForRestFrame) { // Ported from AliAODRecoDecayHF3Prong::CosPiKPhiRFrame - std::array momPi{}; - std::array momK1{}; - std::array momK2{}; + std::array momProng0{}; + std::array momProng1{}; + std::array momProng2{}; - if (option == 0) { // KKPi - momPi = candidate.pVectorProng2(); - momK1 = candidate.pVectorProng1(); - momK2 = candidate.pVectorProng0(); - } else { // PiKK - momPi = candidate.pVectorProng0(); - momK1 = candidate.pVectorProng1(); - momK2 = candidate.pVectorProng2(); - } + momProng0 = candidate.pVectorProng0(); + momProng1 = candidate.pVectorProng1(); + momProng2 = candidate.pVectorProng2(); - ROOT::Math::PxPyPzMVector const vecPi(momPi[0], momPi[1], momPi[2], o2::constants::physics::MassPiPlus); - ROOT::Math::PxPyPzMVector const vecK1(momK1[0], momK1[1], momK1[2], o2::constants::physics::MassKPlus); - ROOT::Math::PxPyPzMVector const vecK2(momK2[0], momK2[1], momK2[2], o2::constants::physics::MassKPlus); - ROOT::Math::PxPyPzMVector const vecPhi = vecK1 + vecK2; + auto prongForAngle = 3 - prong0ForRestFrame - prong1ForRestFrame; + ROOT::Math::PxPyPzMVector const vecProng0(momProng0[0], momProng0[1], momProng0[2], massHypo[0]); + ROOT::Math::PxPyPzMVector const vecProng1(momProng1[0], momProng1[1], momProng1[2], massHypo[1]); + ROOT::Math::PxPyPzMVector const vecProng2(momProng2[0], momProng2[1], momProng2[2], massHypo[2]); + std::array vecProngs{vecProng0, vecProng1, vecProng2}; + ROOT::Math::PxPyPzMVector const vecRestFrame = vecProngs[prong0ForRestFrame] + vecProngs[prong1ForRestFrame]; - ROOT::Math::Boost const boostToPhiRestFrame(vecPhi.BoostToCM()); - auto momPiPhiRestFrame = boostToPhiRestFrame(vecPi).Vect(); - auto momK1PhiRestFrame = boostToPhiRestFrame(vecK1).Vect(); + ROOT::Math::Boost const boostToPhiRestFrame(vecRestFrame.BoostToCM()); + auto momProng0ForAngle = boostToPhiRestFrame(vecProngs[prongForAngle]).Vect(); + auto momProng1ForAngle = boostToPhiRestFrame(vecProngs[prong1ForRestFrame]).Vect(); - return momPiPhiRestFrame.Dot(momK1PhiRestFrame) / std::sqrt(momPiPhiRestFrame.Mag2() * momK1PhiRestFrame.Mag2()); + return momProng0ForAngle.Dot(momProng1ForAngle) / std::sqrt(momProng0ForAngle.Mag2() * momProng1ForAngle.Mag2()); } template static auto cos3PiKDsToKKPi(const T& candidate) { - auto cosPiK = cosPiKPhiRestFrame(candidate, 0); + auto cosPiK = cosABInRestFrame(candidate, std::array{o2::constants::physics::MassKPlus, o2::constants::physics::MassKPlus, o2::constants::physics::MassPiPlus}, 0, 1); return cosPiK * cosPiK * cosPiK; } @@ -359,7 +357,7 @@ struct HfHelper { template static auto cos3PiKDsToPiKK(const T& candidate) { - auto cosPiK = cosPiKPhiRestFrame(candidate, 1); + auto cosPiK = cosABInRestFrame(candidate, std::array{o2::constants::physics::MassPiPlus, o2::constants::physics::MassKPlus, o2::constants::physics::MassKPlus}, 1, 2); return cosPiK * cosPiK * cosPiK; } @@ -369,6 +367,32 @@ struct HfHelper { return std::abs(cos3PiKDsToPiKK(candidate)); } + template + static auto cos3MuKBpToMuMuK(const T& candidate) + { + auto cosMuK = cosABInRestFrame(candidate, std::array{o2::constants::physics::MassMuon, o2::constants::physics::MassMuon, o2::constants::physics::MassKPlus}, 0, 1); + return cosMuK * cosMuK * cosMuK; + } + + template + static auto absCos3MuKBpToMuMuK(const T& candidate) + { + return std::abs(cos3MuKBpToMuMuK(candidate)); + } + + template + static auto cos3MuKBpToKMuMu(const T& candidate) + { + auto cosMuK = cosABInRestFrame(candidate, std::array{o2::constants::physics::MassKPlus, o2::constants::physics::MassMuon, o2::constants::physics::MassMuon}, 1, 2); + return cosMuK * cosMuK * cosMuK; + } + + template + static auto absCos3MuKBpToKMuMu(const T& candidate) + { + return std::abs(cos3MuKBpToKMuMu(candidate)); + } + // Λc± → p± K∓ π± template diff --git a/PWGHF/D2H/Tasks/taskBplusToJpsiKReduced.cxx b/PWGHF/D2H/Tasks/taskBplusToJpsiKReduced.cxx index 6f1ea153985..a83bee8e39c 100644 --- a/PWGHF/D2H/Tasks/taskBplusToJpsiKReduced.cxx +++ b/PWGHF/D2H/Tasks/taskBplusToJpsiKReduced.cxx @@ -117,6 +117,7 @@ DECLARE_SOA_COLUMN(ImpactParameterProductJpsi, impactParameterProductJpsi, float DECLARE_SOA_COLUMN(ImpactParameterJpsiDauPos, impactParameterJpsiDauPos, float); //! Impact parameter of Jpsi daughter candidate DECLARE_SOA_COLUMN(ImpactParameterJpsiDauNeg, impactParameterJpsiDauNeg, float); //! Impact parameter of Jpsi daughter candidate DECLARE_SOA_COLUMN(ImpactParameterLfTrack0, impactParameterLfTrack0, float); //! Impact parameter of Phi daughter candidate +DECLARE_SOA_COLUMN(AbsCos3MuKBpToMuMuK, absCos3MuKBpToMuMuK, float); //! Absolute value of the cosine of the angle between one of the muons and the kaon in the J/Psi rest frame DECLARE_SOA_COLUMN(Cpa, cpa, float); //! Cosine pointing angle of candidate DECLARE_SOA_COLUMN(CpaXY, cpaXY, float); //! Cosine pointing angle of candidate in transverse plane DECLARE_SOA_COLUMN(CpaJpsi, cpaJpsi, float); //! Cosine pointing angle of Jpsi daughter candidate @@ -144,6 +145,7 @@ DECLARE_SOA_TABLE(HfRedCandBpLites, "AOD", "HFREDCANDBPLITE", //! Table with som hf_cand_bplustojpsik_lite::ImpactParameterProduct, hf_cand_bplustojpsik_lite::ImpactParameterProductJpsi, hf_cand_bplustojpsik_lite::MaxNormalisedDeltaIP, + hf_cand_bplustojpsik_lite::AbsCos3MuKBpToMuMuK, hf_cand_bplustojpsik_lite::MlScoreSig, // hf_sel_candidate_bplus::IsSelBplusToJpsiPi, // Jpsi meson features @@ -461,6 +463,7 @@ struct HfTaskBplusToJpsiKReduced { candidate.impactParameterProduct(), candidate.impactParameterProductJpsi(), candidate.maxNormalisedDeltaIP(), + HfHelper::absCos3MuKBpToMuMuK(candidate), candidateMlScoreSig, // J/Psi features invMassJpsi,