Skip to content

Commit

Permalink
PWGHF: implement track selection for HF tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
Luigi Dello Stritto committed Apr 30, 2024
1 parent a0136ed commit 82eb996
Show file tree
Hide file tree
Showing 6 changed files with 167 additions and 72 deletions.
34 changes: 17 additions & 17 deletions PWGHF/Core/SelectorCuts.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace o2::analysis
namespace hf_cuts_single_track
{
static constexpr int nBinsPtTrack = 6;
static constexpr int nCutVarsTrack = 2;
static constexpr int nCutVarsTrack = 4;
// default values for the pT bin edges (can be used to configure histogram axis)
// common for any candidate type (2-prong, 3-prong)
// offset by 1 from the bin numbers in cuts array
Expand All @@ -40,27 +40,27 @@ constexpr double binsPtTrack[nBinsPtTrack + 1] = {
1000.0};
auto vecBinsPtTrack = std::vector<double>{binsPtTrack, binsPtTrack + nBinsPtTrack + 1};

// default values for the cuts of displaced tracks
constexpr double cutsTrack[nBinsPtTrack][nCutVarsTrack] = {{0.0025, 10.}, /* 0 < pt < 0.5 */
{0.0025, 10.}, /* 0.5 < pt < 1 */
{0.0025, 10.}, /* 1 < pt < 1.5 */
{0.0025, 10.}, /* 1.5 < pt < 2 */
{0.0000, 10.}, /* 2 < pt < 3 */
{0.0000, 10.}}; /* 3 < pt < 1000 */

// default values for the cuts of primary tracks (e.g. D* soft pions)
constexpr double cutsTrackPrimary[nBinsPtTrack][nCutVarsTrack] = {{0.0000, 2.}, /* 0 < pt < 0.5 */
{0.0000, 2.}, /* 0.5 < pt < 1 */
{0.0000, 2.}, /* 1 < pt < 1.5 */
{0.0000, 2.}, /* 1.5 < pt < 2 */
{0.0000, 2.}, /* 2 < pt < 3 */
{0.0000, 2.}}; /* 3 < pt < 1000 */
// default values for the dca_xy cuts of displaced tracks
constexpr double cutsTrack[nBinsPtTrack][nCutVarsTrack] = {{0.0025, 10., 0.0000, 100.}, /* 0 < pt < 0.5 */
{0.0025, 10., 0.0000, 100.}, /* 0.5 < pt < 1 */
{0.0025, 10., 0.0000, 100.}, /* 1 < pt < 1.5 */
{0.0025, 10., 0.0000, 100.}, /* 1.5 < pt < 2 */
{0.0000, 10., 0.0000, 100.}, /* 2 < pt < 3 */
{0.0000, 10., 0.0000, 100.}}; /* 3 < pt < 1000 */

// default values for the dca_xy cuts of primary tracks (e.g. D* soft pions)
constexpr double cutsTrackPrimary[nBinsPtTrack][nCutVarsTrack] = {{0.0000, 2., 0.0000, 100.}, /* 0 < pt < 0.5 */
{0.0000, 2., 0.0000, 100.}, /* 0.5 < pt < 1 */
{0.0000, 2., 0.0000, 100.}, /* 1 < pt < 1.5 */
{0.0000, 2., 0.0000, 100.}, /* 1.5 < pt < 2 */
{0.0000, 2., 0.0000, 100.}, /* 2 < pt < 3 */
{0.0000, 2., 0.0000, 100.}}; /* 3 < pt < 1000 */

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

// column labels
static const std::vector<std::string> labelsCutVarTrack = {"min_dcaxytoprimary", "max_dcaxytoprimary"};
static const std::vector<std::string> labelsCutVarTrack = {"min_dcaxytoprimary", "max_dcaxytoprimary", "min_dcaztoprimary", "max_dcaztoprimary"};
} // namespace hf_cuts_single_track

