From 109c8c14442aad0be97b98bcd18e69042f6a565e Mon Sep 17 00:00:00 2001 From: Sushanta Tripathy Date: Tue, 17 Nov 2026 19:28:01 +0100 Subject: [PATCH 1/2] updates in PID cuts --- PWGLF/Tasks/Resonances/lambdastarproxy.cxx | 42 +++++++++++++++++----- 1 file changed, 33 insertions(+), 9 deletions(-) diff --git a/PWGLF/Tasks/Resonances/lambdastarproxy.cxx b/PWGLF/Tasks/Resonances/lambdastarproxy.cxx index dc677ad52da..8d9577022d3 100644 --- a/PWGLF/Tasks/Resonances/lambdastarproxy.cxx +++ b/PWGLF/Tasks/Resonances/lambdastarproxy.cxx @@ -138,6 +138,12 @@ struct Lambdastarproxy { Configurable lstarCutNsigmaTOFPr{"lstarCutNsigmaTOFPr", float{NsigmaTOFDefault}, "|nSigma^{TOF}_{p}| cut"}; Configurable lstarCutNsigmaTPCKaon{"lstarCutNsigmaTPCKaon", float{NsigmaTPCDefault}, "|nSigma^{TPC}_{K}| cut"}; Configurable lstarCutNsigmaTOFKaon{"lstarCutNsigmaTOFKaon", float{NsigmaTOFDefault}, "|nSigma^{TOF}_{K}| cut"}; + // Opt-in kaon-only window in the upper part of the TPC-only pT branch. + // Disabled by default so existing data and reconstructed-MC selections are reproducible. + Configurable lstarEnableKaonTPCAsym{"lstarEnableKaonTPCAsym", 0, "Enable the asymmetric kaon TPC window below lstarPidPtRefKaon"}; + Configurable lstarKaonTPCAsymPtMin{"lstarKaonTPCAsymPtMin", 0.3f, "Measured kaon-track pT where the asymmetric TPC window starts (GeV/c)"}; + Configurable lstarKaonTPCAsymMin{"lstarKaonTPCAsymMin", -2.f, "Strict lower TPC nSigma_K bound in the asymmetric window"}; + Configurable lstarKaonTPCAsymMax{"lstarKaonTPCAsymMax", 5.f, "Strict upper TPC nSigma_K bound in the asymmetric window"}; Configurable lstarCutNsigmaTPCDe{"lstarCutNsigmaTPCDe", float{NsigmaTPCDefault}, "|nSigma^{TPC}_{d}| cut"}; Configurable lstarCutNsigmaTOFDe{"lstarCutNsigmaTOFDe", float{NsigmaTOFDefault}, "|nSigma^{TOF}_{d}| cut"}; Configurable lstarEnableTOFNsigmaCutDe{"lstarEnableTOFNsigmaCutDe", 0, "Enable deuteron-only TOF nSigma cut in PID strategy 2"}; @@ -619,6 +625,7 @@ struct Lambdastarproxy { } validateDeuteronRefinements(); validatePtDependentDcaZ(); + validateKaonTPCAsym(); if (trackSpectraConfig.lstarEnableTrackSpectra.value != 0 && ((!doprocess.value && !doprocessMCReco.value) || !std::isfinite(trackSpectraConfig.lstarTrackSpectraAbsYMax.value) || trackSpectraConfig.lstarTrackSpectraAbsYMax.value <= 0.f)) { LOGF(fatal, "Track spectra require data or reconstructed MC and a positive finite spectra rapidity window"); @@ -1704,7 +1711,7 @@ struct Lambdastarproxy { probe.nominal = passFinalCandidatePID(track.pt(), tpc[role], tof[role], true, lstarCutNsigmaTPCDe.value, lstarCutNsigmaTOFDe.value, lstarPidCircularCutDe.value, lstarPidPtRefDe.value, true) && passOptionalDeuteronTOFExtras(track) && passDeuteronRefinements(track) && (lstarProxyUseProtonPIDAsDeuteron.value == 0 || passProton); } else { - probe.nominal = passFinalCandidatePID(track.pt(), tpc[role], tof[role], true, lstarCutNsigmaTPCKaon.value, lstarCutNsigmaTOFKaon.value, lstarPidCircularCutKaon.value, lstarPidPtRefKaon.value); + probe.nominal = passKaonCandidatePID(track.pt(), tpc[role], tof[role], true); } if constexpr (IsMC) { probe.truth = trackTruth(track, collisionId); @@ -2086,6 +2093,30 @@ struct Lambdastarproxy { return true; } + void validateKaonTPCAsym() const + { + if (lstarEnableKaonTPCAsym.value == 0) { + return; + } + if (!std::isfinite(lstarKaonTPCAsymPtMin.value) || lstarKaonTPCAsymPtMin.value < 0.f || + !std::isfinite(lstarPidPtRefKaon.value) || lstarKaonTPCAsymPtMin.value >= lstarPidPtRefKaon.value || + !std::isfinite(lstarKaonTPCAsymMin.value) || !std::isfinite(lstarKaonTPCAsymMax.value) || + lstarKaonTPCAsymMin.value >= lstarKaonTPCAsymMax.value || + !std::isfinite(lstarCutNsigmaTPCKaon.value) || lstarCutNsigmaTPCKaon.value <= 0.f) { + LOGF(fatal, "Asymmetric kaon TPC PID requires finite ordered nSigma bounds, a positive symmetric cut, and 0 <= lstarKaonTPCAsymPtMin < lstarPidPtRefKaon"); + } + } + + bool passKaonCandidatePID(float pt, float nsTPC, float nsTOF, bool hasTof) const + { + if (lstarEnableKaonTPCAsym.value != 0 && pt >= lstarKaonTPCAsymPtMin.value && pt < lstarPidPtRefKaon.value) { + return std::isfinite(nsTPC) && nsTPC > lstarKaonTPCAsymMin.value && nsTPC < lstarKaonTPCAsymMax.value; + } + return passFinalCandidatePID(pt, nsTPC, nsTOF, hasTof, + lstarCutNsigmaTPCKaon.value, lstarCutNsigmaTOFKaon.value, + lstarPidCircularCutKaon.value, lstarPidPtRefKaon.value); + } + bool passFinalCandidatePID(float pt, float nsTPC, float nsTOF, bool hasTof, float tpcCut, float tofCut, float circularCut, float ptRef, bool isDeuteron = false) const @@ -2630,14 +2661,7 @@ struct Lambdastarproxy { const float nsTPCK = trkK.tpcNSigmaKa(); const float nsTOFK = trkK.tofNSigmaKa(); const bool hasTofK = hasTOFMatch(trkK); - const bool isKaon = passFinalCandidatePID(ptK, - nsTPCK, - nsTOFK, - hasTofK, - lstarCutNsigmaTPCKaon.value, - lstarCutNsigmaTOFKaon.value, - lstarPidCircularCutKaon.value, - lstarPidPtRefKaon.value, false); + const bool isKaon = passKaonCandidatePID(ptK, nsTPCK, nsTOFK, hasTofK); if (!isKaon) { continue; } From 0b0357472fb8715f8cacf26cae7e605c50fdc6ae Mon Sep 17 00:00:00 2001 From: Sushanta Tripathy Date: Tue, 17 Nov 2026 19:55:24 +0100 Subject: [PATCH 2/2] Updates in PID cuts for protons and deuterons --- PWGLF/Tasks/Resonances/lambdastarproxy.cxx | 131 ++++++++++++++++----- 1 file changed, 102 insertions(+), 29 deletions(-) diff --git a/PWGLF/Tasks/Resonances/lambdastarproxy.cxx b/PWGLF/Tasks/Resonances/lambdastarproxy.cxx index 8d9577022d3..01fd1d76548 100644 --- a/PWGLF/Tasks/Resonances/lambdastarproxy.cxx +++ b/PWGLF/Tasks/Resonances/lambdastarproxy.cxx @@ -147,6 +147,20 @@ struct Lambdastarproxy { Configurable lstarCutNsigmaTPCDe{"lstarCutNsigmaTPCDe", float{NsigmaTPCDefault}, "|nSigma^{TPC}_{d}| cut"}; Configurable lstarCutNsigmaTOFDe{"lstarCutNsigmaTOFDe", float{NsigmaTOFDefault}, "|nSigma^{TOF}_{d}| cut"}; Configurable lstarEnableTOFNsigmaCutDe{"lstarEnableTOFNsigmaCutDe", 0, "Enable deuteron-only TOF nSigma cut in PID strategy 2"}; + // Group new settings to stay within the framework's top-level member limit. + // The configurable names remain flat; all features are opt-in. + struct : ConfigurableGroup { + Configurable lstarEnableProtonTPCAsym{"lstarEnableProtonTPCAsym", 0, "Enable the asymmetric proton TPC window below lstarPidPtRefPr"}; + Configurable lstarProtonTPCAsymPtMin{"lstarProtonTPCAsymPtMin", 0.5f, "Measured proton-track pT where the asymmetric TPC window starts (GeV/c)"}; + Configurable lstarProtonTPCAsymMin{"lstarProtonTPCAsymMin", -2.f, "Strict lower TPC nSigma_p bound in the asymmetric window"}; + Configurable lstarProtonTPCAsymMax{"lstarProtonTPCAsymMax", 5.f, "Strict upper TPC nSigma_p bound in the asymmetric window"}; + // Strategy 2 only: existing TOF and ITS requirements still apply. + Configurable lstarEnableDeuteronTPCAsym{"lstarEnableDeuteronTPCAsym", 0, "Enable an asymmetric deuteron TPC window in PID strategy 2"}; + Configurable lstarDeuteronTPCAsymPtMin{"lstarDeuteronTPCAsymPtMin", 0.f, "Measured deuteron-track pT where the asymmetric TPC window starts (GeV/c)"}; + Configurable lstarDeuteronTPCAsymPtMax{"lstarDeuteronTPCAsymPtMax", -1.f, "Exclusive upper measured deuteron-track pT for the asymmetric window; negative means no upper limit"}; + Configurable lstarDeuteronTPCAsymMin{"lstarDeuteronTPCAsymMin", -2.f, "Strict lower TPC nSigma_d bound in the asymmetric window"}; + Configurable lstarDeuteronTPCAsymMax{"lstarDeuteronTPCAsymMax", 4.f, "Strict upper TPC nSigma_d bound in the asymmetric window"}; + } asymmetricTPCPID; Configurable lstarProxyUseProtonPIDAsDeuteron{"lstarProxyUseProtonPIDAsDeuteron", 0, "Closure/control test: keep proxy candidates that pass the normal deuteron selection and are also proton-like, then build p_proxy = p_track/2"}; // Optional deuteron-only TOF auxiliary selections. // Defaults are OFF, so strategy 2 remains TPC nSigma only for deuterons. @@ -626,6 +640,8 @@ struct Lambdastarproxy { validateDeuteronRefinements(); validatePtDependentDcaZ(); validateKaonTPCAsym(); + validateProtonTPCAsym(); + validateDeuteronTPCAsym(); if (trackSpectraConfig.lstarEnableTrackSpectra.value != 0 && ((!doprocess.value && !doprocessMCReco.value) || !std::isfinite(trackSpectraConfig.lstarTrackSpectraAbsYMax.value) || trackSpectraConfig.lstarTrackSpectraAbsYMax.value <= 0.f)) { LOGF(fatal, "Track spectra require data or reconstructed MC and a positive finite spectra rapidity window"); @@ -1706,9 +1722,8 @@ struct Lambdastarproxy { probe.charge = static_cast(track.sign()); probe.tid = track.globalIndex(); if (role == 0) { - const bool passProton = passFinalCandidatePID(track.pt(), track.tpcNSigmaPr(), track.tofNSigmaPr(), true, - lstarCutNsigmaTPCPr.value, lstarCutNsigmaTOFPr.value, lstarPidCircularCutPr.value, lstarPidPtRefPr.value); - probe.nominal = passFinalCandidatePID(track.pt(), tpc[role], tof[role], true, lstarCutNsigmaTPCDe.value, lstarCutNsigmaTOFDe.value, lstarPidCircularCutDe.value, lstarPidPtRefDe.value, true) && + const bool passProton = passProtonCandidatePID(track.pt(), track.tpcNSigmaPr(), track.tofNSigmaPr(), true); + probe.nominal = passDeuteronCandidatePID(track.pt(), tpc[role], tof[role], true) && passOptionalDeuteronTOFExtras(track) && passDeuteronRefinements(track) && (lstarProxyUseProtonPIDAsDeuteron.value == 0 || passProton); } else { probe.nominal = passKaonCandidatePID(track.pt(), tpc[role], tof[role], true); @@ -2117,6 +2132,84 @@ struct Lambdastarproxy { lstarPidCircularCutKaon.value, lstarPidPtRefKaon.value); } + void validateProtonTPCAsym() const + { + if (asymmetricTPCPID.lstarEnableProtonTPCAsym.value == 0) { + return; + } + if (!std::isfinite(asymmetricTPCPID.lstarProtonTPCAsymPtMin.value) || asymmetricTPCPID.lstarProtonTPCAsymPtMin.value < 0.f || + !std::isfinite(lstarPidPtRefPr.value) || asymmetricTPCPID.lstarProtonTPCAsymPtMin.value >= lstarPidPtRefPr.value || + !std::isfinite(asymmetricTPCPID.lstarProtonTPCAsymMin.value) || !std::isfinite(asymmetricTPCPID.lstarProtonTPCAsymMax.value) || + asymmetricTPCPID.lstarProtonTPCAsymMin.value >= asymmetricTPCPID.lstarProtonTPCAsymMax.value || + !std::isfinite(lstarCutNsigmaTPCPr.value) || lstarCutNsigmaTPCPr.value <= 0.f) { + LOGF(fatal, "Asymmetric proton TPC PID requires finite ordered nSigma bounds, a positive symmetric cut, and 0 <= lstarProtonTPCAsymPtMin < lstarPidPtRefPr"); + } + } + + bool passProtonTPCWindow(float pt, float nsTPC) const + { + if (asymmetricTPCPID.lstarEnableProtonTPCAsym.value != 0 && pt >= asymmetricTPCPID.lstarProtonTPCAsymPtMin.value && pt < lstarPidPtRefPr.value) { + return std::isfinite(nsTPC) && nsTPC > asymmetricTPCPID.lstarProtonTPCAsymMin.value && nsTPC < asymmetricTPCPID.lstarProtonTPCAsymMax.value; + } + return std::abs(nsTPC) < lstarCutNsigmaTPCPr.value; + } + + bool passProtonCandidatePID(float pt, float nsTPC, float nsTOF, bool hasTof) const + { + if (asymmetricTPCPID.lstarEnableProtonTPCAsym.value != 0 && pt >= asymmetricTPCPID.lstarProtonTPCAsymPtMin.value && pt < lstarPidPtRefPr.value) { + return passProtonTPCWindow(pt, nsTPC); + } + return passFinalCandidatePID(pt, nsTPC, nsTOF, hasTof, + lstarCutNsigmaTPCPr.value, lstarCutNsigmaTOFPr.value, + lstarPidCircularCutPr.value, lstarPidPtRefPr.value); + } + + void validateDeuteronTPCAsym() const + { + if (asymmetricTPCPID.lstarEnableDeuteronTPCAsym.value == 0) { + return; + } + if (lstarPidStrategy.value != PidStrategyNucleiDeuteronTPC || + !std::isfinite(asymmetricTPCPID.lstarDeuteronTPCAsymPtMin.value) || asymmetricTPCPID.lstarDeuteronTPCAsymPtMin.value < 0.f || + !std::isfinite(asymmetricTPCPID.lstarDeuteronTPCAsymPtMax.value) || + (asymmetricTPCPID.lstarDeuteronTPCAsymPtMax.value >= 0.f && asymmetricTPCPID.lstarDeuteronTPCAsymPtMax.value <= asymmetricTPCPID.lstarDeuteronTPCAsymPtMin.value) || + !std::isfinite(asymmetricTPCPID.lstarDeuteronTPCAsymMin.value) || !std::isfinite(asymmetricTPCPID.lstarDeuteronTPCAsymMax.value) || + asymmetricTPCPID.lstarDeuteronTPCAsymMin.value >= asymmetricTPCPID.lstarDeuteronTPCAsymMax.value || + !std::isfinite(lstarCutNsigmaTPCDe.value) || lstarCutNsigmaTPCDe.value <= 0.f) { + LOGF(fatal, "Asymmetric deuteron TPC PID requires strategy 2, finite ordered nSigma bounds, a positive symmetric cut, and a valid measured-pT interval; negative maximum disables its upper limit"); + } + } + + bool useDeuteronTPCAsym(float pt) const + { + return asymmetricTPCPID.lstarEnableDeuteronTPCAsym.value != 0 && pt >= asymmetricTPCPID.lstarDeuteronTPCAsymPtMin.value && + (asymmetricTPCPID.lstarDeuteronTPCAsymPtMax.value < 0.f || pt < asymmetricTPCPID.lstarDeuteronTPCAsymPtMax.value); + } + + bool passDeuteronTPCWindow(float pt, float nsTPC) const + { + if (useDeuteronTPCAsym(pt)) { + return std::isfinite(nsTPC) && nsTPC > asymmetricTPCPID.lstarDeuteronTPCAsymMin.value && nsTPC < asymmetricTPCPID.lstarDeuteronTPCAsymMax.value; + } + return std::isfinite(nsTPC) && std::abs(nsTPC) < lstarCutNsigmaTPCDe.value; + } + + bool passDeuteronCandidatePID(float pt, float nsTPC, float nsTOF, bool hasTof) const + { + if (useDeuteronTPCAsym(pt)) { + if (!passDeuteronTPCWindow(pt, nsTPC)) { + return false; + } + if (lstarEnableTOFNsigmaCutDe.value != 0 && hasTof) { + return std::abs(nsTOF) < lstarCutNsigmaTOFDe.value; + } + return true; + } + return passFinalCandidatePID(pt, nsTPC, nsTOF, hasTof, + lstarCutNsigmaTPCDe.value, lstarCutNsigmaTOFDe.value, + lstarPidCircularCutDe.value, lstarPidPtRefDe.value, true); + } + bool passFinalCandidatePID(float pt, float nsTPC, float nsTOF, bool hasTof, float tpcCut, float tofCut, float circularCut, float ptRef, bool isDeuteron = false) const @@ -2409,7 +2502,7 @@ struct Lambdastarproxy { if (deuteronPID.lstarEnableDeuteronPurityQA.value != 0) { fillDeuteronPurityQA(trkD, DeuteronPIDStage::BeforePID); - if (std::isfinite(trkD.tpcNSigmaDe()) && std::abs(trkD.tpcNSigmaDe()) < lstarCutNsigmaTPCDe.value) { + if (passDeuteronTPCWindow(trkD.pt(), trkD.tpcNSigmaDe())) { fillDeuteronPurityQA(trkD, DeuteronPIDStage::AfterTPC); } } @@ -2435,10 +2528,7 @@ struct Lambdastarproxy { continue; } - const bool passesDeuteronSelection = passFinalCandidatePID(ptD, nsTPCDe, nsTOFDe, hasTofDe, - lstarCutNsigmaTPCDe.value, lstarCutNsigmaTOFDe.value, - lstarPidCircularCutDe.value, lstarPidPtRefDe.value, - true); + const bool passesDeuteronSelection = passDeuteronCandidatePID(ptD, nsTPCDe, nsTOFDe, hasTofDe); if (!passesDeuteronSelection) { continue; } @@ -2452,17 +2542,7 @@ struct Lambdastarproxy { const float nsTOFPrAsProxy = trkD.tofNSigmaPr(); - const bool passesProtonSelection = - passFinalCandidatePID( - ptD, - nsTPCPrAsProxy, - nsTOFPrAsProxy, - hasTofDe, - lstarCutNsigmaTPCPr.value, - lstarCutNsigmaTOFPr.value, - lstarPidCircularCutPr.value, - lstarPidPtRefPr.value, - false); + const bool passesProtonSelection = passProtonCandidatePID(ptD, nsTPCPrAsProxy, nsTOFPrAsProxy, hasTofDe); if (useProtonAsProxy && !passesProtonSelection) { @@ -2541,7 +2621,7 @@ struct Lambdastarproxy { if (lstarEnableSparse.value != 0 && lstarEnableProxyControls.value != 0) { histos.fill(HIST("hLambdaStarProxySelectedTrackControlSparse"), ptD, hasTofDe, - passesProtonSelection, std::abs(nsTPCPrAsProxy) < lstarCutNsigmaTPCPr.value); + passesProtonSelection, passProtonTPCWindow(ptD, nsTPCPrAsProxy)); } proxyCands.push_back( @@ -2557,7 +2637,7 @@ struct Lambdastarproxy { .protonLike = passesProtonSelection, .hasTOF = hasTofDe, - .protonTPCCompatible = std::abs(nsTPCPrAsProxy) < lstarCutNsigmaTPCPr.value, + .protonTPCCompatible = passProtonTPCWindow(ptD, nsTPCPrAsProxy), .charge = static_cast( @@ -2589,14 +2669,7 @@ struct Lambdastarproxy { const float nsTPCPr = trkP.tpcNSigmaPr(); const float nsTOFPr = trkP.tofNSigmaPr(); const bool hasTofPr = hasTOFMatch(trkP); - const bool isProton = passFinalCandidatePID(ptP, - nsTPCPr, - nsTOFPr, - hasTofPr, - lstarCutNsigmaTPCPr.value, - lstarCutNsigmaTOFPr.value, - lstarPidCircularCutPr.value, - lstarPidPtRefPr.value, false); + const bool isProton = passProtonCandidatePID(ptP, nsTPCPr, nsTOFPr, hasTofPr); if (!isProton) { continue; }