Skip to content

Commit 0b03574

Browse files
Sushanta TripathySushanta Tripathy
authored andcommitted
Updates in PID cuts for protons and deuterons
1 parent 109c8c1 commit 0b03574

1 file changed

Lines changed: 102 additions & 29 deletions

File tree

‎PWGLF/Tasks/Resonances/lambdastarproxy.cxx‎

Lines changed: 102 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,20 @@ struct Lambdastarproxy {
147147
Configurable<float> lstarCutNsigmaTPCDe{"lstarCutNsigmaTPCDe", float{NsigmaTPCDefault}, "|nSigma^{TPC}_{d}| cut"};
148148
Configurable<float> lstarCutNsigmaTOFDe{"lstarCutNsigmaTOFDe", float{NsigmaTOFDefault}, "|nSigma^{TOF}_{d}| cut"};
149149
Configurable<int> lstarEnableTOFNsigmaCutDe{"lstarEnableTOFNsigmaCutDe", 0, "Enable deuteron-only TOF nSigma cut in PID strategy 2"};
150+
// Group new settings to stay within the framework's top-level member limit.
151+
// The configurable names remain flat; all features are opt-in.
152+
struct : ConfigurableGroup {
153+
Configurable<int> lstarEnableProtonTPCAsym{"lstarEnableProtonTPCAsym", 0, "Enable the asymmetric proton TPC window below lstarPidPtRefPr"};
154+
Configurable<float> lstarProtonTPCAsymPtMin{"lstarProtonTPCAsymPtMin", 0.5f, "Measured proton-track pT where the asymmetric TPC window starts (GeV/c)"};
155+
Configurable<float> lstarProtonTPCAsymMin{"lstarProtonTPCAsymMin", -2.f, "Strict lower TPC nSigma_p bound in the asymmetric window"};
156+
Configurable<float> lstarProtonTPCAsymMax{"lstarProtonTPCAsymMax", 5.f, "Strict upper TPC nSigma_p bound in the asymmetric window"};
157+
// Strategy 2 only: existing TOF and ITS requirements still apply.
158+
Configurable<int> lstarEnableDeuteronTPCAsym{"lstarEnableDeuteronTPCAsym", 0, "Enable an asymmetric deuteron TPC window in PID strategy 2"};
159+
Configurable<float> lstarDeuteronTPCAsymPtMin{"lstarDeuteronTPCAsymPtMin", 0.f, "Measured deuteron-track pT where the asymmetric TPC window starts (GeV/c)"};
160+
Configurable<float> lstarDeuteronTPCAsymPtMax{"lstarDeuteronTPCAsymPtMax", -1.f, "Exclusive upper measured deuteron-track pT for the asymmetric window; negative means no upper limit"};
161+
Configurable<float> lstarDeuteronTPCAsymMin{"lstarDeuteronTPCAsymMin", -2.f, "Strict lower TPC nSigma_d bound in the asymmetric window"};
162+
Configurable<float> lstarDeuteronTPCAsymMax{"lstarDeuteronTPCAsymMax", 4.f, "Strict upper TPC nSigma_d bound in the asymmetric window"};
163+
} asymmetricTPCPID;
150164
Configurable<int> 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"};
151165
// Optional deuteron-only TOF auxiliary selections.
152166
// Defaults are OFF, so strategy 2 remains TPC nSigma only for deuterons.
@@ -626,6 +640,8 @@ struct Lambdastarproxy {
626640
validateDeuteronRefinements();
627641
validatePtDependentDcaZ();
628642
validateKaonTPCAsym();
643+
validateProtonTPCAsym();
644+
validateDeuteronTPCAsym();
629645
if (trackSpectraConfig.lstarEnableTrackSpectra.value != 0 &&
630646
((!doprocess.value && !doprocessMCReco.value) || !std::isfinite(trackSpectraConfig.lstarTrackSpectraAbsYMax.value) || trackSpectraConfig.lstarTrackSpectraAbsYMax.value <= 0.f)) {
631647
LOGF(fatal, "Track spectra require data or reconstructed MC and a positive finite spectra rapidity window");
@@ -1706,9 +1722,8 @@ struct Lambdastarproxy {
17061722
probe.charge = static_cast<int>(track.sign());
17071723
probe.tid = track.globalIndex();
17081724
if (role == 0) {
1709-
const bool passProton = passFinalCandidatePID(track.pt(), track.tpcNSigmaPr(), track.tofNSigmaPr(), true,
1710-
lstarCutNsigmaTPCPr.value, lstarCutNsigmaTOFPr.value, lstarPidCircularCutPr.value, lstarPidPtRefPr.value);
1711-
probe.nominal = passFinalCandidatePID(track.pt(), tpc[role], tof[role], true, lstarCutNsigmaTPCDe.value, lstarCutNsigmaTOFDe.value, lstarPidCircularCutDe.value, lstarPidPtRefDe.value, true) &&
1725+
const bool passProton = passProtonCandidatePID(track.pt(), track.tpcNSigmaPr(), track.tofNSigmaPr(), true);
1726+
probe.nominal = passDeuteronCandidatePID(track.pt(), tpc[role], tof[role], true) &&
17121727
passOptionalDeuteronTOFExtras(track) && passDeuteronRefinements(track) && (lstarProxyUseProtonPIDAsDeuteron.value == 0 || passProton);
17131728
} else {
17141729
probe.nominal = passKaonCandidatePID(track.pt(), tpc[role], tof[role], true);
@@ -2117,6 +2132,84 @@ struct Lambdastarproxy {
21172132
lstarPidCircularCutKaon.value, lstarPidPtRefKaon.value);
21182133
}
21192134

2135+
void validateProtonTPCAsym() const
2136+
{
2137+
if (asymmetricTPCPID.lstarEnableProtonTPCAsym.value == 0) {
2138+
return;
2139+
}
2140+
if (!std::isfinite(asymmetricTPCPID.lstarProtonTPCAsymPtMin.value) || asymmetricTPCPID.lstarProtonTPCAsymPtMin.value < 0.f ||
2141+
!std::isfinite(lstarPidPtRefPr.value) || asymmetricTPCPID.lstarProtonTPCAsymPtMin.value >= lstarPidPtRefPr.value ||
2142+
!std::isfinite(asymmetricTPCPID.lstarProtonTPCAsymMin.value) || !std::isfinite(asymmetricTPCPID.lstarProtonTPCAsymMax.value) ||
2143+
asymmetricTPCPID.lstarProtonTPCAsymMin.value >= asymmetricTPCPID.lstarProtonTPCAsymMax.value ||
2144+
!std::isfinite(lstarCutNsigmaTPCPr.value) || lstarCutNsigmaTPCPr.value <= 0.f) {
2145+
LOGF(fatal, "Asymmetric proton TPC PID requires finite ordered nSigma bounds, a positive symmetric cut, and 0 <= lstarProtonTPCAsymPtMin < lstarPidPtRefPr");
2146+
}
2147+
}
2148+
2149+
bool passProtonTPCWindow(float pt, float nsTPC) const
2150+
{
2151+
if (asymmetricTPCPID.lstarEnableProtonTPCAsym.value != 0 && pt >= asymmetricTPCPID.lstarProtonTPCAsymPtMin.value && pt < lstarPidPtRefPr.value) {
2152+
return std::isfinite(nsTPC) && nsTPC > asymmetricTPCPID.lstarProtonTPCAsymMin.value && nsTPC < asymmetricTPCPID.lstarProtonTPCAsymMax.value;
2153+
}
2154+
return std::abs(nsTPC) < lstarCutNsigmaTPCPr.value;
2155+
}
2156+
2157+
bool passProtonCandidatePID(float pt, float nsTPC, float nsTOF, bool hasTof) const
2158+
{
2159+
if (asymmetricTPCPID.lstarEnableProtonTPCAsym.value != 0 && pt >= asymmetricTPCPID.lstarProtonTPCAsymPtMin.value && pt < lstarPidPtRefPr.value) {
2160+
return passProtonTPCWindow(pt, nsTPC);
2161+
}
2162+
return passFinalCandidatePID(pt, nsTPC, nsTOF, hasTof,
2163+
lstarCutNsigmaTPCPr.value, lstarCutNsigmaTOFPr.value,
2164+
lstarPidCircularCutPr.value, lstarPidPtRefPr.value);
2165+
}
2166+
2167+
void validateDeuteronTPCAsym() const
2168+
{
2169+
if (asymmetricTPCPID.lstarEnableDeuteronTPCAsym.value == 0) {
2170+
return;
2171+
}
2172+
if (lstarPidStrategy.value != PidStrategyNucleiDeuteronTPC ||
2173+
!std::isfinite(asymmetricTPCPID.lstarDeuteronTPCAsymPtMin.value) || asymmetricTPCPID.lstarDeuteronTPCAsymPtMin.value < 0.f ||
2174+
!std::isfinite(asymmetricTPCPID.lstarDeuteronTPCAsymPtMax.value) ||
2175+
(asymmetricTPCPID.lstarDeuteronTPCAsymPtMax.value >= 0.f && asymmetricTPCPID.lstarDeuteronTPCAsymPtMax.value <= asymmetricTPCPID.lstarDeuteronTPCAsymPtMin.value) ||
2176+
!std::isfinite(asymmetricTPCPID.lstarDeuteronTPCAsymMin.value) || !std::isfinite(asymmetricTPCPID.lstarDeuteronTPCAsymMax.value) ||
2177+
asymmetricTPCPID.lstarDeuteronTPCAsymMin.value >= asymmetricTPCPID.lstarDeuteronTPCAsymMax.value ||
2178+
!std::isfinite(lstarCutNsigmaTPCDe.value) || lstarCutNsigmaTPCDe.value <= 0.f) {
2179+
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");
2180+
}
2181+
}
2182+
2183+
bool useDeuteronTPCAsym(float pt) const
2184+
{
2185+
return asymmetricTPCPID.lstarEnableDeuteronTPCAsym.value != 0 && pt >= asymmetricTPCPID.lstarDeuteronTPCAsymPtMin.value &&
2186+
(asymmetricTPCPID.lstarDeuteronTPCAsymPtMax.value < 0.f || pt < asymmetricTPCPID.lstarDeuteronTPCAsymPtMax.value);
2187+
}
2188+
2189+
bool passDeuteronTPCWindow(float pt, float nsTPC) const
2190+
{
2191+
if (useDeuteronTPCAsym(pt)) {
2192+
return std::isfinite(nsTPC) && nsTPC > asymmetricTPCPID.lstarDeuteronTPCAsymMin.value && nsTPC < asymmetricTPCPID.lstarDeuteronTPCAsymMax.value;
2193+
}
2194+
return std::isfinite(nsTPC) && std::abs(nsTPC) < lstarCutNsigmaTPCDe.value;
2195+
}
2196+
2197+
bool passDeuteronCandidatePID(float pt, float nsTPC, float nsTOF, bool hasTof) const
2198+
{
2199+
if (useDeuteronTPCAsym(pt)) {
2200+
if (!passDeuteronTPCWindow(pt, nsTPC)) {
2201+
return false;
2202+
}
2203+
if (lstarEnableTOFNsigmaCutDe.value != 0 && hasTof) {
2204+
return std::abs(nsTOF) < lstarCutNsigmaTOFDe.value;
2205+
}
2206+
return true;
2207+
}
2208+
return passFinalCandidatePID(pt, nsTPC, nsTOF, hasTof,
2209+
lstarCutNsigmaTPCDe.value, lstarCutNsigmaTOFDe.value,
2210+
lstarPidCircularCutDe.value, lstarPidPtRefDe.value, true);
2211+
}
2212+
21202213
bool passFinalCandidatePID(float pt, float nsTPC, float nsTOF, bool hasTof,
21212214
float tpcCut, float tofCut, float circularCut,
21222215
float ptRef, bool isDeuteron = false) const
@@ -2409,7 +2502,7 @@ struct Lambdastarproxy {
24092502

24102503
if (deuteronPID.lstarEnableDeuteronPurityQA.value != 0) {
24112504
fillDeuteronPurityQA<IsMC>(trkD, DeuteronPIDStage::BeforePID);
2412-
if (std::isfinite(trkD.tpcNSigmaDe()) && std::abs(trkD.tpcNSigmaDe()) < lstarCutNsigmaTPCDe.value) {
2505+
if (passDeuteronTPCWindow(trkD.pt(), trkD.tpcNSigmaDe())) {
24132506
fillDeuteronPurityQA<IsMC>(trkD, DeuteronPIDStage::AfterTPC);
24142507
}
24152508
}
@@ -2435,10 +2528,7 @@ struct Lambdastarproxy {
24352528
continue;
24362529
}
24372530

2438-
const bool passesDeuteronSelection = passFinalCandidatePID(ptD, nsTPCDe, nsTOFDe, hasTofDe,
2439-
lstarCutNsigmaTPCDe.value, lstarCutNsigmaTOFDe.value,
2440-
lstarPidCircularCutDe.value, lstarPidPtRefDe.value,
2441-
true);
2531+
const bool passesDeuteronSelection = passDeuteronCandidatePID(ptD, nsTPCDe, nsTOFDe, hasTofDe);
24422532
if (!passesDeuteronSelection) {
24432533
continue;
24442534
}
@@ -2452,17 +2542,7 @@ struct Lambdastarproxy {
24522542
const float nsTOFPrAsProxy =
24532543
trkD.tofNSigmaPr();
24542544

2455-
const bool passesProtonSelection =
2456-
passFinalCandidatePID(
2457-
ptD,
2458-
nsTPCPrAsProxy,
2459-
nsTOFPrAsProxy,
2460-
hasTofDe,
2461-
lstarCutNsigmaTPCPr.value,
2462-
lstarCutNsigmaTOFPr.value,
2463-
lstarPidCircularCutPr.value,
2464-
lstarPidPtRefPr.value,
2465-
false);
2545+
const bool passesProtonSelection = passProtonCandidatePID(ptD, nsTPCPrAsProxy, nsTOFPrAsProxy, hasTofDe);
24662546

24672547
if (useProtonAsProxy &&
24682548
!passesProtonSelection) {
@@ -2541,7 +2621,7 @@ struct Lambdastarproxy {
25412621

25422622
if (lstarEnableSparse.value != 0 && lstarEnableProxyControls.value != 0) {
25432623
histos.fill(HIST("hLambdaStarProxySelectedTrackControlSparse"), ptD, hasTofDe,
2544-
passesProtonSelection, std::abs(nsTPCPrAsProxy) < lstarCutNsigmaTPCPr.value);
2624+
passesProtonSelection, passProtonTPCWindow(ptD, nsTPCPrAsProxy));
25452625
}
25462626

25472627
proxyCands.push_back(
@@ -2557,7 +2637,7 @@ struct Lambdastarproxy {
25572637
.protonLike =
25582638
passesProtonSelection,
25592639
.hasTOF = hasTofDe,
2560-
.protonTPCCompatible = std::abs(nsTPCPrAsProxy) < lstarCutNsigmaTPCPr.value,
2640+
.protonTPCCompatible = passProtonTPCWindow(ptD, nsTPCPrAsProxy),
25612641

25622642
.charge =
25632643
static_cast<int>(
@@ -2589,14 +2669,7 @@ struct Lambdastarproxy {
25892669
const float nsTPCPr = trkP.tpcNSigmaPr();
25902670
const float nsTOFPr = trkP.tofNSigmaPr();
25912671
const bool hasTofPr = hasTOFMatch(trkP);
2592-
const bool isProton = passFinalCandidatePID(ptP,
2593-
nsTPCPr,
2594-
nsTOFPr,
2595-
hasTofPr,
2596-
lstarCutNsigmaTPCPr.value,
2597-
lstarCutNsigmaTOFPr.value,
2598-
lstarPidCircularCutPr.value,
2599-
lstarPidPtRefPr.value, false);
2672+
const bool isProton = passProtonCandidatePID(ptP, nsTPCPr, nsTOFPr, hasTofPr);
26002673
if (!isProton) {
26012674
continue;
26022675
}

0 commit comments

Comments
 (0)