Skip to content
17 changes: 9 additions & 8 deletions PWGHF/Core/SelectorCuts.h
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ static const std::vector<std::string> labelsCutVar = {"massMin", "massMax", "cos
namespace hf_cuts_presel_3prong
{
static constexpr int NBinsPt = 2;
static constexpr int NCutVars = 4;
static constexpr int NCutVars = 5;
// default values for the pT bin edges (can be used to configure histogram axis)
// common for any 3-prong candidate
// offset by 1 from the bin numbers in cuts array
Expand All @@ -243,20 +243,21 @@ constexpr double BinsPt[NBinsPt + 1] = {
const auto vecBinsPt = std::vector<double>{BinsPt, BinsPt + NBinsPt + 1};

// default values for the cuts
constexpr double Cuts[NBinsPt][NCutVars] = {{1.75, 2.05, 0.7, 0.02}, /* 1 < pt < 5 */
{1.75, 2.05, 0.5, 0.02}}; /* 5 < pt < 1000 */
constexpr double Cuts[NBinsPt][NCutVars] = {{1.75, 2.05, 0.7, 0.02, 0.3}, /* 1 < pt < 5 */
{1.75, 2.05, 0.5, 0.02, 0.3}}; /* 5 < pt < 1000 */

// row labels
static const std::vector<std::string> labelsPt{};

// column labels
static const std::vector<std::string> labelsCutVar = {"massMin", "massMax", "cosp", "decL"};
static const std::vector<std::string> labelsCutVar = {"massMin", "massMax", "cosp", "decL", "ptProngMin"};

} // namespace hf_cuts_presel_3prong

namespace hf_cuts_presel_ds
{
static constexpr int NBinsPt = 2;
static constexpr int NCutVars = 5;
static constexpr int NCutVars = 6;
// default values for the pT bin edges (can be used to configure histogram axis)
// offset by 1 from the bin numbers in cuts array
constexpr double BinsPt[NBinsPt + 1] = {
Expand All @@ -266,14 +267,14 @@ constexpr double BinsPt[NBinsPt + 1] = {
const auto vecBinsPt = std::vector<double>{BinsPt, BinsPt + NBinsPt + 1};

// default values for the cuts
constexpr double Cuts[NBinsPt][NCutVars] = {{1.70, 2.15, 0.7, 0.02, 0.02}, /* 1 < pt < 5 */
{1.70, 2.15, 0.5, 0.02, 0.02}}; /* 5 < pt < 1000 */
constexpr double Cuts[NBinsPt][NCutVars] = {{1.70, 2.15, 0.7, 0.02, 0.3, 0.02}, /* 1 < pt < 5 */
{1.70, 2.15, 0.5, 0.02, 0.3, 0.02}}; /* 5 < pt < 1000 */

// row labels
static const std::vector<std::string> labelsPt{};

// column labels
static const std::vector<std::string> labelsCutVar = {"massMin", "massMax", "cosp", "decL", "deltaMassKK"};
static const std::vector<std::string> labelsCutVar = {"massMin", "massMax", "cosp", "decL", "ptProngMin", "deltaMassKK"};
} // namespace hf_cuts_presel_ds

namespace hf_cuts_presel_dstar
Expand Down
29 changes: 21 additions & 8 deletions PWGHF/TableProducer/trackIndexSkimCreator.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1820,7 +1820,7 @@ struct HfTrackIndexSkimCreator {
template <typename T1, typename T2, typename T3>
void applyPreselectionPhiDecay(const int binPt, T1 const& pVecTrack0, T1 const& pVecTrack1, T1 const& pVecTrack2, T2& cutStatus, T3& whichHypo, auto& isSelected)
{
const double deltaMassMax = cut3Prong[hf_cand_3prong::DecayType::DsToKKPi].get(binPt, 4u);
const double deltaMassMax = cut3Prong[hf_cand_3prong::DecayType::DsToKKPi].get(binPt, 5u);
if (TESTBIT(whichHypo[hf_cand_3prong::DecayType::DsToKKPi], 0)) {
const double mass2PhiKKPi = RecoDecay::m2(std::array{pVecTrack0, pVecTrack1}, std::array{arrMass3Prong[hf_cand_3prong::DecayType::DsToKKPi][0][0], arrMass3Prong[hf_cand_3prong::DecayType::DsToKKPi][0][1]});
if (mass2PhiKKPi > (MassPhi + deltaMassMax) * (MassPhi + deltaMassMax) || mass2PhiKKPi < (MassPhi - deltaMassMax) * (MassPhi - deltaMassMax)) {
Expand All @@ -1836,7 +1836,7 @@ struct HfTrackIndexSkimCreator {
if (whichHypo[hf_cand_3prong::DecayType::DsToKKPi] == 0) {
CLRBIT(isSelected, hf_cand_3prong::DecayType::DsToKKPi);
if (config.debug) {
cutStatus[hf_cand_3prong::DecayType::DsToKKPi][4] = false;
cutStatus[hf_cand_3prong::DecayType::DsToKKPi][5] = false;
}
}
}
Expand All @@ -1848,7 +1848,7 @@ struct HfTrackIndexSkimCreator {
/// \param isIdentifiedPidTrack0 is the flag that tells if the track 0 has been tagged as a proton
/// \param isIdentifiedPidTrack2 is the flag that tells if the track 2 has been tagged as a proton
/// \param cutStatus is a 2D array with outcome of each selection (filled only in debug mode)
/// \param whichHypo information of the mass hypoteses that were selected
/// \param whichHypo information of the mass hypotheses that were selected
/// \param isSelected is a bitmap with selection outcome
template <typename T2, typename T3, typename T4>
void applyPreselection3Prong(T2 const& pVecTrack0, T2 const& pVecTrack1, T2 const& pVecTrack2, const auto isIdentifiedPidTrack0, const auto isIdentifiedPidTrack2, T3& cutStatus, T4& whichHypo, auto& isSelected)
Expand Down Expand Up @@ -1889,7 +1889,7 @@ struct HfTrackIndexSkimCreator {
}

// invariant mass
if ((config.debug || TESTBIT(isSelected, iDecay3P))) {
if (config.debug || TESTBIT(isSelected, iDecay3P)) {
const double minMass = cut3Prong[iDecay3P].get(binPt, 0u);
const double maxMass = cut3Prong[iDecay3P].get(binPt, 1u);
if (minMass >= 0. && maxMass > 0.) { // no need to check isSelected but to avoid mistakes
Expand Down Expand Up @@ -2000,7 +2000,7 @@ struct HfTrackIndexSkimCreator {
/// \param cutStatus is a 2D array with outcome of each selection (filled only in debug mode)
/// \param isSelected ia s bitmap with selection outcome
template <typename T1, typename T2, typename T3, typename T4>
void applySelection3Prong(const T1& pVecCand, const T2& secVtx, const T3& primVtx, T4& cutStatus, auto& isSelected)
void applySelection3Prong(const T1& pVecCand, const std::array<float, 3>& ptProngs, const T2& secVtx, const T3& primVtx, T4& cutStatus, auto& isSelected)
{
if (config.debug || isSelected > 0) {

Expand Down Expand Up @@ -2029,7 +2029,7 @@ struct HfTrackIndexSkimCreator {
}

// decay length
if ((config.debug || TESTBIT(isSelected, iDecay3P))) {
if (config.debug || TESTBIT(isSelected, iDecay3P)) {
const auto decayLength = RecoDecay::distance(primVtx, secVtx);
if (decayLength < cut3Prong[iDecay3P].get(binPt, 3u)) { // 3u == decLenIndex[iDecay3P]
CLRBIT(isSelected, iDecay3P);
Expand All @@ -2038,6 +2038,17 @@ struct HfTrackIndexSkimCreator {
}
}
}

// prong daughter pT
if (config.debug || TESTBIT(isSelected, iDecay3P)) {
const auto ptProngMin = cut3Prong[iDecay3P].get(binPt, 4u); // 4u == ptProngMinIndex[iDecay3P]
if (ptProngs[0] < ptProngMin || ptProngs[1] < ptProngMin || ptProngs[2] < ptProngMin) {
CLRBIT(isSelected, iDecay3P);
if (config.debug) {
cutStatus[iDecay3P][4] = false;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like you are using an existing reserved slot. Should you not extend the numbers of cuts instead?

}
}
}
}
}
}
Expand Down Expand Up @@ -2784,7 +2795,8 @@ struct HfTrackIndexSkimCreator {
const auto pVecCandProng3Pos = RecoDecay::pVec(pvec0, pvec1, pvec2);

// 3-prong selections after secondary vertex
applySelection3Prong(pVecCandProng3Pos, secondaryVertex3, pvRefitCoord3Prong2Pos1Neg, cutStatus3Prong, isSelected3ProngCand);
const std::array ptProngs{trackPos1.pt(), trackNeg1.pt(), trackPos2.pt()};
applySelection3Prong(pVecCandProng3Pos, ptProngs, secondaryVertex3, pvRefitCoord3Prong2Pos1Neg, cutStatus3Prong, isSelected3ProngCand);

std::array<std::vector<float>, kN3ProngDecaysUsedMlForHfFilters> mlScores3Prongs;
if (config.applyMlForHfFilters) {
Expand Down Expand Up @@ -3059,7 +3071,8 @@ struct HfTrackIndexSkimCreator {
const auto pVecCandProng3Neg = RecoDecay::pVec(pvec0, pvec1, pvec2);

// 3-prong selections after secondary vertex
applySelection3Prong(pVecCandProng3Neg, secondaryVertex3, pvRefitCoord3Prong1Pos2Neg, cutStatus3Prong, isSelected3ProngCand);
const std::array ptProngs{trackPos1.pt(), trackNeg1.pt(), trackNeg2.pt()};
applySelection3Prong(pVecCandProng3Neg, ptProngs, secondaryVertex3, pvRefitCoord3Prong1Pos2Neg, cutStatus3Prong, isSelected3ProngCand);

std::array<std::vector<float>, kN3ProngDecaysUsedMlForHfFilters> mlScores3Prongs{};
if (config.applyMlForHfFilters) {
Expand Down
Loading