diff --git a/PWGCF/Femto/Tasks/femtoPairEfficiency.cxx b/PWGCF/Femto/Tasks/femtoPairEfficiency.cxx index 0db5443073f..3cb90975c9a 100644 --- a/PWGCF/Femto/Tasks/femtoPairEfficiency.cxx +++ b/PWGCF/Femto/Tasks/femtoPairEfficiency.cxx @@ -194,6 +194,9 @@ struct FemtoPairEfficiency { struct : ConfigurableGroup { string prefix = string("TrackSel1"); + Configurable ptMin{"ptMin", 0.f, "Minimum pT of track"}; + Configurable ptMax{"ptMax", 999.f, "Maximum pT of track"}; + Configurable etaMax{"etaMax", 0.8f, "Maximum |eta| of track"}; Configurable tpcClustersMin{"tpcClustersMin", {90.f}, "Minimum number of clusters in TPC"}; Configurable tpcCrossedRowsMin{"tpcCrossedRowsMin", {80.f}, "Minimum number of crossed rows in TPC"}; Configurable tpcClustersOverCrossedRows{"tpcClustersOverCrossedRows", {0.83f}, "Minimum fraction of clusters over crossed rows in TPC"}; @@ -211,6 +214,9 @@ struct FemtoPairEfficiency { struct : ConfigurableGroup { string prefix = string("TrackSel2"); + Configurable ptMin{"ptMin", 0.f, "Minimum pT of track"}; + Configurable ptMax{"ptMax", 999.f, "Maximum pT of track"}; + Configurable etaMax{"etaMax", 0.8f, "Maximum |eta| of track"}; Configurable tpcClustersMin{"tpcClustersMin", {90.f}, "Minimum number of clusters in TPC"}; Configurable tpcCrossedRowsMin{"tpcCrossedRowsMin", {80.f}, "Minimum number of crossed rows in TPC"}; Configurable tpcClustersOverCrossedRows{"tpcClustersOverCrossedRows", {0.83f}, "Minimum fraction of clusters over crossed rows in TPC"}; @@ -335,6 +341,10 @@ struct FemtoPairEfficiency { template bool checkTrack(T const& track, S const& sel) { + if (track.pt() < sel.ptMin.value || track.pt() > sel.ptMax.value) + return false; + if (std::fabs(track.eta()) > sel.etaMax.value) + return false; if (track.tpcNClsFound() < sel.tpcClustersMin.value) return false; if (track.tpcNClsCrossedRows() < sel.tpcCrossedRowsMin.value) @@ -401,21 +411,17 @@ struct FemtoPairEfficiency { float getKstar(ROOT::Math::PtEtaPhiMVector const& part1, ROOT::Math::PtEtaPhiMVector const& part2) { - // compute pair momentum - auto sum = part1 + part2; - // Boost particle 1 to the pair rest frame (Prf) and calculate k* (would be equivalent using particle 2) - // make a copy of particle 1 - auto particle1Prf = ROOT::Math::PtEtaPhiMVector(part1); - // get lorentz boost into pair rest frame + ROOT::Math::PxPyPzEVector p1(part1); + ROOT::Math::PxPyPzEVector p2(part2); + auto sum = p1 + p2; ROOT::Math::Boost boostPrf(sum.BoostToCM()); - // boost particle 1 into pair rest frame and calculate its momentum, which has the same value as k* - return static_cast(boostPrf(particle1Prf).P()); + return static_cast(boostPrf(p1).P()); } template bool hasPair(const T& tracks) { - bool hasPair = false; + bool foundPair = false; float mass1 = o2::analysis::femto::utils::getPdgMass(TrackSel1.pdgCode.value); float mass2 = o2::analysis::femto::utils::getPdgMass(TrackSel2.pdgCode.value); float kstar; @@ -456,9 +462,21 @@ struct FemtoPairEfficiency { histos.fill(HIST("hTrack2Phi"), RecoDecay::constrainAngle(particle2.Phi())); histos.fill(HIST("hPairKstar"), kstar); - hasPair = true; + foundPair = true; } - return hasPair; + return foundPair; + } + + template + bool checkTrackMC(T const& particle, S const& sel) + { + if (!particle.isPhysicalPrimary()) // add this + return false; + if (particle.pt() < sel.ptMin.value || particle.pt() > sel.ptMax.value) + return false; + if (std::abs(particle.eta()) > sel.etaMax.value) + return false; + return true; } template @@ -469,9 +487,11 @@ struct FemtoPairEfficiency { for (auto const& [p1, p2] : o2::soa::combinations(o2::soa::CombinationsUpperIndexPolicy(tracks, tracks))) { - bool order1 = std::abs(p1.pdgCode()) == std::abs(TrackSel1.pdgCode.value) && + bool order1 = checkTrackMC(p1, TrackSel1) && checkTrackMC(p2, TrackSel2) && + std::abs(p1.pdgCode()) == std::abs(TrackSel1.pdgCode.value) && std::abs(p2.pdgCode()) == std::abs(TrackSel2.pdgCode.value); - bool order2 = std::abs(p1.pdgCode()) == std::abs(TrackSel2.pdgCode.value) && + bool order2 = checkTrackMC(p2, TrackSel1) && checkTrackMC(p1, TrackSel2) && + std::abs(p1.pdgCode()) == std::abs(TrackSel2.pdgCode.value) && std::abs(p2.pdgCode()) == std::abs(TrackSel1.pdgCode.value); if (!order1 && !order2) {