@@ -58,6 +58,8 @@ struct FemtoUniversePairTaskTrackV0Extended {
5858 using FemtoRecoParticles = soa::Join<aod::FDParticles, aod::FDExtParticles, aod::FDMCLabels, aod::FDExtMCParticles>;
5959 Preslice<FemtoRecoParticles> perColMC = aod::femtouniverseparticle::fdCollisionId;
6060
61+ using FemtoBasicParticles = soa::Join<aod::FDParticles, aod::FDMCLabels>;
62+
6163 // / To apply narrow cut
6264 Configurable<float > confZVertexCut{" confZVertexCut" , 10 .f , " Event sel: Maximum z-Vertex (cm)" };
6365 Configurable<float > confEta{" confEta" , 0.8 , " Eta cut for the global track" };
@@ -1533,7 +1535,8 @@ struct FemtoUniversePairTaskTrackV0Extended {
15331535 }
15341536 PROCESS_SWITCH (FemtoUniversePairTaskTrackV0Extended, processPairFractionsMCTruthV0, " Process MC data to obtain pair fractions for V0V0 MC truth pairs" , false );
15351537
1536- void processMCReco (FemtoRecoParticles const & parts, aod::FdMCParticles const & mcparts)
1538+ template <class PartType >
1539+ void doMCReco (PartType const & parts, aod::FdMCParticles const & mcparts)
15371540 {
15381541 for (const auto & part : parts) {
15391542 auto mcPartId = part.fdMCParticleId ();
@@ -1542,55 +1545,104 @@ struct FemtoUniversePairTaskTrackV0Extended {
15421545 const auto & mcpart = mcparts.iteratorAt (mcPartId);
15431546 //
15441547 if (part.partType () == aod::femtouniverseparticle::ParticleType::kV0 ) {
1548+ if (!invMLambda (part.mLambda (), part.mAntiLambda ()))
1549+ continue ;
15451550 if (mcpart.pdgMCTruth () == kLambda0 ) {
1546- const auto & posChild = parts.iteratorAt (part.globalIndex () - 2 );
1547- const auto & negChild = parts.iteratorAt (part.globalIndex () - 1 );
1548- // / Daughters that do not pass this condition are not selected
1549- if (isParticleTPC (posChild, 0 ) && isParticleTPC (negChild, 1 )) {
1550- registryMCreco.fill (HIST (" plus/MCrecoLambda" ), mcpart.pt (), mcpart.eta ()); // lambda
1551- if (auto mcpartIdChild = posChild.fdMCParticleId (); mcpartIdChild != -1 ) {
1552- const auto & mcpartChild = mcparts.iteratorAt (mcpartIdChild);
1553- registryMCreco.fill (HIST (" plus/MCrecoLambdaChildPr" ), mcpartChild.pt (), mcpartChild.eta ()); // lambda proton child
1554- }
1555- if (auto mcpartIdChild = negChild.fdMCParticleId (); mcpartIdChild != -1 ) {
1556- const auto & mcpartChild = mcparts.iteratorAt (mcpartIdChild);
1557- registryMCreco.fill (HIST (" plus/MCrecoLambdaChildPi" ), mcpartChild.pt (), mcpartChild.eta ()); // lambda pion child
1551+ const auto & posChild = parts.iteratorAt (part.globalIndex () - 2 - parts.begin ().globalIndex ());
1552+ const auto & negChild = parts.iteratorAt (part.globalIndex () - 1 - parts.begin ().globalIndex ());
1553+ if constexpr (std::experimental::is_detected<hasSigma, typename PartType::iterator>::value) {
1554+ // / Daughters that do not pass this condition are not selected
1555+ if (!isParticleTPC (posChild, 0 ) || !isParticleTPC (negChild, 1 ))
1556+ continue ;
1557+
1558+ if (!isParticleTOF (posChild, 0 ) || !isParticleTOF (negChild, 1 ))
1559+ continue ;
1560+
1561+ } else {
1562+ if ((posChild.pidCut () & (1u << 0 )) == 0 || (negChild.pidCut () & (1u << 1 )) == 0 )
1563+ continue ;
1564+
1565+ if (ConfV0Selection.confUseStrangenessTOF ) {
1566+ if ((part.pidCut () & 3 ) != 3 )
1567+ continue ;
1568+ } else {
1569+ if ((posChild.pidCut () & (8u << 0 )) == 0 || (negChild.pidCut () & (8u << 1 )) == 0 )
1570+ continue ;
15581571 }
15591572 }
1573+ registryMCreco.fill (HIST (" plus/MCrecoLambda" ), mcpart.pt (), mcpart.eta ()); // lambda
1574+
15601575 } else if (mcpart.pdgMCTruth () == kLambda0Bar ) {
1561- const auto & posChild = parts.iteratorAt (part.globalIndex () - 2 );
1562- const auto & negChild = parts.iteratorAt (part.globalIndex () - 1 );
1563- // / Daughters that do not pass this condition are not selected
1564- if (isParticleTPC (posChild, 1 ) && isParticleTPC (negChild, 0 )) {
1565- registryMCreco.fill (HIST (" minus/MCrecoLambda" ), mcpart.pt (), mcpart.eta ()); // anti-lambda
1566- if (auto mcpartIdChild = posChild.fdMCParticleId (); mcpartIdChild != -1 ) {
1567- const auto & mcpartChild = mcparts.iteratorAt (mcpartIdChild);
1568- registryMCreco.fill (HIST (" minus/MCrecoLambdaChildPi" ), mcpartChild.pt (), mcpartChild.eta ()); // anti-lambda pion child
1569- }
1570- if (auto mcpartIdChild = negChild.fdMCParticleId (); mcpartIdChild != -1 ) {
1571- const auto & mcpartChild = mcparts.iteratorAt (mcpartIdChild);
1572- registryMCreco.fill (HIST (" minus/MCrecoLambdaChildPr" ), mcpartChild.pt (), mcpartChild.eta ()); // anti-lambda proton child
1576+ const auto & posChild = parts.iteratorAt (part.globalIndex () - 2 - parts.begin ().globalIndex ());
1577+ const auto & negChild = parts.iteratorAt (part.globalIndex () - 1 - parts.begin ().globalIndex ());
1578+ if constexpr (std::experimental::is_detected<hasSigma, typename PartType::iterator>::value) {
1579+ // / Daughters that do not pass this condition are not selected
1580+ if (!isParticleTPC (posChild, 1 ) || !isParticleTPC (negChild, 0 ))
1581+ continue ;
1582+
1583+ if (!isParticleTOF (posChild, 1 ) || !isParticleTOF (negChild, 0 ))
1584+ continue ;
1585+
1586+ } else {
1587+ if ((posChild.pidCut () & (1u << 1 )) == 0 || (negChild.pidCut () & (1u << 0 )) == 0 )
1588+ continue ;
1589+
1590+ if (ConfV0Selection.confUseStrangenessTOF ) {
1591+ if ((part.pidCut () & 12 ) != 12 )
1592+ continue ;
1593+ } else {
1594+ if ((posChild.pidCut () & (8u << 1 )) == 0 || (negChild.pidCut () & (8u << 0 )) == 0 )
1595+ continue ;
15731596 }
15741597 }
1598+ registryMCreco.fill (HIST (" minus/MCrecoLambda" ), mcpart.pt (), mcpart.eta ()); // anti-lambda
15751599 }
15761600 } else if (part.partType () == aod::femtouniverseparticle::ParticleType::kTrack ) {
1577- if (part.sign () > 0 ) {
1601+ if (part.mAntiLambda () > 0 ) { // mAntiLambda is the sign here
15781602 registryMCreco.fill (HIST (" plus/MCrecoAllPt" ), mcpart.pt ());
1579- if (mcpart.pdgMCTruth () == kPiPlus && isNSigmaCombined (part.p (), aod::pidtpc_tiny::binning::unPackInTable (part.tpcNSigmaStorePi ()), aod::pidtof_tiny::binning::unPackInTable (part.tofNSigmaStorePi ()))) {
1603+ if (mcpart.pdgMCTruth () == kPiPlus ) {
1604+ if constexpr (std::experimental::is_detected<hasSigma, typename PartType::iterator>::value) {
1605+ if (!isNSigmaCombined (part.p (), aod::pidtpc_tiny::binning::unPackInTable (part.tpcNSigmaStorePi ()), aod::pidtof_tiny::binning::unPackInTable (part.tofNSigmaStorePi ())))
1606+ continue ;
1607+ } else {
1608+ if ((part.pidCut () & 128u ) == 0 ) // 128 for pion combined
1609+ continue ;
1610+ }
15801611 registryMCreco.fill (HIST (" plus/MCrecoPi" ), mcpart.pt (), mcpart.eta ());
15811612 registryMCreco.fill (HIST (" plus/MCrecoPiPt" ), mcpart.pt ());
1582- } else if (mcpart.pdgMCTruth () == kProton && isNSigmaCombined (part.p (), aod::pidtpc_tiny::binning::unPackInTable (part.tpcNSigmaStorePr ()), aod::pidtof_tiny::binning::unPackInTable (part.tofNSigmaStorePr ()))) {
1613+ } else if (mcpart.pdgMCTruth () == kProton ) {
1614+ if constexpr (std::experimental::is_detected<hasSigma, typename PartType::iterator>::value) {
1615+ if (!isNSigmaCombined (part.p (), aod::pidtpc_tiny::binning::unPackInTable (part.tpcNSigmaStorePr ()), aod::pidtof_tiny::binning::unPackInTable (part.tofNSigmaStorePr ())))
1616+ continue ;
1617+ } else {
1618+ if ((part.pidCut () & 64u ) == 0 ) // 64 for proton combined
1619+ continue ;
1620+ }
15831621 registryMCreco.fill (HIST (" plus/MCrecoPr" ), mcpart.pt (), mcpart.eta ());
15841622 registryMCreco.fill (HIST (" plus/MCrecoPrPt" ), mcpart.pt ());
15851623 }
15861624 }
15871625
1588- if (part.sign () < 0 ) {
1626+ else if (part.mAntiLambda () < 0 ) {
15891627 registryMCreco.fill (HIST (" minus/MCrecoAllPt" ), mcpart.pt ());
1590- if (mcpart.pdgMCTruth () == kPiMinus && isNSigmaCombined (part.p (), aod::pidtpc_tiny::binning::unPackInTable (part.tpcNSigmaStorePi ()), aod::pidtof_tiny::binning::unPackInTable (part.tofNSigmaStorePi ()))) {
1628+ if (mcpart.pdgMCTruth () == kPiMinus ) {
1629+ if constexpr (std::experimental::is_detected<hasSigma, typename PartType::iterator>::value) {
1630+ if (!isNSigmaCombined (part.p (), aod::pidtpc_tiny::binning::unPackInTable (part.tpcNSigmaStorePi ()), aod::pidtof_tiny::binning::unPackInTable (part.tofNSigmaStorePi ())))
1631+ continue ;
1632+ } else {
1633+ if ((part.pidCut () & 128u ) == 0 ) // 128 for pion combined
1634+ continue ;
1635+ }
15911636 registryMCreco.fill (HIST (" minus/MCrecoPi" ), mcpart.pt (), mcpart.eta ());
15921637 registryMCreco.fill (HIST (" minus/MCrecoPiPt" ), mcpart.pt ());
1593- } else if (mcpart.pdgMCTruth () == kProtonBar && isNSigmaCombined (part.p (), aod::pidtpc_tiny::binning::unPackInTable (part.tpcNSigmaStorePr ()), aod::pidtof_tiny::binning::unPackInTable (part.tofNSigmaStorePr ()))) {
1638+ } else if (mcpart.pdgMCTruth () == kProtonBar ) {
1639+ if constexpr (std::experimental::is_detected<hasSigma, typename PartType::iterator>::value) {
1640+ if (!isNSigmaCombined (part.p (), aod::pidtpc_tiny::binning::unPackInTable (part.tpcNSigmaStorePr ()), aod::pidtof_tiny::binning::unPackInTable (part.tofNSigmaStorePr ())))
1641+ continue ;
1642+ } else {
1643+ if ((part.pidCut () & 64u ) == 0 ) // 64 for proton combined
1644+ continue ;
1645+ }
15941646 registryMCreco.fill (HIST (" minus/MCrecoPr" ), mcpart.pt (), mcpart.eta ());
15951647 registryMCreco.fill (HIST (" minus/MCrecoPrPt" ), mcpart.pt ());
15961648 }
@@ -1599,7 +1651,17 @@ struct FemtoUniversePairTaskTrackV0Extended {
15991651 }
16001652 }
16011653
1654+ void processMCReco (FemtoRecoParticles const & parts, aod::FdMCParticles const & mcparts)
1655+ {
1656+ doMCReco (parts, mcparts);
1657+ }
16021658 PROCESS_SWITCH (FemtoUniversePairTaskTrackV0Extended, processMCReco, " Process MC reco data" , false );
1659+
1660+ void processMCRecoBitmask (FemtoBasicParticles const & parts, aod::FdMCParticles const & mcparts)
1661+ {
1662+ doMCReco (parts, mcparts);
1663+ }
1664+ PROCESS_SWITCH (FemtoUniversePairTaskTrackV0Extended, processMCRecoBitmask, " Process MC reco data using bitmask for PID" , false );
16031665};
16041666
16051667WorkflowSpec defineDataProcessing (ConfigContext const & cfgc)
0 commit comments