From f5cdd433a1d32c65712692f8139ea21c7147b22a Mon Sep 17 00:00:00 2001 From: fchinu Date: Sun, 12 Nov 2023 22:53:07 +0100 Subject: [PATCH 1/6] Implemented cut on delta mass phi for Ds --- PWGHF/Core/SelectorCuts.h | 23 +++++++ PWGHF/TableProducer/trackIndexSkimCreator.cxx | 67 ++++++++++++++----- 2 files changed, 73 insertions(+), 17 deletions(-) diff --git a/PWGHF/Core/SelectorCuts.h b/PWGHF/Core/SelectorCuts.h index 71fc2808c97..9defeac5f1c 100644 --- a/PWGHF/Core/SelectorCuts.h +++ b/PWGHF/Core/SelectorCuts.h @@ -186,6 +186,29 @@ static const std::vector labelsPt{}; static const std::vector labelsCutVar = {"massMin", "massMax", "cosp", "decL"}; } // namespace hf_cuts_presel_3prong +namespace hf_cuts_presel_Ds +{ +static constexpr int nBinsPt = 2; +static constexpr int nCutVars = 5; +// 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] = { + 1., + 5., + 1000.0}; +auto vecBinsPt = std::vector{binsPt, binsPt + nBinsPt + 1}; + +// default values for the cuts +constexpr double cuts[nBinsPt][nCutVars] = {{1.75, 2.05, 0.7, 0.02, 1}, /* 1 < pt < 5 */ + {1.75, 2.05, 0.5, 0.02, 1}}; /* 5 < pt < 1000 */ + +// row labels +static const std::vector labelsPt{}; + +// column labels +static const std::vector labelsCutVar = {"massMin", "massMax", "cosp", "decL", "deltaMassKK"}; +} // namespace hf_cuts_presel_3prong + namespace hf_cuts_presel_dstar { static constexpr int nBinsPt = 2; diff --git a/PWGHF/TableProducer/trackIndexSkimCreator.cxx b/PWGHF/TableProducer/trackIndexSkimCreator.cxx index d1ed5213122..e27cb61b063 100644 --- a/PWGHF/TableProducer/trackIndexSkimCreator.cxx +++ b/PWGHF/TableProducer/trackIndexSkimCreator.cxx @@ -1007,8 +1007,8 @@ struct HfTrackIndexSkimCreator { Configurable> binsPtDplusToPiKPi{"binsPtDplusToPiKPi", std::vector{hf_cuts_presel_3prong::vecBinsPt}, "pT bin limits for D+->piKpi pT-dependent cuts"}; Configurable> cutsDplusToPiKPi{"cutsDplusToPiKPi", {hf_cuts_presel_3prong::cuts[0], hf_cuts_presel_3prong::nBinsPt, hf_cuts_presel_3prong::nCutVars, hf_cuts_presel_3prong::labelsPt, hf_cuts_presel_3prong::labelsCutVar}, "D+->piKpi selections per pT bin"}; // Ds+ cuts - Configurable> binsPtDsToKKPi{"binsPtDsToKKPi", std::vector{hf_cuts_presel_3prong::vecBinsPt}, "pT bin limits for Ds+->KKPi pT-dependent cuts"}; - Configurable> cutsDsToKKPi{"cutsDsToKKPi", {hf_cuts_presel_3prong::cuts[0], hf_cuts_presel_3prong::nBinsPt, hf_cuts_presel_3prong::nCutVars, hf_cuts_presel_3prong::labelsPt, hf_cuts_presel_3prong::labelsCutVar}, "Ds+->KKPi selections per pT bin"}; + Configurable> binsPtDsToKKPi{"binsPtDsToKKPi", std::vector{hf_cuts_presel_Ds::vecBinsPt}, "pT bin limits for Ds+->KKPi pT-dependent cuts"}; + Configurable> cutsDsToKKPi{"cutsDsToKKPi", {hf_cuts_presel_Ds::cuts[0], hf_cuts_presel_Ds::nBinsPt, hf_cuts_presel_Ds::nCutVars, hf_cuts_presel_Ds::labelsPt, hf_cuts_presel_Ds::labelsCutVar}, "Ds+->KKPi selections per pT bin"}; // Lc+ cuts Configurable> binsPtLcToPKPi{"binsPtLcToPKPi", std::vector{hf_cuts_presel_3prong::vecBinsPt}, "pT bin limits for Lc->pKpi pT-dependent cuts"}; Configurable> cutsLcToPKPi{"cutsLcToPKPi", {hf_cuts_presel_3prong::cuts[0], hf_cuts_presel_3prong::nBinsPt, hf_cuts_presel_3prong::nCutVars, hf_cuts_presel_3prong::labelsPt, hf_cuts_presel_3prong::labelsCutVar}, "Lc->pKpi selections per pT bin"}; @@ -1031,13 +1031,14 @@ struct HfTrackIndexSkimCreator { double massElectron{0.}; double massMuon{0.}; double massDzero{0.}; + double massPhi{0.}; // int nColls{0}; //can be added to run over limited collisions per file - for tesing purposes static constexpr int kN2ProngDecays = hf_cand_2prong::DecayType::N2ProngDecays; // number of 2-prong hadron types static constexpr int kN3ProngDecays = hf_cand_3prong::DecayType::N3ProngDecays; // number of 3-prong hadron types static constexpr int kNCuts2Prong = 4; // how many different selections are made on 2-prongs - static constexpr int kNCuts3Prong = 4; // how many different selections are made on 3-prongs + static constexpr int kNCuts3Prong[kN3ProngDecays] = {4,4,5,4}; // how many different selections are made on 3-prongs static constexpr int kNCutsDstar = 3; // how many different selections are made on Dstars std::array, 2>, kN2ProngDecays> arrMass2Prong; std::array, 2>, kN3ProngDecays> arrMass3Prong; @@ -1084,6 +1085,7 @@ struct HfTrackIndexSkimCreator { massElectron = o2::analysis::pdg::MassElectron; massMuon = o2::analysis::pdg::MassMuonPlus; massDzero = o2::analysis::pdg::MassD0; + massPhi = o2::analysis::pdg::MassPhi; arrMass2Prong[hf_cand_2prong::DecayType::D0ToPiK] = std::array{std::array{massPi, massK}, std::array{massK, massPi}}; @@ -1304,10 +1306,10 @@ struct HfTrackIndexSkimCreator { massHypos[0] = RecoDecay::m2(arrMom, arrMass3Prong[iDecay3P][0]); massHypos[1] = RecoDecay::m2(arrMom, arrMass3Prong[iDecay3P][1]); if (massHypos[0] < min2 || massHypos[0] >= max2) { - whichHypo[iDecay3P] -= 1; + CLRBIT(whichHypo[iDecay3P], 0); } if (massHypos[1] < min2 || massHypos[1] >= max2) { - whichHypo[iDecay3P] -= 2; + CLRBIT(whichHypo[iDecay3P], 1); } if (whichHypo[iDecay3P] == 0) { CLRBIT(isSelected, iDecay3P); @@ -1316,6 +1318,32 @@ struct HfTrackIndexSkimCreator { } } } + + if ((debug || TESTBIT(isSelected, iDecay3P)) && iDecay3P == hf_cand_3prong::DecayType::DsToKKPi) { + int deltaMassPhiIndex = cut3Prong[iDecay3P].colmap.find("deltaMassKK")->second; + + if (TESTBIT(whichHypo[iDecay3P], 0)) + { + double MassPhiKKPi = RecoDecay::m(std::array{pVecTrack0, pVecTrack1}, std::array{arrMass3Prong[iDecay3P][0][0], arrMass3Prong[iDecay3P][0][1]}); + if (std::abs(MassPhiKKPi - massPhi) > cut3Prong[iDecay3P].get(pTBin, deltaMassPhiIndex)) { + CLRBIT(whichHypo[iDecay3P], 0); + } + } + if (TESTBIT(whichHypo[iDecay3P], 1)) + { + double MassPhiPiKK = RecoDecay::m(std::array{pVecTrack1, pVecTrack2}, std::array{arrMass3Prong[iDecay3P][0][1], arrMass3Prong[iDecay3P][0][2]}); + if (std::abs(MassPhiPiKK - massPhi) > cut3Prong[iDecay3P].get(pTBin, deltaMassPhiIndex)) { + CLRBIT(whichHypo[iDecay3P], 1); + } + } + + if (whichHypo[iDecay3P] == 0) { + CLRBIT(isSelected, iDecay3P); + if (debug) { + cutStatus[iDecay3P][4] = false; + } + } + } } } @@ -1688,9 +1716,14 @@ struct HfTrackIndexSkimCreator { int n3ProngBit = BIT(kN3ProngDecays) - 1; // bit value for 3-prong candidates where each candidate is one bit and they are all set to 1 bool cutStatus2Prong[kN2ProngDecays][kNCuts2Prong]; - bool cutStatus3Prong[kN3ProngDecays][kNCuts3Prong]; + std::array, kN3ProngDecays> cutStatus3Prong; int nCutStatus2ProngBit = BIT(kNCuts2Prong) - 1; // bit value for selection status for each 2-prong candidate where each selection is one bit and they are all set to 1 - int nCutStatus3ProngBit = BIT(kNCuts3Prong) - 1; // bit value for selection status for each 3-prong candidate where each selection is one bit and they are all set to 1 + bool nCutStatus3ProngBit[kN3ProngDecays]; // bit value for selection status for each 3-prong candidate where each selection is one bit and they are all set to 1 + + for (int iDecay3P = 0; iDecay3P < kN3ProngDecays; iDecay3P++) { + nCutStatus3ProngBit[iDecay3P] = BIT(kNCuts3Prong[iDecay3P]) - 1; + cutStatus3Prong[iDecay3P] = std::vector(kNCuts3Prong[iDecay3P], true); + } int whichHypo2Prong[kN2ProngDecays]; int whichHypo3Prong[kN3ProngDecays]; @@ -2017,7 +2050,7 @@ struct HfTrackIndexSkimCreator { if (debug) { for (int iDecay3P = 0; iDecay3P < kN3ProngDecays; iDecay3P++) { - for (int iCut = 0; iCut < kNCuts3Prong; iCut++) { + for (int iCut = 0; iCut < kNCuts3Prong[iDecay3P]; iCut++) { cutStatus3Prong[iDecay3P][iCut] = true; } } @@ -2158,8 +2191,8 @@ struct HfTrackIndexSkimCreator { if (debug) { int Prong3CutStatus[kN3ProngDecays]; for (int iDecay3P = 0; iDecay3P < kN3ProngDecays; iDecay3P++) { - Prong3CutStatus[iDecay3P] = nCutStatus3ProngBit; - for (int iCut = 0; iCut < kNCuts3Prong; iCut++) { + Prong3CutStatus[iDecay3P] = nCutStatus3ProngBit[iDecay3P]; + for (int iCut = 0; iCut < kNCuts3Prong[iDecay3P]; iCut++) { if (!cutStatus3Prong[iDecay3P][iCut]) { CLRBIT(Prong3CutStatus[iDecay3P], iCut); } @@ -2176,7 +2209,7 @@ struct HfTrackIndexSkimCreator { std::array, 3> arr3Mom = {pvec0, pvec1, pvec2}; for (int iDecay3P = 0; iDecay3P < kN3ProngDecays; iDecay3P++) { if (TESTBIT(isSelected3ProngCand, iDecay3P)) { - if (whichHypo3Prong[iDecay3P] == 1 || whichHypo3Prong[iDecay3P] == 3) { + if (TESTBIT(whichHypo3Prong[iDecay3P], 0)) { auto mass3Prong = RecoDecay::m(arr3Mom, arrMass3Prong[iDecay3P][0]); switch (iDecay3P) { case hf_cand_3prong::DecayType::DplusToPiKPi: @@ -2193,7 +2226,7 @@ struct HfTrackIndexSkimCreator { break; } } - if (whichHypo3Prong[iDecay3P] >= 2) { + if (TESTBIT(whichHypo3Prong[iDecay3P], 1)) { auto mass3Prong = RecoDecay::m(arr3Mom, arrMass3Prong[iDecay3P][1]); switch (iDecay3P) { case hf_cand_3prong::DecayType::DsToKKPi: @@ -2271,7 +2304,7 @@ struct HfTrackIndexSkimCreator { if (debug) { for (int iDecay3P = 0; iDecay3P < kN3ProngDecays; iDecay3P++) { - for (int iCut = 0; iCut < kNCuts3Prong; iCut++) { + for (int iCut = 0; iCut < kNCuts3Prong[iDecay3P]; iCut++) { cutStatus3Prong[iDecay3P][iCut] = true; } } @@ -2412,8 +2445,8 @@ struct HfTrackIndexSkimCreator { if (debug) { int Prong3CutStatus[kN3ProngDecays]; for (int iDecay3P = 0; iDecay3P < kN3ProngDecays; iDecay3P++) { - Prong3CutStatus[iDecay3P] = nCutStatus3ProngBit; - for (int iCut = 0; iCut < kNCuts3Prong; iCut++) { + Prong3CutStatus[iDecay3P] = nCutStatus3ProngBit[iDecay3P]; + for (int iCut = 0; iCut < kNCuts3Prong[iDecay3P]; iCut++) { if (!cutStatus3Prong[iDecay3P][iCut]) { CLRBIT(Prong3CutStatus[iDecay3P], iCut); } @@ -2430,7 +2463,7 @@ struct HfTrackIndexSkimCreator { std::array, 3> arr3Mom = {pvec0, pvec1, pvec2}; for (int iDecay3P = 0; iDecay3P < kN3ProngDecays; iDecay3P++) { if (TESTBIT(isSelected3ProngCand, iDecay3P)) { - if (whichHypo3Prong[iDecay3P] == 1 || whichHypo3Prong[iDecay3P] == 3) { + if (TESTBIT(whichHypo3Prong[iDecay3P], 0)) { auto mass3Prong = RecoDecay::m(arr3Mom, arrMass3Prong[iDecay3P][0]); switch (iDecay3P) { case hf_cand_3prong::DecayType::DplusToPiKPi: @@ -2447,7 +2480,7 @@ struct HfTrackIndexSkimCreator { break; } } - if (whichHypo3Prong[iDecay3P] >= 2) { + if (TESTBIT(whichHypo3Prong[iDecay3P], 1)) { auto mass3Prong = RecoDecay::m(arr3Mom, arrMass3Prong[iDecay3P][1]); switch (iDecay3P) { case hf_cand_3prong::DecayType::DsToKKPi: From 3155823798fd41a763b676c5a144208533f36761 Mon Sep 17 00:00:00 2001 From: fchinu Date: Tue, 14 Nov 2023 14:32:14 +0100 Subject: [PATCH 2/6] Refactored the selections and updated 2prongs code for consistency --- PWGHF/Core/SelectorCuts.h | 2 +- PWGHF/TableProducer/trackIndexSkimCreator.cxx | 94 +++++++++++-------- 2 files changed, 58 insertions(+), 38 deletions(-) diff --git a/PWGHF/Core/SelectorCuts.h b/PWGHF/Core/SelectorCuts.h index 9defeac5f1c..8cc979fbe06 100644 --- a/PWGHF/Core/SelectorCuts.h +++ b/PWGHF/Core/SelectorCuts.h @@ -207,7 +207,7 @@ static const std::vector labelsPt{}; // column labels static const std::vector labelsCutVar = {"massMin", "massMax", "cosp", "decL", "deltaMassKK"}; -} // namespace hf_cuts_presel_3prong +} // namespace hf_cuts_presel_Ds namespace hf_cuts_presel_dstar { diff --git a/PWGHF/TableProducer/trackIndexSkimCreator.cxx b/PWGHF/TableProducer/trackIndexSkimCreator.cxx index e27cb61b063..23bbc94d5a0 100644 --- a/PWGHF/TableProducer/trackIndexSkimCreator.cxx +++ b/PWGHF/TableProducer/trackIndexSkimCreator.cxx @@ -1037,8 +1037,8 @@ struct HfTrackIndexSkimCreator { static constexpr int kN2ProngDecays = hf_cand_2prong::DecayType::N2ProngDecays; // number of 2-prong hadron types static constexpr int kN3ProngDecays = hf_cand_3prong::DecayType::N3ProngDecays; // number of 3-prong hadron types - static constexpr int kNCuts2Prong = 4; // how many different selections are made on 2-prongs - static constexpr int kNCuts3Prong[kN3ProngDecays] = {4,4,5,4}; // how many different selections are made on 3-prongs + static constexpr int kNCuts2Prong[kN2ProngDecays] = {hf_cuts_presel_2prong::nCutVars, hf_cuts_presel_2prong::nCutVars, hf_cuts_presel_2prong::nCutVars}; // how many different selections are made on 2-prongs + static constexpr int kNCuts3Prong[kN3ProngDecays] = {hf_cuts_presel_3prong::nCutVars, hf_cuts_presel_3prong::nCutVars, hf_cuts_presel_Ds::nCutVars, hf_cuts_presel_3prong::nCutVars}; // how many different selections are made on 3-prongs static constexpr int kNCutsDstar = 3; // how many different selections are made on Dstars std::array, 2>, kN2ProngDecays> arrMass2Prong; std::array, 2>, kN3ProngDecays> arrMass3Prong; @@ -1230,10 +1230,10 @@ struct HfTrackIndexSkimCreator { massHypos[0] = RecoDecay::m2(arrMom, arrMass2Prong[iDecay2P][0]); massHypos[1] = RecoDecay::m2(arrMom, arrMass2Prong[iDecay2P][1]); if (massHypos[0] < min2 || massHypos[0] >= max2) { - whichHypo[iDecay2P] -= 1; + CLRBIT(whichHypo[iDecay2P], 0); } if (massHypos[1] < min2 || massHypos[1] >= max2) { - whichHypo[iDecay2P] -= 2; + CLRBIT(whichHypo[iDecay2P], 1); } if (whichHypo[iDecay2P] == 0) { CLRBIT(isSelected, iDecay2P); @@ -1256,13 +1256,51 @@ struct HfTrackIndexSkimCreator { } } + /// Method to perform selections on difference from nominal mass for phi decay + /// \param pVecTrack0 is the momentum array of the first daughter track + /// \param pVecTrack1 is the momentum array of the second daughter track + /// \param pVecTrack2 is the momentum array of the third daughter track + /// \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 isSelected is a bitmap with selection outcome + /// \param iDecay3P is the index of the 3-prong decay + template + void isPhiDecayPreselected(T1 const& pVecTrack0, T1 const& pVecTrack1, T1 const& pVecTrack2, T2& cutStatus, T3& whichHypo, int& isSelected, int const& iDecay3P) + { + auto pT = RecoDecay::pt(pVecTrack0, pVecTrack1, pVecTrack2) + ptTolerance; // add tolerance because of no reco decay vertex + auto pTBin = findBin(&pTBins3Prong[iDecay3P], pT); + int deltaMassPhiIndex = cut3Prong[iDecay3P].colmap.find("deltaMassKK")->second; + + if (TESTBIT(whichHypo[iDecay3P], 0)) + { + double MassPhiKKPi = RecoDecay::m(std::array{pVecTrack0, pVecTrack1}, std::array{arrMass3Prong[iDecay3P][0][0], arrMass3Prong[iDecay3P][0][1]}); + if (std::abs(MassPhiKKPi - massPhi) > cut3Prong[iDecay3P].get(pTBin, deltaMassPhiIndex)) { + CLRBIT(whichHypo[iDecay3P], 0); + } + } + if (TESTBIT(whichHypo[iDecay3P], 1)) + { + double MassPhiPiKK = RecoDecay::m(std::array{pVecTrack1, pVecTrack2}, std::array{arrMass3Prong[iDecay3P][0][1], arrMass3Prong[iDecay3P][0][2]}); + if (std::abs(MassPhiPiKK - massPhi) > cut3Prong[iDecay3P].get(pTBin, deltaMassPhiIndex)) { + CLRBIT(whichHypo[iDecay3P], 1); + } + } + + if (whichHypo[iDecay3P] == 0) { + CLRBIT(isSelected, iDecay3P); + if (debug) { + cutStatus[iDecay3P][4] = false; + } + } + } + /// Method to perform selections for 3-prong candidates before vertex reconstruction /// \param pVecTrack0 is the momentum array of the first daughter track /// \param pVecTrack1 is the momentum array of the second daughter track /// \param pVecTrack2 is the momentum array of the third daughter track /// \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 isSelected ia s bitmap with selection outcome + /// \param isSelected is a bitmap with selection outcome template void is3ProngPreselected(T1 const& pVecTrack0, T1 const& pVecTrack1, T1 const& pVecTrack2, T2& cutStatus, T3& whichHypo, int& isSelected) { @@ -1320,29 +1358,7 @@ struct HfTrackIndexSkimCreator { } if ((debug || TESTBIT(isSelected, iDecay3P)) && iDecay3P == hf_cand_3prong::DecayType::DsToKKPi) { - int deltaMassPhiIndex = cut3Prong[iDecay3P].colmap.find("deltaMassKK")->second; - - if (TESTBIT(whichHypo[iDecay3P], 0)) - { - double MassPhiKKPi = RecoDecay::m(std::array{pVecTrack0, pVecTrack1}, std::array{arrMass3Prong[iDecay3P][0][0], arrMass3Prong[iDecay3P][0][1]}); - if (std::abs(MassPhiKKPi - massPhi) > cut3Prong[iDecay3P].get(pTBin, deltaMassPhiIndex)) { - CLRBIT(whichHypo[iDecay3P], 0); - } - } - if (TESTBIT(whichHypo[iDecay3P], 1)) - { - double MassPhiPiKK = RecoDecay::m(std::array{pVecTrack1, pVecTrack2}, std::array{arrMass3Prong[iDecay3P][0][1], arrMass3Prong[iDecay3P][0][2]}); - if (std::abs(MassPhiPiKK - massPhi) > cut3Prong[iDecay3P].get(pTBin, deltaMassPhiIndex)) { - CLRBIT(whichHypo[iDecay3P], 1); - } - } - - if (whichHypo[iDecay3P] == 0) { - CLRBIT(isSelected, iDecay3P); - if (debug) { - cutStatus[iDecay3P][4] = false; - } - } + isPhiDecayPreselected(pVecTrack0, pVecTrack1, pVecTrack2, cutStatus, whichHypo, isSelected, iDecay3P); } } } @@ -1715,11 +1731,15 @@ struct HfTrackIndexSkimCreator { int n2ProngBit = BIT(kN2ProngDecays) - 1; // bit value for 2-prong candidates where each candidate is one bit and they are all set to 1 int n3ProngBit = BIT(kN3ProngDecays) - 1; // bit value for 3-prong candidates where each candidate is one bit and they are all set to 1 - bool cutStatus2Prong[kN2ProngDecays][kNCuts2Prong]; + std::array, kN2ProngDecays> cutStatus2Prong; std::array, kN3ProngDecays> cutStatus3Prong; - int nCutStatus2ProngBit = BIT(kNCuts2Prong) - 1; // bit value for selection status for each 2-prong candidate where each selection is one bit and they are all set to 1 + bool nCutStatus2ProngBit[kN2ProngDecays]; // bit value for selection status for each 2-prong candidate where each selection is one bit and they are all set to 1 bool nCutStatus3ProngBit[kN3ProngDecays]; // bit value for selection status for each 3-prong candidate where each selection is one bit and they are all set to 1 + for (int iDecay2P = 0; iDecay2P < kN2ProngDecays; iDecay2P++) { + nCutStatus2ProngBit[iDecay2P] = BIT(kNCuts2Prong[iDecay2P]) - 1; + cutStatus2Prong[iDecay2P] = std::vector(kNCuts2Prong[iDecay2P], true); + } for (int iDecay3P = 0; iDecay3P < kN3ProngDecays; iDecay3P++) { nCutStatus3ProngBit[iDecay3P] = BIT(kNCuts3Prong[iDecay3P]) - 1; cutStatus3Prong[iDecay3P] = std::vector(kNCuts3Prong[iDecay3P], true); @@ -1824,7 +1844,7 @@ struct HfTrackIndexSkimCreator { if (debug) { for (int iDecay2P = 0; iDecay2P < kN2ProngDecays; iDecay2P++) { - for (int iCut = 0; iCut < kNCuts2Prong; iCut++) { + for (int iCut = 0; iCut < kNCuts2Prong[iDecay2P]; iCut++) { cutStatus2Prong[iDecay2P][iCut] = true; } } @@ -1937,8 +1957,8 @@ struct HfTrackIndexSkimCreator { if (debug) { int Prong2CutStatus[kN2ProngDecays]; for (int iDecay2P = 0; iDecay2P < kN2ProngDecays; iDecay2P++) { - Prong2CutStatus[iDecay2P] = nCutStatus2ProngBit; - for (int iCut = 0; iCut < kNCuts2Prong; iCut++) { + Prong2CutStatus[iDecay2P] = nCutStatus2ProngBit[iDecay2P]; + for (int iCut = 0; iCut < kNCuts2Prong[iDecay2P]; iCut++) { if (!cutStatus2Prong[iDecay2P][iCut]) { CLRBIT(Prong2CutStatus[iDecay2P], iCut); } @@ -1955,7 +1975,7 @@ struct HfTrackIndexSkimCreator { std::array, 2> arrMom = {pvec0, pvec1}; for (int iDecay2P = 0; iDecay2P < kN2ProngDecays; iDecay2P++) { if (TESTBIT(isSelected2ProngCand, iDecay2P)) { - if (whichHypo2Prong[iDecay2P] == 1 || whichHypo2Prong[iDecay2P] == 3) { + if (TESTBIT(whichHypo2Prong[iDecay2P], 0)) { auto mass2Prong = RecoDecay::m(arrMom, arrMass2Prong[iDecay2P][0]); switch (iDecay2P) { case hf_cand_2prong::DecayType::D0ToPiK: @@ -1969,7 +1989,7 @@ struct HfTrackIndexSkimCreator { break; } } - if (whichHypo2Prong[iDecay2P] >= 2) { + if (TESTBIT(whichHypo2Prong[iDecay2P], 1)) { auto mass2Prong = RecoDecay::m(arrMom, arrMass2Prong[iDecay2P][1]); if (iDecay2P == hf_cand_2prong::DecayType::D0ToPiK) { registry.fill(HIST("hMassD0ToPiK"), mass2Prong); @@ -2010,7 +2030,7 @@ struct HfTrackIndexSkimCreator { // first we build D*+ candidates if enabled auto isSelProngPos2 = trackIndexPos2.isSelProng(); uint8_t isSelectedDstar{0}; - if (doDstar && TESTBIT(isSelected2ProngCand, hf_cand_2prong::DecayType::D0ToPiK) && (whichHypo2Prong[0] == 1 || whichHypo2Prong[0] == 3)) { // the 2-prong decay is compatible with a D0 + if (doDstar && TESTBIT(isSelected2ProngCand, hf_cand_2prong::DecayType::D0ToPiK) && TESTBIT(whichHypo2Prong[0], 0)) { // the 2-prong decay is compatible with a D0 if (TESTBIT(isSelProngPos2, CandidateType::CandDstar) && trackPos2.globalIndex() != trackPos1.globalIndex()) { // compatible with a soft pion if (thisCollId != trackPos2.collisionId()) { // this is not the "default" collision for this track, we have to re-propagate it o2::base::Propagator::Instance()->propagateToDCABxByBz({collision.posX(), collision.posY(), collision.posZ()}, trackParVarPos2, 2.f, noMatCorr, &dcaInfoPos2); @@ -2264,7 +2284,7 @@ struct HfTrackIndexSkimCreator { // first we build D*+ candidates if enabled auto isSelProngNeg2 = trackIndexNeg2.isSelProng(); uint8_t isSelectedDstar{0}; - if (doDstar && TESTBIT(isSelected2ProngCand, hf_cand_2prong::DecayType::D0ToPiK) && (whichHypo2Prong[0] >= 2)) { // the 2-prong decay is compatible with a D0bar + if (doDstar && TESTBIT(isSelected2ProngCand, hf_cand_2prong::DecayType::D0ToPiK) && TESTBIT(whichHypo2Prong[0], 1)) { // the 2-prong decay is compatible with a D0bar if (TESTBIT(isSelProngNeg2, CandidateType::CandDstar) && trackNeg2.globalIndex() != trackNeg1.globalIndex()) { // compatible with a soft pion if (thisCollId != trackNeg2.collisionId()) { // this is not the "default" collision for this track, we have to re-propagate it o2::base::Propagator::Instance()->propagateToDCABxByBz({collision.posX(), collision.posY(), collision.posZ()}, trackParVarNeg2, 2.f, noMatCorr, &dcaInfoNeg2); From 93ff9a1252b307c3b6237d7b46f309c0dd8b89b4 Mon Sep 17 00:00:00 2001 From: ALICE Action Bot Date: Tue, 14 Nov 2023 21:27:37 +0000 Subject: [PATCH 3/6] Please consider the following formatting changes --- PWGHF/TableProducer/trackIndexSkimCreator.cxx | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/PWGHF/TableProducer/trackIndexSkimCreator.cxx b/PWGHF/TableProducer/trackIndexSkimCreator.cxx index 23bbc94d5a0..4bf87f70d0a 100644 --- a/PWGHF/TableProducer/trackIndexSkimCreator.cxx +++ b/PWGHF/TableProducer/trackIndexSkimCreator.cxx @@ -1037,8 +1037,8 @@ struct HfTrackIndexSkimCreator { static constexpr int kN2ProngDecays = hf_cand_2prong::DecayType::N2ProngDecays; // number of 2-prong hadron types static constexpr int kN3ProngDecays = hf_cand_3prong::DecayType::N3ProngDecays; // number of 3-prong hadron types - static constexpr int kNCuts2Prong[kN2ProngDecays] = {hf_cuts_presel_2prong::nCutVars, hf_cuts_presel_2prong::nCutVars, hf_cuts_presel_2prong::nCutVars}; // how many different selections are made on 2-prongs - static constexpr int kNCuts3Prong[kN3ProngDecays] = {hf_cuts_presel_3prong::nCutVars, hf_cuts_presel_3prong::nCutVars, hf_cuts_presel_Ds::nCutVars, hf_cuts_presel_3prong::nCutVars}; // how many different selections are made on 3-prongs + static constexpr int kNCuts2Prong[kN2ProngDecays] = {hf_cuts_presel_2prong::nCutVars, hf_cuts_presel_2prong::nCutVars, hf_cuts_presel_2prong::nCutVars}; // how many different selections are made on 2-prongs + static constexpr int kNCuts3Prong[kN3ProngDecays] = {hf_cuts_presel_3prong::nCutVars, hf_cuts_presel_3prong::nCutVars, hf_cuts_presel_Ds::nCutVars, hf_cuts_presel_3prong::nCutVars}; // how many different selections are made on 3-prongs static constexpr int kNCutsDstar = 3; // how many different selections are made on Dstars std::array, 2>, kN2ProngDecays> arrMass2Prong; std::array, 2>, kN3ProngDecays> arrMass3Prong; @@ -1271,15 +1271,13 @@ struct HfTrackIndexSkimCreator { auto pTBin = findBin(&pTBins3Prong[iDecay3P], pT); int deltaMassPhiIndex = cut3Prong[iDecay3P].colmap.find("deltaMassKK")->second; - if (TESTBIT(whichHypo[iDecay3P], 0)) - { + if (TESTBIT(whichHypo[iDecay3P], 0)) { double MassPhiKKPi = RecoDecay::m(std::array{pVecTrack0, pVecTrack1}, std::array{arrMass3Prong[iDecay3P][0][0], arrMass3Prong[iDecay3P][0][1]}); if (std::abs(MassPhiKKPi - massPhi) > cut3Prong[iDecay3P].get(pTBin, deltaMassPhiIndex)) { CLRBIT(whichHypo[iDecay3P], 0); } } - if (TESTBIT(whichHypo[iDecay3P], 1)) - { + if (TESTBIT(whichHypo[iDecay3P], 1)) { double MassPhiPiKK = RecoDecay::m(std::array{pVecTrack1, pVecTrack2}, std::array{arrMass3Prong[iDecay3P][0][1], arrMass3Prong[iDecay3P][0][2]}); if (std::abs(MassPhiPiKK - massPhi) > cut3Prong[iDecay3P].get(pTBin, deltaMassPhiIndex)) { CLRBIT(whichHypo[iDecay3P], 1); @@ -2030,7 +2028,7 @@ struct HfTrackIndexSkimCreator { // first we build D*+ candidates if enabled auto isSelProngPos2 = trackIndexPos2.isSelProng(); uint8_t isSelectedDstar{0}; - if (doDstar && TESTBIT(isSelected2ProngCand, hf_cand_2prong::DecayType::D0ToPiK) && TESTBIT(whichHypo2Prong[0], 0)) { // the 2-prong decay is compatible with a D0 + if (doDstar && TESTBIT(isSelected2ProngCand, hf_cand_2prong::DecayType::D0ToPiK) && TESTBIT(whichHypo2Prong[0], 0)) { // the 2-prong decay is compatible with a D0 if (TESTBIT(isSelProngPos2, CandidateType::CandDstar) && trackPos2.globalIndex() != trackPos1.globalIndex()) { // compatible with a soft pion if (thisCollId != trackPos2.collisionId()) { // this is not the "default" collision for this track, we have to re-propagate it o2::base::Propagator::Instance()->propagateToDCABxByBz({collision.posX(), collision.posY(), collision.posZ()}, trackParVarPos2, 2.f, noMatCorr, &dcaInfoPos2); From 35a12c97bb83b6f0f248fad308e38d91cc91d895 Mon Sep 17 00:00:00 2001 From: Fabrizio Chinu <91954233+fchinu@users.noreply.github.com> Date: Wed, 15 Nov 2023 12:48:02 +0100 Subject: [PATCH 4/6] Update PWGHF/TableProducer/trackIndexSkimCreator.cxx Co-authored-by: Fabrizio --- PWGHF/TableProducer/trackIndexSkimCreator.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGHF/TableProducer/trackIndexSkimCreator.cxx b/PWGHF/TableProducer/trackIndexSkimCreator.cxx index 4bf87f70d0a..804902045e5 100644 --- a/PWGHF/TableProducer/trackIndexSkimCreator.cxx +++ b/PWGHF/TableProducer/trackIndexSkimCreator.cxx @@ -1356,7 +1356,7 @@ struct HfTrackIndexSkimCreator { } if ((debug || TESTBIT(isSelected, iDecay3P)) && iDecay3P == hf_cand_3prong::DecayType::DsToKKPi) { - isPhiDecayPreselected(pVecTrack0, pVecTrack1, pVecTrack2, cutStatus, whichHypo, isSelected, iDecay3P); + isPhiDecayPreselected(pVecTrack0, pVecTrack1, pVecTrack2, cutStatus, whichHypo, isSelected); } } } From 19a12a18beab4b99ae8d9448a519a067067280d8 Mon Sep 17 00:00:00 2001 From: Fabrizio Chinu <91954233+fchinu@users.noreply.github.com> Date: Wed, 15 Nov 2023 12:52:27 +0100 Subject: [PATCH 5/6] Apply suggestions from code review Co-authored-by: Fabrizio --- PWGHF/Core/SelectorCuts.h | 4 ++-- PWGHF/TableProducer/trackIndexSkimCreator.cxx | 21 +++++++++---------- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/PWGHF/Core/SelectorCuts.h b/PWGHF/Core/SelectorCuts.h index 8cc979fbe06..6b238dd1976 100644 --- a/PWGHF/Core/SelectorCuts.h +++ b/PWGHF/Core/SelectorCuts.h @@ -199,8 +199,8 @@ constexpr double binsPt[nBinsPt + 1] = { auto vecBinsPt = std::vector{binsPt, binsPt + nBinsPt + 1}; // default values for the cuts -constexpr double cuts[nBinsPt][nCutVars] = {{1.75, 2.05, 0.7, 0.02, 1}, /* 1 < pt < 5 */ - {1.75, 2.05, 0.5, 0.02, 1}}; /* 5 < pt < 1000 */ +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 */ // row labels static const std::vector labelsPt{}; diff --git a/PWGHF/TableProducer/trackIndexSkimCreator.cxx b/PWGHF/TableProducer/trackIndexSkimCreator.cxx index 804902045e5..7c9e40b42d2 100644 --- a/PWGHF/TableProducer/trackIndexSkimCreator.cxx +++ b/PWGHF/TableProducer/trackIndexSkimCreator.cxx @@ -1263,31 +1263,30 @@ struct HfTrackIndexSkimCreator { /// \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 isSelected is a bitmap with selection outcome - /// \param iDecay3P is the index of the 3-prong decay template - void isPhiDecayPreselected(T1 const& pVecTrack0, T1 const& pVecTrack1, T1 const& pVecTrack2, T2& cutStatus, T3& whichHypo, int& isSelected, int const& iDecay3P) + void isPhiDecayPreselected(T1 const& pVecTrack0, T1 const& pVecTrack1, T1 const& pVecTrack2, T2& cutStatus, T3& whichHypo, int& isSelected) { auto pT = RecoDecay::pt(pVecTrack0, pVecTrack1, pVecTrack2) + ptTolerance; // add tolerance because of no reco decay vertex - auto pTBin = findBin(&pTBins3Prong[iDecay3P], pT); - int deltaMassPhiIndex = cut3Prong[iDecay3P].colmap.find("deltaMassKK")->second; + auto pTBin = findBin(&pTBins3Prong[hf_cand_3prong::DecayType::DsToKKPi], pT); + int deltaMassPhiIndex = cut3Prong[hf_cand_3prong::DecayType::DsToKKPi].colmap.find("deltaMassKK")->second; if (TESTBIT(whichHypo[iDecay3P], 0)) { - double MassPhiKKPi = RecoDecay::m(std::array{pVecTrack0, pVecTrack1}, std::array{arrMass3Prong[iDecay3P][0][0], arrMass3Prong[iDecay3P][0][1]}); - if (std::abs(MassPhiKKPi - massPhi) > cut3Prong[iDecay3P].get(pTBin, deltaMassPhiIndex)) { + double massPhiKKPi = RecoDecay::m(std::array{pVecTrack0, pVecTrack1}, std::array{arrMass3Prong[hf_cand_3prong::DecayType::DsToKKPi][0][0], arrMass3Prong[hf_cand_3prong::DecayType::DsToKKPi][0][1]}); + if (std::abs(massPhiKKPi - massPhi) > cut3Prong[hf_cand_3prong::DecayType::DsToKKPi].get(pTBin, deltaMassPhiIndex)) { CLRBIT(whichHypo[iDecay3P], 0); } } if (TESTBIT(whichHypo[iDecay3P], 1)) { - double MassPhiPiKK = RecoDecay::m(std::array{pVecTrack1, pVecTrack2}, std::array{arrMass3Prong[iDecay3P][0][1], arrMass3Prong[iDecay3P][0][2]}); - if (std::abs(MassPhiPiKK - massPhi) > cut3Prong[iDecay3P].get(pTBin, deltaMassPhiIndex)) { + double massPhiPiKK = RecoDecay::m(std::array{pVecTrack1, pVecTrack2}, std::array{arrMass3Prong[hf_cand_3prong::DecayType::DsToKKPi][0][1], arrMass3Prong[hf_cand_3prong::DecayType::DsToKKPi][0][2]}); + if (std::abs(massPhiPiKK - massPhi) > cut3Prong[hf_cand_3prong::DecayType::DsToKKPi].get(pTBin, deltaMassPhiIndex)) { CLRBIT(whichHypo[iDecay3P], 1); } } - if (whichHypo[iDecay3P] == 0) { - CLRBIT(isSelected, iDecay3P); + if (whichHypo[hf_cand_3prong::DecayType::DsToKKPi] == 0) { + CLRBIT(isSelected, hf_cand_3prong::DecayType::DsToKKPi); if (debug) { - cutStatus[iDecay3P][4] = false; + cutStatus[hf_cand_3prong::DecayType::DsToKKPi][4] = false; } } } From fe3a6776438ade3b36647fb17544bacdb0a74a69 Mon Sep 17 00:00:00 2001 From: fchinu Date: Wed, 15 Nov 2023 13:48:52 +0100 Subject: [PATCH 6/6] Implemented suggestions --- PWGHF/Core/SelectorCuts.h | 4 ++-- PWGHF/TableProducer/trackIndexSkimCreator.cxx | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/PWGHF/Core/SelectorCuts.h b/PWGHF/Core/SelectorCuts.h index 6b238dd1976..8b42a07a2e5 100644 --- a/PWGHF/Core/SelectorCuts.h +++ b/PWGHF/Core/SelectorCuts.h @@ -186,7 +186,7 @@ static const std::vector labelsPt{}; static const std::vector labelsCutVar = {"massMin", "massMax", "cosp", "decL"}; } // namespace hf_cuts_presel_3prong -namespace hf_cuts_presel_Ds +namespace hf_cuts_presel_ds { static constexpr int nBinsPt = 2; static constexpr int nCutVars = 5; @@ -207,7 +207,7 @@ static const std::vector labelsPt{}; // column labels static const std::vector labelsCutVar = {"massMin", "massMax", "cosp", "decL", "deltaMassKK"}; -} // namespace hf_cuts_presel_Ds +} // namespace hf_cuts_presel_ds namespace hf_cuts_presel_dstar { diff --git a/PWGHF/TableProducer/trackIndexSkimCreator.cxx b/PWGHF/TableProducer/trackIndexSkimCreator.cxx index 7c9e40b42d2..0e14a4d3e77 100644 --- a/PWGHF/TableProducer/trackIndexSkimCreator.cxx +++ b/PWGHF/TableProducer/trackIndexSkimCreator.cxx @@ -1007,8 +1007,8 @@ struct HfTrackIndexSkimCreator { Configurable> binsPtDplusToPiKPi{"binsPtDplusToPiKPi", std::vector{hf_cuts_presel_3prong::vecBinsPt}, "pT bin limits for D+->piKpi pT-dependent cuts"}; Configurable> cutsDplusToPiKPi{"cutsDplusToPiKPi", {hf_cuts_presel_3prong::cuts[0], hf_cuts_presel_3prong::nBinsPt, hf_cuts_presel_3prong::nCutVars, hf_cuts_presel_3prong::labelsPt, hf_cuts_presel_3prong::labelsCutVar}, "D+->piKpi selections per pT bin"}; // Ds+ cuts - Configurable> binsPtDsToKKPi{"binsPtDsToKKPi", std::vector{hf_cuts_presel_Ds::vecBinsPt}, "pT bin limits for Ds+->KKPi pT-dependent cuts"}; - Configurable> cutsDsToKKPi{"cutsDsToKKPi", {hf_cuts_presel_Ds::cuts[0], hf_cuts_presel_Ds::nBinsPt, hf_cuts_presel_Ds::nCutVars, hf_cuts_presel_Ds::labelsPt, hf_cuts_presel_Ds::labelsCutVar}, "Ds+->KKPi selections per pT bin"}; + Configurable> binsPtDsToKKPi{"binsPtDsToKKPi", std::vector{hf_cuts_presel_ds::vecBinsPt}, "pT bin limits for Ds+->KKPi pT-dependent cuts"}; + Configurable> cutsDsToKKPi{"cutsDsToKKPi", {hf_cuts_presel_ds::cuts[0], hf_cuts_presel_ds::nBinsPt, hf_cuts_presel_ds::nCutVars, hf_cuts_presel_ds::labelsPt, hf_cuts_presel_ds::labelsCutVar}, "Ds+->KKPi selections per pT bin"}; // Lc+ cuts Configurable> binsPtLcToPKPi{"binsPtLcToPKPi", std::vector{hf_cuts_presel_3prong::vecBinsPt}, "pT bin limits for Lc->pKpi pT-dependent cuts"}; Configurable> cutsLcToPKPi{"cutsLcToPKPi", {hf_cuts_presel_3prong::cuts[0], hf_cuts_presel_3prong::nBinsPt, hf_cuts_presel_3prong::nCutVars, hf_cuts_presel_3prong::labelsPt, hf_cuts_presel_3prong::labelsCutVar}, "Lc->pKpi selections per pT bin"}; @@ -1038,7 +1038,7 @@ struct HfTrackIndexSkimCreator { static constexpr int kN2ProngDecays = hf_cand_2prong::DecayType::N2ProngDecays; // number of 2-prong hadron types static constexpr int kN3ProngDecays = hf_cand_3prong::DecayType::N3ProngDecays; // number of 3-prong hadron types static constexpr int kNCuts2Prong[kN2ProngDecays] = {hf_cuts_presel_2prong::nCutVars, hf_cuts_presel_2prong::nCutVars, hf_cuts_presel_2prong::nCutVars}; // how many different selections are made on 2-prongs - static constexpr int kNCuts3Prong[kN3ProngDecays] = {hf_cuts_presel_3prong::nCutVars, hf_cuts_presel_3prong::nCutVars, hf_cuts_presel_Ds::nCutVars, hf_cuts_presel_3prong::nCutVars}; // how many different selections are made on 3-prongs + static constexpr int kNCuts3Prong[kN3ProngDecays] = {hf_cuts_presel_3prong::nCutVars, hf_cuts_presel_3prong::nCutVars, hf_cuts_presel_ds::nCutVars, hf_cuts_presel_3prong::nCutVars}; // how many different selections are made on 3-prongs static constexpr int kNCutsDstar = 3; // how many different selections are made on Dstars std::array, 2>, kN2ProngDecays> arrMass2Prong; std::array, 2>, kN3ProngDecays> arrMass3Prong; @@ -1270,16 +1270,16 @@ struct HfTrackIndexSkimCreator { auto pTBin = findBin(&pTBins3Prong[hf_cand_3prong::DecayType::DsToKKPi], pT); int deltaMassPhiIndex = cut3Prong[hf_cand_3prong::DecayType::DsToKKPi].colmap.find("deltaMassKK")->second; - if (TESTBIT(whichHypo[iDecay3P], 0)) { + if (TESTBIT(whichHypo[hf_cand_3prong::DecayType::DsToKKPi], 0)) { double massPhiKKPi = RecoDecay::m(std::array{pVecTrack0, pVecTrack1}, std::array{arrMass3Prong[hf_cand_3prong::DecayType::DsToKKPi][0][0], arrMass3Prong[hf_cand_3prong::DecayType::DsToKKPi][0][1]}); if (std::abs(massPhiKKPi - massPhi) > cut3Prong[hf_cand_3prong::DecayType::DsToKKPi].get(pTBin, deltaMassPhiIndex)) { - CLRBIT(whichHypo[iDecay3P], 0); + CLRBIT(whichHypo[hf_cand_3prong::DecayType::DsToKKPi], 0); } } - if (TESTBIT(whichHypo[iDecay3P], 1)) { + if (TESTBIT(whichHypo[hf_cand_3prong::DecayType::DsToKKPi], 1)) { double massPhiPiKK = RecoDecay::m(std::array{pVecTrack1, pVecTrack2}, std::array{arrMass3Prong[hf_cand_3prong::DecayType::DsToKKPi][0][1], arrMass3Prong[hf_cand_3prong::DecayType::DsToKKPi][0][2]}); if (std::abs(massPhiPiKK - massPhi) > cut3Prong[hf_cand_3prong::DecayType::DsToKKPi].get(pTBin, deltaMassPhiIndex)) { - CLRBIT(whichHypo[iDecay3P], 1); + CLRBIT(whichHypo[hf_cand_3prong::DecayType::DsToKKPi], 1); } }