2020#include " PWGHF/HFC/DataModel/CorrelationTables.h"
2121#include " PWGHF/HFC/Utils/utilsCorrelations.h"
2222#include " PWGHF/Utils/utilsAnalysis.h"
23- #include " PWGLF/DataModel/LFStrangenessPIDTables.h"
2423#include " PWGLF/DataModel/LFStrangenessTables.h"
2524
2625#include " Common/CCDB/EventSelectionParams.h"
@@ -378,14 +377,14 @@ struct HfCorrelatorXicHadrons {
378377 } cfgXicCand;
379378
380379 struct : ConfigurableGroup {
381- Configurable<float > cfgV0DaughPrPtMax{ " cfgV0DaughPrPtMax " , 5 ., " max. pT Daughter Proton" };
382- Configurable<float > cfgV0DaughPrPtMin{ " cfgV0DaughPrPtMin " , 0.3 , " min. pT Daughter Proton" };
383- Configurable<float > cfgV0DaughPiPtMax{ " cfgV0DaughPiPtMax " , 10 ., " max. pT Daughter Pion" };
384- Configurable<float > cfgV0DaughPiPtMin{ " cfgV0DaughPiPtMin " , 0.3 , " min. pT Daughter Pion" };
385- Configurable<float > cfgV0DaughPIDCutsTPCPr{ " cfgV0DaughPIDCutsTPCPr " , 2.5 , " max. TPCnSigma Proton" };
386- Configurable<float > cfgV0DaughPIDCutsTPCPi{ " cfgV0DaughPIDCutsTPCPi " , 2.5 , " max. TPCnSigma Pion" };
387- Configurable<float > cfgV0DaughPIDCutsTOFPi{ " cfgV0DaughPIDCutsTOFPi " , 2.5 , " max. TOFnSigma Pion" };
388- Configurable<float > cfgV0DaughPIDCutsTOFPr{ " cfgV0DaughPIDCutsTOFPr " , - 2.5 , " min . TOFnSigma Proton (put only negative value) " };
380+ Configurable<float > cfgDaughPrPtMax{ " cfgDaughPrPtMax " , 5 ., " max. pT Daughter Proton" };
381+ Configurable<float > cfgDaughPrPtMin{ " cfgDaughPrPtMin " , 0.3 , " min. pT Daughter Proton" };
382+ Configurable<float > cfgDaughPiPtMax{ " cfgDaughPiPtMax " , 10 ., " max. pT Daughter Pion" };
383+ Configurable<float > cfgDaughPiPtMin{ " cfgDaughPiPtMin " , 0.3 , " min. pT Daughter Pion" };
384+ Configurable<float > cfgDaughPIDCutsTPCPr{ " cfgDaughPIDCutsTPCPr " , 2.5 , " max. TPCnSigma Proton" };
385+ Configurable<float > cfgDaughPIDCutsTPCPi{ " cfgDaughPIDCutsTPCPi " , 2.5 , " max. TPCnSigma Pion" };
386+ Configurable<float > cfgDaughPIDCutsTOFPi{ " cfgDaughPIDCutsTOFPi " , 2.5 , " max. TOFnSigma Pion" };
387+ Configurable<float > cfgDaughPIDCutsTOFPr{ " cfgDaughPIDCutsTOFPr " , 2.5 , " max . TOFnSigma Pion " };
389388 Configurable<float > cfgHypMassWindow{" cfgHypMassWindow" , 0.1 , " single lambda mass selection" };
390389 Configurable<bool > cfgIsCorrCollMatchV0{" cfgIsCorrCollMatchV0" , true , " check if daughter and mother collision are same" };
391390 Configurable<bool > cfgCalDataDrivenEffPr{" cfgCalDataDrivenEffPr" , false , " calculate data driven efficiency of proton using Lambda" };
@@ -400,7 +399,6 @@ struct HfCorrelatorXicHadrons {
400399 Configurable<int > cfgMinOccupancy{" cfgMinOccupancy" , 0 , " maximum occupancy of tracks in neighbouring collisions in a given time range" };
401400 Configurable<float > cfgPV{" cfgPV" , 10 ., " maximum z-vertex" };
402401 Configurable<bool > calEffV0{" calEffV0" , false , " calculate lambda0 efficiency" };
403- Configurable<bool > checkTOFForPion{" checkTOFForPion" , false , " if True, TOF selection on pion V0 wil only be applied if TOF present" };
404402 } cfgV0;
405403
406404 SliceCache cache;
@@ -649,69 +647,65 @@ struct HfCorrelatorXicHadrons {
649647 }
650648
651649 template <typename Tracktype, typename V0Type>
652- bool isSelectedV0Daughter (Tracktype const & track, V0Type const & v0, int pid)
650+ bool isSelectedV0Daughter (Tracktype const & track, V0Type v0, int pid)
653651 {
654652 if (std::abs (track.eta ()) > cfgXicCand.etaTrackMax ) {
655653 return false ;
656654 }
657-
658655 // ---------------------------------------------------------
659656 // 1. Proton PID Selection
660657 // ---------------------------------------------------------
661658 if (std::abs (pid) == kProton ) {
662- bool hasTOFProton = (pid > 0 ) ? v0.positiveHasTOF () : v0.negativeHasTOF ();
663659 bool passTOF = false ;
664660
665- if (track.pt () > cfgV0.cfgV0DaughPrPtMax || track.pt () < cfgV0.cfgV0DaughPrPtMin ) {
661+ if (track.pt () > cfgV0.cfgDaughPrPtMax || track.pt () < cfgV0.cfgDaughPrPtMin ) {
666662 return false ;
667663 }
668-
669- if (hasTOFProton && (track.pt () > cfgXicCand.tofPIDThreshold )) {
664+ if (track.hasTOF ()) {
670665 if constexpr (std::experimental::is_detected<HasStrangeTOFinV0, V0Type>::value) {
671666 // pid > 0: Proton from Lambda (LaPr)
672667 // pid < 0: Antiproton from Anti-Lambda (ALaPr)
673668 double strangeTOF = (pid > 0 ) ? v0.tofNSigmaLaPr () : v0.tofNSigmaALaPr ();
674- passTOF = strangeTOF > cfgV0.cfgV0DaughPIDCutsTOFPr ;
675-
669+ passTOF = std::abs (strangeTOF) > cfgV0.cfgDaughPIDCutsTOFPr ;
676670 } else {
677671 // if strange TOF is unavailable
678- passTOF = track.tofNSigmaPr () > cfgV0.cfgV0DaughPIDCutsTOFPr ;
672+ passTOF = std::abs ( track.tofNSigmaPr ()) > cfgV0.cfgDaughPIDCutsTOFPr ;
679673 }
680674 }
681675
682- if ((std::abs (track.tpcNSigmaPr ()) > cfgV0.cfgV0DaughPIDCutsTPCPr ) && ! passTOF) {
676+ if ((std::abs (track.tpcNSigmaPr ()) > cfgV0.cfgDaughPIDCutsTPCPr ) || passTOF) {
683677 return false ;
684678 }
685679 }
686680
687681 // ---------------------------------------------------------
688682 // 2. Pion PID Selection
689683 // ---------------------------------------------------------
690- if (std::abs (pid) == kPiPlus && cfgV0.checkTOFForPion ) {
691- bool hasTOFPion = (pid < 0 ) ? v0.negativeHasTOF () : v0.positiveHasTOF ();
684+ if (std::abs (pid) == kPiPlus ) {
692685 bool passTOF = false ;
693686
694- if (track.pt () > cfgV0.cfgV0DaughPiPtMax || track.pt () < cfgV0.cfgV0DaughPiPtMin ) {
687+ if (track.pt () > cfgV0.cfgDaughPiPtMax || track.pt () < cfgV0.cfgDaughPiPtMin ) {
695688 return false ;
696689 }
697690
698- if (hasTOFPion && ( track.pt () > cfgXicCand. tofPIDThreshold )) {
691+ if (track.hasTOF ( )) {
699692 if constexpr (std::experimental::is_detected<HasStrangeTOFinV0, V0Type>::value) {
700693 // A pion can belong to either a Lambda/Anti-Lambda decay or a K0s decay.
701694 // We evaluate both applicable hypotheses based on charge sign and pick the best match.
702695 double tofLa = (pid > 0 ) ? v0.tofNSigmaALaPi () : v0.tofNSigmaLaPi ();
703696
704- passTOF = std::abs ( tofLa) > cfgV0.cfgV0DaughPIDCutsTOFPi ;
697+ passTOF = tofLa > cfgV0.cfgDaughPIDCutsTOFPi ;
705698 } else {
706699 // Fallback to standard track TOF
707- passTOF = std::abs (track.tofNSigmaPi ()) > cfgV0.cfgV0DaughPIDCutsTOFPi ;
700+ passTOF = std::abs (track.tofNSigmaPi ()) > cfgV0.cfgDaughPIDCutsTOFPi ;
708701 }
709702 }
710703
711- if ((std::abs (track.tpcNSigmaPi ()) > cfgV0.cfgV0DaughPIDCutsTPCPi ) && ! passTOF) {
704+ if ((std::abs (track.tpcNSigmaPi ()) > cfgV0.cfgDaughPIDCutsTPCPi ) || passTOF) {
712705 return false ;
713706 }
714707 }
708+
715709 return true ;
716710 }
717711
@@ -736,7 +730,7 @@ struct HfCorrelatorXicHadrons {
736730 }
737731
738732 // Process Lambda (proton + pion)
739- if (passV0Sel && std::abs (o2::constants::physics::MassLambda - v0.mLambda ()) < cfgV0.cfgHypMassWindow && v0. alpha () > 0 ) {
733+ if (passV0Sel && std::abs (o2::constants::physics::MassLambda - v0.mLambda ()) < cfgV0.cfgHypMassWindow ) {
740734 entryHadron (v0.mLambda (), trackV0Pos.eta (), trackV0Pos.pt () * trackV0Pos.sign (), 0 , 0 , v0.pt ());
741735 entryTrkPID (trackV0Pos.tpcNSigmaPr (), trackV0Pos.tpcNSigmaKa (), trackV0Pos.tpcNSigmaPi (), trackV0Pos.tofNSigmaPr (), trackV0Pos.tofNSigmaKa (), trackV0Pos.tofNSigmaPi ());
742736
@@ -760,7 +754,7 @@ struct HfCorrelatorXicHadrons {
760754 }
761755 }
762756
763- if (passV0Sel && std::abs (o2::constants::physics::MassLambda - v0.mAntiLambda ()) < cfgV0.cfgHypMassWindow && v0. alpha () < 0 ) {
757+ if (passV0Sel && std::abs (o2::constants::physics::MassLambda - v0.mAntiLambda ()) < cfgV0.cfgHypMassWindow ) {
764758 entryHadron (v0.mAntiLambda (), trackV0Neg.eta (), trackV0Neg.pt () * trackV0Neg.sign (), 0 , 0 , v0.pt ());
765759 entryTrkPID (trackV0Neg.tpcNSigmaPr (), trackV0Neg.tpcNSigmaKa (), trackV0Neg.tpcNSigmaPi (), trackV0Neg.tofNSigmaPr (), trackV0Neg.tofNSigmaKa (), trackV0Neg.tofNSigmaPi ());
766760
@@ -793,7 +787,7 @@ struct HfCorrelatorXicHadrons {
793787 auto const & partV0Pos = trackV0Pos.mcParticle ();
794788 auto const & partV0Neg = trackV0Neg.mcParticle ();
795789
796- if (passV0Sel && v0Mc.pdgCode () == kLambda0 && v0. alpha () > 0 ) {
790+ if (passV0Sel && v0Mc.pdgCode () == kLambda0 ) {
797791 if (isSelectedV0Daughter (trackV0Pos, v0, kProton ) && isSelectedV0Daughter (trackV0Neg, v0, kPiMinus )) {
798792 registry.fill (HIST (" hV0LambdaMcRec" ), v0.mLambda (), v0.pt (), partV0Pos.pt ());
799793 registry.fill (HIST (" hV0LambdaReflMcRec" ), v0.mAntiLambda (), v0.pt (), partV0Neg.pt ());
@@ -808,7 +802,7 @@ struct HfCorrelatorXicHadrons {
808802 }
809803 }
810804 }
811- if (passV0Sel && v0Mc.pdgCode () == kLambda0Bar && v0. alpha () < 0 ) {
805+ if (passV0Sel && v0Mc.pdgCode () == kLambda0Bar ) {
812806 if (isSelectedV0Daughter (trackV0Neg, v0, kProtonBar ) && isSelectedV0Daughter (trackV0Pos, v0, kPiPlus )) {
813807 registry.fill (HIST (" hV0LambdaMcRec" ), v0.mAntiLambda (), v0.pt (), partV0Neg.pt ());
814808 registry.fill (HIST (" hV0LambdaReflMcRec" ), v0.mLambda (), v0.pt (), partV0Pos.pt ());
@@ -855,12 +849,12 @@ struct HfCorrelatorXicHadrons {
855849
856850 if (std::abs (currentDaughter.pdgCode ()) == kProton ) {
857851
858- if (currentDaughter.pt () > cfgV0.cfgV0DaughPrPtMax || currentDaughter.pt () < cfgV0.cfgV0DaughPrPtMin ) {
852+ if (currentDaughter.pt () > cfgV0.cfgDaughPrPtMax || currentDaughter.pt () < cfgV0.cfgDaughPrPtMin ) {
859853 continue ;
860854 }
861855
862856 } else if (std::abs (currentDaughter.pdgCode ()) == kPiPlus ) {
863- if (currentDaughter.pt () > cfgV0.cfgV0DaughPiPtMax || currentDaughter.pt () < cfgV0.cfgV0DaughPiPtMin ) {
857+ if (currentDaughter.pt () > cfgV0.cfgDaughPiPtMax || currentDaughter.pt () < cfgV0.cfgDaughPiPtMin ) {
864858 continue ;
865859 }
866860
@@ -1038,7 +1032,7 @@ struct HfCorrelatorXicHadrons {
10381032 }
10391033
10401034 // Process Lambda (proton-pion)
1041- if (std::abs (o2::constants::physics::MassLambda - v0.mLambda ()) < cfgV0.cfgHypMassWindow && v0. alpha () > 0 ) {
1035+ if (std::abs (o2::constants::physics::MassLambda - v0.mLambda ()) < cfgV0.cfgHypMassWindow ) {
10421036 if (isSelectedV0Daughter (trackV0Pos, v0, kProton ) && isSelectedV0Daughter (trackV0Neg, v0, kPiMinus )) {
10431037
10441038 if (selXicCand) {
@@ -1056,7 +1050,7 @@ struct HfCorrelatorXicHadrons {
10561050 }
10571051
10581052 // Process anti-Lambda (anti-proton-pion)
1059- if (std::abs (o2::constants::physics::MassLambda - v0.mAntiLambda ()) < cfgV0.cfgHypMassWindow && v0. alpha () < 0 ) {
1053+ if (std::abs (o2::constants::physics::MassLambda - v0.mAntiLambda ()) < cfgV0.cfgHypMassWindow ) {
10601054 if (isSelectedV0Daughter (trackV0Neg, v0, kProtonBar ) && isSelectedV0Daughter (trackV0Pos, v0, kPiPlus )) {
10611055
10621056 if (selXicCand) {
@@ -1490,14 +1484,14 @@ struct HfCorrelatorXicHadrons {
14901484 auto const & trackV0Pos = assocParticle.template posTrack_as <TrackType>();
14911485 auto const & trackV0Neg = assocParticle.template negTrack_as <TrackType>();
14921486
1493- if (std::abs (o2::constants::physics::MassLambda - assocParticle.mLambda ()) < cfgV0.cfgHypMassWindow && assocParticle. alpha () > 0 ) {
1487+ if (std::abs (o2::constants::physics::MassLambda - assocParticle.mLambda ()) < cfgV0.cfgHypMassWindow ) {
14941488 if (isSelectedV0Daughter (trackV0Pos, assocParticle, kProton ) && isSelectedV0Daughter (trackV0Neg, assocParticle, kPiPlus )) {
14951489
14961490 fillCorrelationTable<IsMcRec, V0LambdaType::Lambda>(cfgXicCand.fillTrkPID , assocParticle, ptCand, etaCand, phiCand, outputMlXic, poolBin, correlationStatus, yCand, massCand, *mcParticles);
14971491 }
14981492 }
14991493
1500- if (std::abs (o2::constants::physics::MassLambda - assocParticle.mAntiLambda ()) < cfgV0.cfgHypMassWindow && assocParticle. alpha () < 0 ) {
1494+ if (std::abs (o2::constants::physics::MassLambda - assocParticle.mAntiLambda ()) < cfgV0.cfgHypMassWindow ) {
15011495 if (isSelectedV0Daughter (trackV0Neg, assocParticle, -kProton ) && isSelectedV0Daughter (trackV0Pos, assocParticle, -kPiPlus )) {
15021496 fillCorrelationTable<IsMcRec, V0LambdaType::AntiLambda>(cfgXicCand.fillTrkPID , assocParticle, ptCand, etaCand, phiCand, outputMlXic, poolBin, correlationStatus, yCand, massCand, *mcParticles);
15031497 }
@@ -1577,6 +1571,20 @@ struct HfCorrelatorXicHadrons {
15771571 listDaughters.clear ();
15781572 const std::size_t nDaughtersExpected = IsXicPlus ? XicDecayDaughtersCount::XicPlusDaughtersCount : XicDecayDaughtersCount::Xic0DaughtersCount;
15791573
1574+ if (IsXicPlus) {
1575+ // Final state: p, pi-, pi-, pi+, pi+
1576+ std::array<int , XicDecayDaughtersCount::XicPlusDaughtersCount> const arrDaughXicPlusPDG = {kProton , kPiMinus , kPiMinus , kPiPlus , kPiPlus };
1577+
1578+ // Pass -1 to automatically traverse the entire cascade down to the final state
1579+ RecoDecay::getDaughters (particle, &listDaughters, arrDaughXicPlusPDG);
1580+ } else {
1581+ // Final state: p, pi-, pi-, pi+
1582+ std::array<int , XicDecayDaughtersCount::Xic0DaughtersCount> const arrDaughXic0PDG = {kProton , kPiMinus , kPiMinus , kPiPlus };
1583+
1584+ // Pass -1 to automatically traverse the entire cascade down to the final state
1585+ RecoDecay::getDaughters (particle, &listDaughters, arrDaughXic0PDG);
1586+ }
1587+
15801588 int counterDaughters = 0 ;
15811589 std::vector<int > prongsId (nDaughtersExpected);
15821590 if (listDaughters.size () == nDaughtersExpected) {
@@ -1688,7 +1696,7 @@ struct HfCorrelatorXicHadrons {
16881696 // / Data processing: XicPlus with V0 Lambda
16891697 void processDataXicPlusV0 (SelCollisions::iterator const & collision,
16901698 TracksData const & tracks,
1691- soa::Join< aod::V0Datas, aod::V0TOFNSigmas> const & v0s,
1699+ aod::V0Datas const & v0s,
16921700 CandsXicPlusDataFiltered const & candidates,
16931701 aod::BCsWithTimestamps const &)
16941702 {
@@ -1699,7 +1707,7 @@ struct HfCorrelatorXicHadrons {
16991707 // / MC Reco processing: XicPlus with V0 Lambda
17001708 void processMcRecXicPlusV0 (SelCollisions::iterator const & collision,
17011709 TracksWithMc const & tracks,
1702- soa::Join<aod::V0Datas, aod::V0TOFNSigmas, aod:: McV0Labels> const & v0s,
1710+ soa::Join<aod::V0Datas, aod::McV0Labels> const & v0s,
17031711 CandsXicPlusMcRecFiltered const & candidates,
17041712 aod::McParticles const & mcParticles)
17051713 {
@@ -1710,7 +1718,7 @@ struct HfCorrelatorXicHadrons {
17101718 // / Data processing: Xic0 with V0 Lambda
17111719 void processDataXic0V0 (SelCollisions::iterator const & collision,
17121720 TracksData const & tracks,
1713- soa::Join< aod::V0Datas, aod::V0TOFNSigmas> const & v0s,
1721+ aod::V0Datas const & v0s,
17141722 CandsXic0DataFiltered const & candidates,
17151723 aod::BCsWithTimestamps const &)
17161724 {
@@ -1721,7 +1729,7 @@ struct HfCorrelatorXicHadrons {
17211729 // / MC Reco processing: Xic0 with V0 Lambda
17221730 void processMcRecXic0V0 (SelCollisions::iterator const & collision,
17231731 TracksWithMc const & tracks,
1724- soa::Join<aod::V0Datas, aod::V0TOFNSigmas, aod:: McV0Labels> const & v0s,
1732+ soa::Join<aod::V0Datas, aod::McV0Labels> const & v0s,
17251733 CandsXic0McRecFiltered const & candidates,
17261734 aod::McParticles const & mcParticles)
17271735 {
@@ -1732,7 +1740,7 @@ struct HfCorrelatorXicHadrons {
17321740 // / MC Reco processing: Xic0 with V0 Lambda
17331741 void processV0McRec (SelCollisions::iterator const & collision,
17341742 TracksWithMc const & tracks,
1735- soa::Join<aod::V0Datas, aod::V0TOFNSigmas, aod:: McV0Labels> const & v0s,
1743+ soa::Join<aod::V0Datas, aod::McV0Labels> const & v0s,
17361744 aod::McParticles const & mcParticles)
17371745 {
17381746 fillEffV0<true >(collision, v0s, tracks, mcParticles);
@@ -1789,7 +1797,7 @@ struct HfCorrelatorXicHadrons {
17891797 // / NOTE: V0 mixed events are more complex - need proper binning and collision matching
17901798 void processDataMixedEventXicPlusV0 (SelCollisions const & collisions,
17911799 CandsXicPlusDataFiltered const & candidates,
1792- soa::Join< aod::V0Datas, aod::V0TOFNSigmas> const & v0s,
1800+ aod::V0Datas const & v0s,
17931801 TracksData const & tracks)
17941802 {
17951803 doMixEvent<false , 1 , 1 >(collisions, v0s, candidates, tracks);
@@ -1799,7 +1807,7 @@ struct HfCorrelatorXicHadrons {
17991807 // / MC Reco Mixed Event: XicPlus with V0 Lambda
18001808 void processMcRecMixedEventXicPlusV0 (SelCollisions const & collisions,
18011809 CandsXicPlusMcRecFiltered const & candidates,
1802- soa::Join<aod::V0Datas, aod::V0TOFNSigmas, aod:: McV0Labels> const & v0s,
1810+ soa::Join<aod::V0Datas, aod::McV0Labels> const & v0s,
18031811 TracksWithMc const & tracks,
18041812 aod::McParticles const & mcParticles)
18051813 {
@@ -1810,7 +1818,7 @@ struct HfCorrelatorXicHadrons {
18101818 // / Data Mixed Event: Xic0 with V0 Lambda
18111819 void processDataMixedEventXic0V0 (SelCollisions const & collisions,
18121820 CandsXic0DataFiltered const & candidates,
1813- soa::Join< aod::V0Datas, aod::V0TOFNSigmas> const & v0s,
1821+ aod::V0Datas const & v0s,
18141822 TracksData const & tracks)
18151823 {
18161824 doMixEvent<false , 0 , 1 >(collisions, v0s, candidates, tracks);
@@ -1820,7 +1828,7 @@ struct HfCorrelatorXicHadrons {
18201828 // / MC Reco Mixed Event: Xic0 with V0 Lambda
18211829 void processMcRecMixedEventXic0V0 (SelCollisions const & collisions,
18221830 CandsXic0McRecFiltered const & candidates,
1823- soa::Join<aod::V0Datas, aod::V0TOFNSigmas, aod:: McV0Labels> const & v0s,
1831+ soa::Join<aod::V0Datas, aod::McV0Labels> const & v0s,
18241832 TracksWithMc const & tracks,
18251833 aod::McParticles const & mcParticles)
18261834 {
0 commit comments