Skip to content

Commit 6662d5c

Browse files
authored
Refactor TOF PID selection logic for Lambda0 daughters
Updated TOF PID cuts for protons and pions, added checks for TOF presence in selection criteria.
1 parent a3ee786 commit 6662d5c

1 file changed

Lines changed: 25 additions & 15 deletions

File tree

PWGHF/HFC/TableProducer/correlatorLcScHadrons.cxx

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ struct HfCorrelatorLcScHadrons {
353353
Configurable<float> cfgV0DaughPIDCutsTPCPr{"cfgV0DaughPIDCutsTPCPr", 2.5, "max. TPCnSigma Proton"};
354354
Configurable<float> cfgV0DaughPIDCutsTPCPi{"cfgV0DaughPIDCutsTPCPi", 2.5, "max. TPCnSigma Pion"};
355355
Configurable<float> cfgV0DaughPIDCutsTOFPi{"cfgV0DaughPIDCutsTOFPi", 2.5, "max. TOFnSigma Pion"};
356-
Configurable<float> cfgV0DaughPIDCutsTOFPr{"cfgV0DaughPIDCutsTOFPr", 2.5, "max. TOFnSigma Pion"};
356+
Configurable<float> cfgV0DaughPIDCutsTOFPr{"cfgV0DaughPIDCutsTOFPr", -2.5, "min. TOFnSigma Proton (put only negative value)"};
357357
Configurable<float> cfgHypMassWindow{"cfgHypMassWindow", 0.1, "single lambda mass selection"};
358358
Configurable<bool> cfgIsCorrCollMatchV0{"cfgIsCorrCollMatchV0", true, "check if daughter and mother collision are same"};
359359
Configurable<bool> cfgCalDataDrivenEffPr{"cfgCalDataDrivenEffPr", false, "calculate data driven efficiency of proton using Lambda"};
@@ -368,6 +368,7 @@ struct HfCorrelatorLcScHadrons {
368368
Configurable<int> cfgMinOccupancy{"cfgMinOccupancy", 0, "maximum occupancy of tracks in neighbouring collisions in a given time range"};
369369
Configurable<float> cfgPV{"cfgPV", 10., "maximum z-vertex"};
370370
Configurable<bool> calEffV0{"calEffV0", false, "calculate lambda0 efficiency"};
371+
Configurable<bool> checkTOFForPion{"checkTOFForPion", false, "if True, TOF selection on pion V0 wil only be applied if TOF present"};
371372
} cfgV0;
372373

373374
// Event Mixing for the Data Mode
@@ -602,43 +603,49 @@ struct HfCorrelatorLcScHadrons {
602603
if (std::abs(track.eta()) > cfgCharmCand.etaTrackMax) {
603604
return false;
604605
}
606+
605607
// ---------------------------------------------------------
606608
// 1. Proton PID Selection
607609
// ---------------------------------------------------------
608610
if (std::abs(pid) == kProton) {
611+
bool hasTOFProton = (pid > 0) ? v0.positiveHasTOF() : v0.negativeHasTOF();
609612
bool passTOF = false;
610613

611614
if (track.pt() > cfgV0.cfgV0DaughPrPtMax || track.pt() < cfgV0.cfgV0DaughPrPtMin) {
612615
return false;
613616
}
614-
if (track.hasTOF()) {
617+
618+
if (hasTOFProton && (track.pt() > cfgCharmCand.tofPIDThreshold)) {
615619
if constexpr (std::experimental::is_detected<HasStrangeTOFinV0, V0Type>::value) {
616620
// pid > 0: Proton from Lambda (LaPr)
617621
// pid < 0: Antiproton from Anti-Lambda (ALaPr)
618622
double strangeTOF = (pid > 0) ? v0.tofNSigmaLaPr() : v0.tofNSigmaALaPr();
619-
passTOF = std::abs(strangeTOF) > cfgV0.cfgV0DaughPIDCutsTOFPr;
623+
passTOF = strangeTOF > cfgV0.cfgV0DaughPIDCutsTOFPr;
624+
620625
} else {
621626
// if strange TOF is unavailable
622-
passTOF = std::abs(track.tofNSigmaPr()) > cfgV0.cfgV0DaughPIDCutsTOFPr;
627+
passTOF = track.tofNSigmaPr() > cfgV0.cfgV0DaughPIDCutsTOFPr;
623628
}
629+
624630
}
625631

626-
if ((std::abs(track.tpcNSigmaPr()) > cfgV0.cfgV0DaughPIDCutsTPCPr) || passTOF) {
632+
if ((std::abs(track.tpcNSigmaPr()) > cfgV0.cfgV0DaughPIDCutsTPCPr) && !passTOF) {
627633
return false;
628634
}
629635
}
630636

631637
// ---------------------------------------------------------
632638
// 2. Pion PID Selection
633639
// ---------------------------------------------------------
634-
if (std::abs(pid) == kPiPlus) {
640+
if (std::abs(pid) == kPiPlus && cfgV0.checkTOFForPion) {
641+
bool hasTOFPion = (pid < 0) ? v0.negativeHasTOF() : v0.positiveHasTOF();
635642
bool passTOF = false;
636643

637644
if (track.pt() > cfgV0.cfgV0DaughPiPtMax || track.pt() < cfgV0.cfgV0DaughPiPtMin) {
638645
return false;
639646
}
640647

641-
if (track.hasTOF()) {
648+
if (hasTOFPion && (track.pt() > cfgCharmCand.tofPIDThreshold)) {
642649
if constexpr (std::experimental::is_detected<HasStrangeTOFinV0, V0Type>::value) {
643650
// A pion can belong to either a Lambda/Anti-Lambda decay or a K0s decay.
644651
// We evaluate both applicable hypotheses based on charge sign and pick the best match.
@@ -649,13 +656,13 @@ struct HfCorrelatorLcScHadrons {
649656
// Fallback to standard track TOF
650657
passTOF = std::abs(track.tofNSigmaPi()) > cfgV0.cfgV0DaughPIDCutsTOFPi;
651658
}
659+
652660
}
653661

654-
if ((std::abs(track.tpcNSigmaPi()) > cfgV0.cfgV0DaughPIDCutsTPCPi) || passTOF) {
662+
if ((std::abs(track.tpcNSigmaPi()) > cfgV0.cfgV0DaughPIDCutsTPCPi) && !passTOF) {
655663
return false;
656664
}
657665
}
658-
659666
return true;
660667
}
661668

@@ -826,6 +833,7 @@ struct HfCorrelatorLcScHadrons {
826833
// Correlate Lc with all Lambda V0 in the same event
827834
for (const auto& v0 : v0s) {
828835

836+
829837
const int v0Lambda = 1;
830838
const int v0AntiLambda = -1;
831839

@@ -836,19 +844,21 @@ struct HfCorrelatorLcScHadrons {
836844
auto posTrackV0 = v0.template posTrack_as<TrackType>();
837845
auto negTrackV0 = v0.template negTrack_as<TrackType>();
838846

847+
839848
if ((candidate.prong0Id() == posTrackV0.globalIndex()) || (candidate.prong1Id() == posTrackV0.globalIndex()) || (candidate.prong2Id() == posTrackV0.globalIndex()) || (candidate.prong0Id() == negTrackV0.globalIndex()) || (candidate.prong1Id() == negTrackV0.globalIndex()) || (candidate.prong2Id() == negTrackV0.globalIndex())) {
840849
if (!cfgCharmCand.storeAutoCorrelationFlag) {
841850
continue;
842851
}
843852
correlationStatus = true;
844853
}
845854

855+
846856
if (cfgV0.cfgIsCorrCollMatchV0 && ((v0.collisionId() != posTrackV0.collisionId()) || (v0.collisionId() != negTrackV0.collisionId()))) {
847857
continue;
848858
}
849859

850860
// Process Lambda (proton-pion)
851-
if (std::abs(o2::constants::physics::MassLambda - v0.mLambda()) < cfgV0.cfgHypMassWindow) {
861+
if ((std::abs(o2::constants::physics::MassLambda - v0.mLambda()) < cfgV0.cfgHypMassWindow ) && v0.alpha() > 0) {
852862
if (isSelectedV0Daughter(posTrackV0, v0, kProton) && isSelectedV0Daughter(negTrackV0, v0, kPiMinus)) {
853863

854864
if (selLcPKPi) {
@@ -869,7 +879,7 @@ struct HfCorrelatorLcScHadrons {
869879
}
870880

871881
// Process anti-Lambda (anti-proton-pion)
872-
if (std::abs(o2::constants::physics::MassLambda - v0.mAntiLambda()) < cfgV0.cfgHypMassWindow) {
882+
if ((std::abs(o2::constants::physics::MassLambda - v0.mAntiLambda()) < cfgV0.cfgHypMassWindow) && v0.alpha() < 0) {
873883
if (isSelectedV0Daughter(negTrackV0, v0, kProtonBar) && isSelectedV0Daughter(posTrackV0, v0, kPiPlus)) {
874884

875885
if (selLcPKPi) {
@@ -956,7 +966,7 @@ struct HfCorrelatorLcScHadrons {
956966
}
957967

958968
// Process Lambda (proton + pion)
959-
if (passV0Sel && std::abs(o2::constants::physics::MassLambda - v0.mLambda()) < cfgV0.cfgHypMassWindow) {
969+
if (passV0Sel && std::abs(o2::constants::physics::MassLambda - v0.mLambda()) < cfgV0.cfgHypMassWindow && v0.alpha() > 0) {
960970
entryHadron(v0.mLambda(), trackV0Pos.eta(), trackV0Pos.pt() * trackV0Pos.sign(), 0, 0, v0.pt());
961971
entryTrkPID(trackV0Pos.tpcNSigmaPr(), trackV0Pos.tpcNSigmaKa(), trackV0Pos.tpcNSigmaPi(), trackV0Pos.tofNSigmaPr(), trackV0Pos.tofNSigmaKa(), trackV0Pos.tofNSigmaPi());
962972

@@ -980,7 +990,7 @@ struct HfCorrelatorLcScHadrons {
980990
}
981991
}
982992

983-
if (passV0Sel && std::abs(o2::constants::physics::MassLambda - v0.mAntiLambda()) < cfgV0.cfgHypMassWindow) {
993+
if (passV0Sel && std::abs(o2::constants::physics::MassLambda - v0.mAntiLambda()) < cfgV0.cfgHypMassWindow && v0.alpha() < 0) {
984994
entryHadron(v0.mAntiLambda(), trackV0Neg.eta(), trackV0Neg.pt() * trackV0Neg.sign(), 0, 0, v0.pt());
985995
entryTrkPID(trackV0Neg.tpcNSigmaPr(), trackV0Neg.tpcNSigmaKa(), trackV0Neg.tpcNSigmaPi(), trackV0Neg.tofNSigmaPr(), trackV0Neg.tofNSigmaKa(), trackV0Neg.tofNSigmaPi());
986996

@@ -1013,7 +1023,7 @@ struct HfCorrelatorLcScHadrons {
10131023
auto const& partV0Pos = trackV0Pos.mcParticle();
10141024
auto const& partV0Neg = trackV0Neg.mcParticle();
10151025

1016-
if (passV0Sel && v0Mc.pdgCode() == kLambda0) {
1026+
if (passV0Sel && v0Mc.pdgCode() == kLambda0 && v0.alpha() > 0) {
10171027
if (isSelectedV0Daughter(trackV0Pos, v0, kProton) && isSelectedV0Daughter(trackV0Neg, v0, kPiMinus)) {
10181028
registry.fill(HIST("hV0LambdaMcRec"), v0.mLambda(), v0.pt(), partV0Pos.pt());
10191029
registry.fill(HIST("hV0LambdaReflMcRec"), v0.mAntiLambda(), v0.pt(), partV0Neg.pt());
@@ -1028,7 +1038,7 @@ struct HfCorrelatorLcScHadrons {
10281038
}
10291039
}
10301040
}
1031-
if (passV0Sel && v0Mc.pdgCode() == kLambda0Bar) {
1041+
if (passV0Sel && v0Mc.pdgCode() == kLambda0Bar && v0.alpha() < 0) {
10321042
if (isSelectedV0Daughter(trackV0Neg, v0, kProtonBar) && isSelectedV0Daughter(trackV0Pos, v0, kPiPlus)) {
10331043
registry.fill(HIST("hV0LambdaMcRec"), v0.mAntiLambda(), v0.pt(), partV0Neg.pt());
10341044
registry.fill(HIST("hV0LambdaReflMcRec"), v0.mLambda(), v0.pt(), partV0Pos.pt());

0 commit comments

Comments
 (0)