namespace hf_presel_pid
Expand Down
12 changes: 6 additions & 6 deletions PWGHF/TableProducer/candidateSelectorDplusToPiKPi.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ struct HfCandidateSelectorDplusToPiKPi {
Configurable<LabeledArray<double>> cuts{"cuts", {hf_cuts_dplus_to_pi_k_pi::cuts[0], hf_cuts_dplus_to_pi_k_pi::nBinsPt, hf_cuts_dplus_to_pi_k_pi::nCutVars, hf_cuts_dplus_to_pi_k_pi::labelsPt, hf_cuts_dplus_to_pi_k_pi::labelsCutVar}, "Dplus candidate selection per pT bin"};
// DCAxy selections
Configurable<LabeledArray<double>> cutsSingleTrack{"cutsSingleTrack", {hf_cuts_single_track::cutsTrack[0], hf_cuts_single_track::nBinsPtTrack, hf_cuts_single_track::nCutVarsTrack, hf_cuts_single_track::labelsPtTrack, hf_cuts_single_track::labelsCutVarTrack}, "Single-track selections"};
Configurable<std::vector<double>> binsPtTrack{"binsPtTrack", std::vector<double>{hf_cuts_single_track::vecBinsPtTrack}, "track pT bin limits for DCA XY pT-dependent cut"};
Configurable<std::vector<double>> binsPtTrack{"binsPtTrack", std::vector<double>{hf_cuts_single_track::vecBinsPtTrack}, "track pT bin limits for DCA pT-dependent cut"};
// QA switch
Configurable<bool> activateQA{"activateQA", false, "Flag to enable QA histogram"};
// ML inference
Expand Down Expand Up @@ -164,7 +164,7 @@ struct HfCandidateSelectorDplusToPiKPi {
if (std::abs(candidate.maxNormalisedDeltaIP()) > cuts->get(pTBin, "max normalized deltaIP")) {
return false;
}
if (!isSelectedCandidateDcaXY(candidate)) {
if (!isSelectedCandidateDca(candidate)) {
return false;
}
return true;
Expand All @@ -174,11 +174,11 @@ struct HfCandidateSelectorDplusToPiKPi {
/// \param candidate is the Ds candidate
/// \return true if all the prongs pass the selections
template <typename T1>
bool isSelectedCandidateDcaXY(const T1& candidate)
bool isSelectedCandidateDca(const T1& candidate)
{
return (isSelectedTrackDcaXY(binsPtTrack, cutsSingleTrack, candidate.ptProng0(), candidate.impactParameter0()) &&
isSelectedTrackDcaXY(binsPtTrack, cutsSingleTrack, candidate.ptProng1(), candidate.impactParameter1()) &&
isSelectedTrackDcaXY(binsPtTrack, cutsSingleTrack, candidate.ptProng2(), candidate.impactParameter2()));
return (isSelectedTrackDca(binsPtTrack, cutsSingleTrack, candidate.ptProng0(), candidate.impactParameter0(), candidate.impactParameterZ0()) &&
isSelectedTrackDca(binsPtTrack, cutsSingleTrack, candidate.ptProng1(), candidate.impactParameter1(), candidate.impactParameterZ1()) &&
isSelectedTrackDca(binsPtTrack, cutsSingleTrack, candidate.ptProng2(), candidate.impactParameter2(), candidate.impactParameterZ2()));
}

/// Apply PID selection
Expand Down
14 changes: 7 additions & 7 deletions PWGHF/TableProducer/candidateSelectorDsToKKPi.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ struct HfCandidateSelectorDsToKKPi {
// topological cuts
Configurable<std::vector<double>> binsPt{"binsPt", std::vector<double>{hf_cuts_ds_to_k_k_pi::vecBinsPt}, "pT bin limits"};
Configurable<LabeledArray<double>> cuts{"cuts", {hf_cuts_ds_to_k_k_pi::cuts[0], hf_cuts_ds_to_k_k_pi::nBinsPt, hf_cuts_ds_to_k_k_pi::nCutVars, hf_cuts_ds_to_k_k_pi::labelsPt, hf_cuts_ds_to_k_k_pi::labelsCutVar}, "Ds candidate selection per pT bin"};
// DCAxy selections
// DCAxy and DCAz selections
Configurable<LabeledArray<double>> cutsSingleTrack{"cutsSingleTrack", {hf_cuts_single_track::cutsTrack[0], hf_cuts_single_track::nBinsPtTrack, hf_cuts_single_track::nCutVarsTrack, hf_cuts_single_track::labelsPtTrack, hf_cuts_single_track::labelsCutVarTrack}, "Single-track selections"};
// pT bins for single-track cuts
Configurable<std::vector<double>> binsPtTrack{"binsPtTrack", std::vector<double>{hf_cuts_single_track::vecBinsPtTrack}, "track pT bin limits for DCA XY pT-dependent cut"};
Configurable<std::vector<double>> binsPtTrack{"binsPtTrack", std::vector<double>{hf_cuts_single_track::vecBinsPtTrack}, "track pT bin limits for DCA pT-dependent cut"};
// QA switch
Configurable<bool> activateQA{"activateQA", false, "Flag to enable QA histogram"};
// ML inference
Expand Down Expand Up @@ -126,11 +126,11 @@ struct HfCandidateSelectorDsToKKPi {
/// \param candidate is the Ds candidate
/// \return true if all the prongs pass the selections
template <typename T1>
bool isSelectedCandidateDcaXY(const T1& candidate)
bool isSelectedCandidateDca(const T1& candidate)
{
if (isSelectedTrackDcaXY(binsPtTrack, cutsSingleTrack, candidate.ptProng0(), candidate.impactParameter0()) &&
isSelectedTrackDcaXY(binsPtTrack, cutsSingleTrack, candidate.ptProng1(), candidate.impactParameter1()) &&
isSelectedTrackDcaXY(binsPtTrack, cutsSingleTrack, candidate.ptProng2(), candidate.impactParameter2())) {
if (isSelectedTrackDca(binsPtTrack, cutsSingleTrack, candidate.ptProng0(), candidate.impactParameter0(), candidate.impactParameterZ0()) &&
isSelectedTrackDca(binsPtTrack, cutsSingleTrack, candidate.ptProng1(), candidate.impactParameter1(), candidate.impactParameterZ1()) &&
isSelectedTrackDca(binsPtTrack, cutsSingleTrack, candidate.ptProng2(), candidate.impactParameter2(), candidate.impactParameterZ2())) {
return true;
}
return false;
Expand Down Expand Up @@ -169,7 +169,7 @@ struct HfCandidateSelectorDsToKKPi {
if (candidate.chi2PCA() > cuts->get(pTBin, "chi2PCA")) {
return false;
}
if (!isSelectedCandidateDcaXY(candidate)) {
if (!isSelectedCandidateDca(candidate)) {
return false;
}
return true;
Expand Down
Loading

0 comments on commit 82eb996

Please sign in to comment.