Skip to content

Commit fd064d4

Browse files
sustripathySushanta Tripathy
andauthored
[PWGLF] Refining PID cuts in lambdastarproxy task (#18823)
Co-authored-by: Sushanta Tripathy <sushantatripathy@Sushantas-MacBook-Pro-M4-Max.local>
1 parent b75d6af commit fd064d4

1 file changed

Lines changed: 73 additions & 3 deletions

File tree

‎PWGLF/Tasks/Resonances/lambdastarproxy.cxx‎

Lines changed: 73 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,12 @@ struct Lambdastarproxy {
174174
struct : ConfigurableGroup {
175175
Configurable<int> lstarEnableITSPIDDe{"lstarEnableITSPIDDe", 0, "Apply one-sided ITS cluster-size PID to deuteron candidates"};
176176
Configurable<float> lstarCutNsigmaITSDeMin{"lstarCutNsigmaITSDeMin", -3.f, "Require nSigmaITS_d greater than this lower bound (not an absolute-value cut)"};
177+
Configurable<float> lstarITSPIDDePtMin{"lstarITSPIDDePtMin", 0.f, "Inclusive lower measured track pT for deuteron ITS PID (GeV/c)"};
178+
Configurable<float> lstarITSPIDDePtMax{"lstarITSPIDDePtMax", -1.f, "Exclusive upper measured track pT for deuteron ITS PID; negative means no upper limit"};
179+
Configurable<int> lstarEnableTPCVetoDe{"lstarEnableTPCVetoDe", 0, "Reject deuteron candidates compatible with enabled competing TPC hypotheses; does not require TOF"};
180+
Configurable<float> lstarTPCVetoPiDe{"lstarTPCVetoPiDe", 3.f, "Require |TPC nSigma_pi| above this value for deuteron candidates; zero disables this veto"};
181+
Configurable<float> lstarTPCVetoKaDe{"lstarTPCVetoKaDe", 3.f, "Require |TPC nSigma_K| above this value for deuteron candidates; zero disables this veto"};
182+
Configurable<float> lstarTPCVetoPrDe{"lstarTPCVetoPrDe", 3.f, "Require |TPC nSigma_p| above this value for deuteron candidates; zero disables this veto"};
177183
Configurable<int> lstarITSNClustersDe{"lstarITSNClustersDe", 0, "Additional deuteron-only minimum ITS clusters; 0 disables"};
178184
Configurable<int> lstarTPCNClsFoundDeMin{"lstarTPCNClsFoundDeMin", 0, "Additional deuteron-only minimum TPC found clusters (not crossed rows); 0 disables"};
179185
Configurable<float> lstarRequireTOFAbovePDe{"lstarRequireTOFAbovePDe", -1.f, "Strategy 2: require TOF match and TOF-d nSigma cut at full track p >= threshold in GeV/c; negative disables"};
@@ -1296,8 +1302,39 @@ struct Lambdastarproxy {
12961302
std::shared_ptr<TH3> dePurityMCSpecies;
12971303
} dePurity;
12981304

1305+
void validateDeuteronITSPIDRange() const
1306+
{
1307+
if (deuteronPID.lstarEnableITSPIDDe.value == 0) {
1308+
return;
1309+
}
1310+
if (!std::isfinite(deuteronPID.lstarITSPIDDePtMin.value) || deuteronPID.lstarITSPIDDePtMin.value < 0.f ||
1311+
!std::isfinite(deuteronPID.lstarITSPIDDePtMax.value) ||
1312+
(deuteronPID.lstarITSPIDDePtMax.value >= 0.f && deuteronPID.lstarITSPIDDePtMax.value <= deuteronPID.lstarITSPIDDePtMin.value)) {
1313+
LOGF(fatal, "Deuteron ITS PID requires a finite nonnegative lower pT and an ordered upper pT; negative maximum means no upper limit");
1314+
}
1315+
}
1316+
1317+
void validateDeuteronTPCVeto() const
1318+
{
1319+
if (deuteronPID.lstarEnableTPCVetoDe.value == 0) {
1320+
return;
1321+
}
1322+
bool anyEnabled = false;
1323+
for (auto const& cut : {deuteronPID.lstarTPCVetoPiDe.value, deuteronPID.lstarTPCVetoKaDe.value, deuteronPID.lstarTPCVetoPrDe.value}) {
1324+
if (!std::isfinite(cut) || cut < 0.f) {
1325+
LOGF(fatal, "Deuteron competing TPC veto thresholds must be finite and nonnegative; zero disables a species");
1326+
}
1327+
anyEnabled = anyEnabled || cut > 0.f;
1328+
}
1329+
if (!anyEnabled) {
1330+
LOGF(fatal, "Enabled deuteron TPC veto requires at least one positive competing-species threshold");
1331+
}
1332+
}
1333+
12991334
void validateDeuteronRefinements() const
13001335
{
1336+
validateDeuteronITSPIDRange();
1337+
validateDeuteronTPCVeto();
13011338
if (deuteronPID.lstarITSNClustersDe.value < 0 || deuteronPID.lstarITSNClustersDe.value > ITSClusterLayers || deuteronPID.lstarTPCNClsFoundDeMin.value < 0) {
13021339
LOGF(fatal, "Deuteron-only ITS minimum must be 0..7; TPC-found minimum must be nonnegative");
13031340
}
@@ -1361,6 +1398,29 @@ struct Lambdastarproxy {
13611398
return std::isfinite(response) ? response : invalid;
13621399
}
13631400

1401+
template <typename TTrack>
1402+
bool passDeuteronTPCVeto(TTrack const& track) const
1403+
{
1404+
if (deuteronPID.lstarEnableTPCVetoDe.value == 0) {
1405+
return true;
1406+
}
1407+
// A missing full-PID response has an invalid expected resolution and must
1408+
// not be accepted merely because its stored nSigma lies far from zero.
1409+
const auto passes = [](float nsigma, float expectedSigma, float cut) {
1410+
return std::isfinite(nsigma) && std::isfinite(expectedSigma) && expectedSigma > 0.f && std::abs(nsigma) > cut;
1411+
};
1412+
if (deuteronPID.lstarTPCVetoPiDe.value > 0.f && !passes(track.tpcNSigmaPi(), track.tpcExpSigmaPi(), deuteronPID.lstarTPCVetoPiDe.value)) {
1413+
return false;
1414+
}
1415+
if (deuteronPID.lstarTPCVetoKaDe.value > 0.f && !passes(track.tpcNSigmaKa(), track.tpcExpSigmaKa(), deuteronPID.lstarTPCVetoKaDe.value)) {
1416+
return false;
1417+
}
1418+
if (deuteronPID.lstarTPCVetoPrDe.value > 0.f && !passes(track.tpcNSigmaPr(), track.tpcExpSigmaPr(), deuteronPID.lstarTPCVetoPrDe.value)) {
1419+
return false;
1420+
}
1421+
return true;
1422+
}
1423+
13641424
template <typename TTrack>
13651425
bool passDeuteronRefinements(TTrack const& track) const
13661426
{
@@ -1371,10 +1431,20 @@ struct Lambdastarproxy {
13711431
return false;
13721432
}
13731433
if (deuteronPID.lstarEnableITSPIDDe.value != 0) {
1374-
const double response = deuteronITSNSigma(track);
1375-
if (!std::isfinite(response) || response <= deuteronPID.lstarCutNsigmaITSDeMin.value) {
1434+
const bool restrictedRange = deuteronPID.lstarITSPIDDePtMin.value > 0.f || deuteronPID.lstarITSPIDDePtMax.value >= 0.f;
1435+
const float pt = track.pt();
1436+
if (restrictedRange && (!std::isfinite(pt) || pt < 0.f)) {
13761437
return false;
13771438
}
1439+
// The default open range keeps the existing unconditional ITS decision.
1440+
// Range limits use measured single-track pT before proxy momentum scaling.
1441+
if (!restrictedRange || (pt >= deuteronPID.lstarITSPIDDePtMin.value &&
1442+
(deuteronPID.lstarITSPIDDePtMax.value < 0.f || pt < deuteronPID.lstarITSPIDDePtMax.value))) {
1443+
const double response = deuteronITSNSigma(track);
1444+
if (!std::isfinite(response) || response <= deuteronPID.lstarCutNsigmaITSDeMin.value) {
1445+
return false;
1446+
}
1447+
}
13781448
}
13791449
if (deuteronPID.lstarRequireTOFAbovePDe.value >= 0.f) {
13801450
// Full measured total p, before proxy division by two; equality belongs
@@ -1388,7 +1458,7 @@ struct Lambdastarproxy {
13881458
return false;
13891459
}
13901460
}
1391-
return true;
1461+
return passDeuteronTPCVeto(track);
13921462
}
13931463

13941464
void bookDeuteronPurityQA()

0 commit comments

Comments
 (0)