From 690c0e4f9669e76a2bce14a29a38436fe6152f85 Mon Sep 17 00:00:00 2001 From: Yash Patley <52608802+yashpatley@users.noreply.github.com> Date: Fri, 14 Nov 2025 19:56:50 +0530 Subject: [PATCH 1/2] [PWGCF] : Update lambdaR2Correlation.cxx --- .../Tasks/lambdaR2Correlation.cxx | 79 +++++++++---------- 1 file changed, 36 insertions(+), 43 deletions(-) diff --git a/PWGCF/TwoParticleCorrelations/Tasks/lambdaR2Correlation.cxx b/PWGCF/TwoParticleCorrelations/Tasks/lambdaR2Correlation.cxx index 19f13856746..1f27fc02f47 100644 --- a/PWGCF/TwoParticleCorrelations/Tasks/lambdaR2Correlation.cxx +++ b/PWGCF/TwoParticleCorrelations/Tasks/lambdaR2Correlation.cxx @@ -1489,11 +1489,11 @@ struct LambdaSpinCorrelation { Configurable cNPtBins{"cNPtBins", 30, "N pT Bins"}; Configurable cMinPt{"cMinPt", 0.5, "pT Min"}; Configurable cMaxPt{"cMaxPt", 3.5, "pT Max"}; - Configurable cNRapBins{"cNRapBins", 20, "N Rapidity Bins"}; + Configurable cNRapBins{"cNRapBins", 10, "N Rapidity Bins"}; Configurable cMinRap{"cMinRap", -0.5, "Minimum Rapidity"}; Configurable cMaxRap{"cMaxRap", 0.5, "Maximum Rapidity"}; Configurable cNPhiBins{"cNPhiBins", 36, "N Phi Bins"}; - Configurable cAnaPairs{"cAnaPairs", false, "Analyze Pairs Flag"}; + Configurable cNBinsCosTS{"cNBinsCosTS", 10, "N CosTS Bins"}; Configurable cInvBoostFlag{"cInvBoostFlag", true, "Inverse Boost Flag"}; // Centrality Axis @@ -1517,25 +1517,27 @@ struct LambdaSpinCorrelation { const AxisSpec axisEta(cNRapBins, cMinRap, cMaxRap, "#eta"); const AxisSpec axisRap(cNRapBins, cMinRap, cMaxRap, "y"); const AxisSpec axisPhi(cNPhiBins, 0., TwoPI, "#varphi (rad)"); + const AxisSpec axisDRap(2 * cNRapBins, cMinRap - cMaxRap, cMaxRap - cMinRap, "#Deltay"); const AxisSpec axisDPhi(cNPhiBins, -PI, PI, "#Delta#varphi"); + const AxisSpec axisCosTS(cNBinsCosTS, -1, 1, "cos(#theta*)"); + const AxisSpec axisDR(10, 0, 2, "#DeltaR"); // Single and Two Particle Densities // 1D Histograms - histos.add("Reco/h2f_n2_mass_LaPLaM", "m_{inv}^{#Lambda} vs m_{inv}^{#bar{#Lambda}}", kTH2F, {axisMass, axisMass}); - histos.add("Reco/h2f_n2_mass_LaPLaP", "m_{inv}^{#Lambda} vs m_{inv}^{#Lambda}", kTH2F, {axisMass, axisMass}); - histos.add("Reco/h2f_n2_mass_LaMLaM", "m_{inv}^{#bar{#Lambda}} vs m_{inv}^{#bar{#Lambda}}", kTH2F, {axisMass, axisMass}); - - // rho1 for C2 - histos.add("RecoCorr/h2f_n1_phi_LaP", "#rho_{1}^{#Lambda}", kTH2F, {axisCent, axisPhi}); - histos.add("RecoCorr/h2f_n1_phi_LaM", "#rho_{1}^{#bar{#Lambda}}", kTH2F, {axisCent, axisPhi}); + histos.add("Reco/h2f_n2_mass_LaPLaM", "m_{inv}^{#Lambda} vs m_{inv}^{#bar{#Lambda}}", kTHnSparseF, {axisMass, axisMass, axisPt, axisPt}); + histos.add("Reco/h2f_n2_mass_LaPLaP", "m_{inv}^{#Lambda} vs m_{inv}^{#Lambda}", kTHnSparseF, {axisMass, axisMass, axisPt, axisPt}); + histos.add("Reco/h2f_n2_mass_LaMLaM", "m_{inv}^{#bar{#Lambda}} vs m_{inv}^{#bar{#Lambda}}", kTHnSparseF, {axisMass, axisMass, axisPt, axisPt}); // rho2 for C2 - histos.add("RecoCorr/h2f_n2_dphi_LaPLaM", "#rho_{2}^{#Lambda#bar{#Lambda}}", kTH2F, {axisCent, axisDPhi}); - histos.add("RecoCorr/h2f_n2_dphi_LaPLaP", "#rho_{2}^{#Lambda#Lambda}", kTH2F, {axisCent, axisDPhi}); - histos.add("RecoCorr/h2f_n2_dphi_LaMLaM", "#rho_{2}^{#bar{#Lambda}#bar{#Lambda}}", kTH2F, {axisCent, axisDPhi}); - histos.add("RecoCorr/h2f_n2_phiphi_LaPLaM", "#rho_{2}^{#Lambda#bar{#Lambda}}", kTH3F, {axisCent, axisPhi, axisPhi}); - histos.add("RecoCorr/h2f_n2_phiphi_LaPLaP", "#rho_{2}^{#Lambda#Lambda}", kTH3F, {axisCent, axisPhi, axisPhi}); - histos.add("RecoCorr/h2f_n2_phiphi_LaMLaM", "#rho_{2}^{#bar{#Lambda}#bar{#Lambda}}", kTH3F, {axisCent, axisPhi, axisPhi}); + histos.add("RecoCorr/h2f_n2_dlta_LaPLaM", "#rho_{2}^{#Lambda#bar{#Lambda}}", kTHnSparseF, {axisCent, axisDRap, axisDPhi, axisDR}); + histos.add("RecoCorr/h2f_n2_dlta_LaPLaP", "#rho_{2}^{#Lambda#Lambda}", kTHnSparseF, {axisCent, axisDRap, axisDPhi, axisDR}); + histos.add("RecoCorr/h2f_n2_dlta_LaMLaM", "#rho_{2}^{#bar{#Lambda}#bar{#Lambda}}", kTHnSparseF, {axisCent, axisDRap, axisDPhi, axisCosTS}); + histos.add("RecoCorr/h2f_n2_cphi_LaPLaM", "#rho_{2}^{#Lambda#bar{#Lambda}}", kTHnSparseF, {axisCent, axisDRap, axisDPhi, axisCosTS}); + histos.add("RecoCorr/h2f_n2_cphi_LaPLaP", "#rho_{2}^{#Lambda#Lambda}", kTHnSparseF, {axisCent, axisDRap, axisDPhi, axisCosTS}); + histos.add("RecoCorr/h2f_n2_cphi_LaMLaM", "#rho_{2}^{#bar{#Lambda}#bar{#Lambda}}", kTHnSparseF, {axisCent, axisDRap, axisDPhi, axisCosTS}); + histos.add("RecoCorr/h2f_n2_dphi_LaPLaM", "#rho_{2}^{#Lambda#bar{#Lambda}}", kTHnSparseF, {axisCent, axisDRap, axisDPhi, axisDPhi}); + histos.add("RecoCorr/h2f_n2_dphi_LaPLaP", "#rho_{2}^{#Lambda#Lambda}", kTHnSparseF, {axisCent, axisDRap, axisDPhi, axisDPhi}); + histos.add("RecoCorr/h2f_n2_dphi_LaMLaM", "#rho_{2}^{#bar{#Lambda}#bar{#Lambda}}", kTHnSparseF, {axisCent, axisDRap, axisDPhi, axisDPhi}); } void getBoostVector(std::array const& p, std::array& v, bool inverseBoostFlag = true) @@ -1569,7 +1571,9 @@ struct LambdaSpinCorrelation { static constexpr std::string_view SubDirHist[] = {"LaPLaM", "LaPLaP", "LaMLaM"}; // Fill lambda pair mass - histos.fill(HIST("Reco/h2f_n2_mass_") + HIST(SubDirHist[part_pair]), p1.mass(), p2.mass()); + histos.fill(HIST("Reco/h2f_n2_mass_") + HIST(SubDirHist[part_pair]), p1.mass(), p2.mass(), p1.pt(), p2.pt()); + float drap = p1.rap() - p2.rap(); + float dphi = RecoDecay::constrainAngle(p1.phi() - p2.phi(), -PI); // Get Lambda-Proton four-momentum std::array l1 = {p1.px(), p1.py(), p1.pz(), MassLambda0}; @@ -1582,26 +1586,21 @@ struct LambdaSpinCorrelation { boost(pr1, v1); boost(pr2, v2); - // Fill pair density - histos.fill(HIST("RecoCorr/h2f_n2_phiphi_") + HIST(SubDirHist[part_pair]), cent, RecoDecay::constrainAngle(RecoDecay::phi(pr1)), RecoDecay::phi(pr2)); - histos.fill(HIST("RecoCorr/h2f_n2_dphi_") + HIST(SubDirHist[part_pair]), cent, RecoDecay::constrainAngle(RecoDecay::phi(pr1) - RecoDecay::phi(pr2), -PI)); - } + float cdot = pr1[0] * pr2[0] + pr1[1] * pr2[1] + pr1[2] * pr2[2]; + float mag1 = std::sqrt(pr1[0] * pr1[0] + pr1[1] * pr1[1] + pr1[2] * pr1[2]); + float mag2 = std::sqrt(pr2[0] * pr2[0] + pr2[1] * pr2[1] + pr2[2] * pr2[2]); + float cphi = cdot / (mag1 * mag2); - template - void analyzeSingles(T const& tracks) - { - static constexpr std::string_view SubDirHist[] = {"LaP", "LaM"}; - for (auto const& track : tracks) { - // Get four-momentum of lambda - std::array l = {MassLambda0, track.px(), track.py(), track.pz()}; - std::array p = {MassProton, track.prPx(), track.prPy(), track.prPz()}; - std::array v; - getBoostVector(l, v, cInvBoostFlag); - boost(p, v); + std::array pr1tv = {pr1[0], pr1[1], pr1[2]}; + std::array pr2tv = {pr2[0], pr2[1], pr2[2]}; + float prdphi = RecoDecay::constrainAngle(RecoDecay::phi(pr1) - RecoDecay::phi(pr2), -PI); + float prdrap = RecoDecay::eta(pr1tv) - RecoDecay::eta(pr2tv); + float dr = std::sqrt(prdrap * prdrap + prdphi * prdphi); - // Fill single histograms - histos.fill(HIST("RecoCorr/h2f_n1_phi_") + HIST(SubDirHist[part]), cent, RecoDecay::constrainAngle(RecoDecay::phi(p))); - } + // Fill pair density + histos.fill(HIST("RecoCorr/h2f_n2_dphi_") + HIST(SubDirHist[part_pair]), cent, drap, dphi, RecoDecay::constrainAngle(RecoDecay::phi(pr1) - RecoDecay::phi(pr2), -PI)); + histos.fill(HIST("RecoCorr/h2f_n2_cphi_") + HIST(SubDirHist[part_pair]), cent, drap, dphi, cphi); + histos.fill(HIST("RecoCorr/h2f_n2_dlta_") + HIST(SubDirHist[part_pair]), cent, drap, dphi, dr); } template @@ -1637,15 +1636,9 @@ struct LambdaSpinCorrelation { auto lambdaTracks = partLambdaTracks->sliceByCached(aod::lambdatrack::lambdaCollisionId, collision.globalIndex(), cache); auto antiLambdaTracks = partAntiLambdaTracks->sliceByCached(aod::lambdatrack::lambdaCollisionId, collision.globalIndex(), cache); - - analyzeSingles(lambdaTracks); - analyzeSingles(antiLambdaTracks); - - if (cAnaPairs) { - analyzePairs(lambdaTracks, antiLambdaTracks); - analyzePairs(lambdaTracks, lambdaTracks); - analyzePairs(antiLambdaTracks, antiLambdaTracks); - } + analyzePairs(lambdaTracks, antiLambdaTracks); + analyzePairs(lambdaTracks, lambdaTracks); + analyzePairs(antiLambdaTracks, antiLambdaTracks); } PROCESS_SWITCH(LambdaSpinCorrelation, processDataReco, "Process for Data and MCReco", false); From 9455ee5a70dd6d72a3881a58914410922a95d925 Mon Sep 17 00:00:00 2001 From: Yash Patley <52608802+yashpatley@users.noreply.github.com> Date: Fri, 14 Nov 2025 23:04:22 +0530 Subject: [PATCH 2/2] Refactor correlation calculation using utility functions --- PWGCF/TwoParticleCorrelations/Tasks/lambdaR2Correlation.cxx | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/PWGCF/TwoParticleCorrelations/Tasks/lambdaR2Correlation.cxx b/PWGCF/TwoParticleCorrelations/Tasks/lambdaR2Correlation.cxx index 1f27fc02f47..0d0d75c58bb 100644 --- a/PWGCF/TwoParticleCorrelations/Tasks/lambdaR2Correlation.cxx +++ b/PWGCF/TwoParticleCorrelations/Tasks/lambdaR2Correlation.cxx @@ -1586,13 +1586,9 @@ struct LambdaSpinCorrelation { boost(pr1, v1); boost(pr2, v2); - float cdot = pr1[0] * pr2[0] + pr1[1] * pr2[1] + pr1[2] * pr2[2]; - float mag1 = std::sqrt(pr1[0] * pr1[0] + pr1[1] * pr1[1] + pr1[2] * pr1[2]); - float mag2 = std::sqrt(pr2[0] * pr2[0] + pr2[1] * pr2[1] + pr2[2] * pr2[2]); - float cphi = cdot / (mag1 * mag2); - std::array pr1tv = {pr1[0], pr1[1], pr1[2]}; std::array pr2tv = {pr2[0], pr2[1], pr2[2]}; + float cphi = RecoDecay::dotProd(pr1tv, pr2tv) / (RecoDecay::sqrtSumOfSquares(pr1tv[0], pr1tv[1], pr1tv[2]) * RecoDecay::sqrtSumOfSquares(pr2tv[0], pr2tv[1], pr2tv[2])); float prdphi = RecoDecay::constrainAngle(RecoDecay::phi(pr1) - RecoDecay::phi(pr2), -PI); float prdrap = RecoDecay::eta(pr1tv) - RecoDecay::eta(pr2tv); float dr = std::sqrt(prdrap * prdrap + prdphi * prdphi);