Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 44 additions & 25 deletions Common/Core/TrackSelectorPID.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#ifndef COMMON_CORE_TRACKSELECTORPID_H_
#define COMMON_CORE_TRACKSELECTORPID_H_

#include <CommonConstants/PhysicsConstants.h>
#include <Framework/Logger.h>
#include <ReconstructionDataFormats/PID.h>

Expand All @@ -43,6 +44,9 @@ class TrackSelectorPidBase
/// Default constructor
TrackSelectorPidBase() = default;

static constexpr float NSigmaMinDefault{-999.f};
static constexpr float NSigmaMaxDefault{999.f};

/// Conversion operator
template <uint64_t pdgNew>
operator TrackSelectorPidBase<pdgNew>() const
Expand Down Expand Up @@ -108,10 +112,10 @@ class TrackSelectorPidBase
/// \param tpcNSigmaCustom custom TPC nσ value to be used for the selection, in case the desired value cannot be taken from the track table
/// \return true if track satisfies TPC PID hypothesis for given TPC nσ range
template <typename T>
bool isSelectedByTpc(const T& track, bool& conditionalTof, float tpcNSigmaCustom = -999.f)
bool isSelectedByTpc(const T& track, bool& conditionalTof, float tpcNSigmaCustom = NSigmaMinDefault)
{
// Accept if selection is disabled via large values.
if (mNSigmaTpcMin < -999. && mNSigmaTpcMax > 999.) {
if (mNSigmaTpcMin < NSigmaMinDefault && mNSigmaTpcMax > NSigmaMaxDefault) {
return true;
}

Expand All @@ -127,16 +131,18 @@ class TrackSelectorPidBase
nSigma = track.tpcNSigmaKa();
} else if constexpr (pdg == kProton) {
nSigma = track.tpcNSigmaPr();
} else if constexpr (pdg == o2::constants::physics::Pdg::kDeuteron) {
nSigma = track.tpcNSigmaDe();
} else {
errorPdg();
}

/// use custom TPC nσ, if a valid value is provided
if (tpcNSigmaCustom > -999.f) {
if (tpcNSigmaCustom > NSigmaMinDefault) {
nSigma = tpcNSigmaCustom;
}

if (mNSigmaTpcMinCondTof < -999. && mNSigmaTpcMaxCondTof > 999.) {
if (mNSigmaTpcMinCondTof < NSigmaMinDefault && mNSigmaTpcMaxCondTof > NSigmaMaxDefault) {
conditionalTof = true;
} else {
conditionalTof = mNSigmaTpcMinCondTof <= nSigma && nSigma <= mNSigmaTpcMaxCondTof;
Expand All @@ -148,7 +154,7 @@ class TrackSelectorPidBase
/// \param track track
/// \return TPC selection status (see TrackSelectorPID::Status)
template <typename T>
TrackSelectorPID::Status statusTpc(const T& track, float tpcNSigmaCustom = -999.f)
TrackSelectorPID::Status statusTpc(const T& track, float tpcNSigmaCustom = NSigmaMinDefault)
{
if (!isValidForTpc(track)) {
return TrackSelectorPID::NotApplicable;
Expand Down Expand Up @@ -202,10 +208,10 @@ class TrackSelectorPidBase
/// \param tofNSigmaCustom custom TOF nσ value to be used for the selection, in case the desired value cannot be taken from the track table
/// \return true if track satisfies TOF PID hypothesis for given TOF nσ range
template <typename T>
bool isSelectedByTof(const T& track, bool& conditionalTpc, float tofNSigmaCustom = -999.f)
bool isSelectedByTof(const T& track, bool& conditionalTpc, float tofNSigmaCustom = NSigmaMinDefault)
{
// Accept if selection is disabled via large values.
if (mNSigmaTofMin < -999. && mNSigmaTofMax > 999.) {
if (mNSigmaTofMin < NSigmaMinDefault && mNSigmaTofMax > NSigmaMaxDefault) {
return true;
}

Expand All @@ -221,16 +227,18 @@ class TrackSelectorPidBase
nSigma = track.tofNSigmaKa();
} else if constexpr (pdg == kProton) {
nSigma = track.tofNSigmaPr();
} else if constexpr (pdg == o2::constants::physics::Pdg::kDeuteron) {
nSigma = track.tofNSigmaDe();
} else {
errorPdg();
}

/// use custom TOF nσ, if a valid value is provided
if (tofNSigmaCustom > -999.f) {
if (tofNSigmaCustom > NSigmaMinDefault) {
nSigma = tofNSigmaCustom;
}

if (mNSigmaTofMinCondTpc < -999. && mNSigmaTofMaxCondTpc > 999.) {
if (mNSigmaTofMinCondTpc < NSigmaMinDefault && mNSigmaTofMaxCondTpc > NSigmaMaxDefault) {
conditionalTpc = true;
} else {
conditionalTpc = mNSigmaTofMinCondTpc <= nSigma && nSigma <= mNSigmaTofMaxCondTpc;
Expand All @@ -242,7 +250,7 @@ class TrackSelectorPidBase
/// \param track track
/// \return TOF selection status (see TrackSelectorPID::Status)
template <typename T>
TrackSelectorPID::Status statusTof(const T& track, float tofNSigmaCustom = -999.f)
TrackSelectorPID::Status statusTof(const T& track, float tofNSigmaCustom = NSigmaMinDefault)
{
if (!isValidForTof(track)) {
return TrackSelectorPID::NotApplicable;
Expand Down Expand Up @@ -301,7 +309,7 @@ class TrackSelectorPidBase
bool isSelectedByRich(const T& track, bool& conditionalTof)
{
// Accept if selection is disabled via large values.
if (mNSigmaRichMin < -999. && mNSigmaRichMax > 999.) {
if (mNSigmaRichMin < NSigmaMinDefault && mNSigmaRichMax > NSigmaMaxDefault) {
return true;
}

Expand All @@ -321,7 +329,7 @@ class TrackSelectorPidBase
errorPdg();
}

if (mNSigmaRichMinCondTof < -999. && mNSigmaRichMaxCondTof > 999.) {
if (mNSigmaRichMinCondTof < NSigmaMinDefault && mNSigmaRichMaxCondTof > NSigmaMaxDefault) {
conditionalTof = true;
} else {
conditionalTof = mNSigmaRichMinCondTof <= nSigma && nSigma <= mNSigmaRichMaxCondTof;
Expand Down Expand Up @@ -405,7 +413,7 @@ class TrackSelectorPidBase
/// \param track track
/// \return status of combined PID (TPC or TOF) (see TrackSelectorPID::Status)
template <typename T>
TrackSelectorPID::Status statusTpcOrTof(const T& track, float tpcNSigmaCustom = -999.f, float tofNSigmaCustom = -999.f)
TrackSelectorPID::Status statusTpcOrTof(const T& track, float tpcNSigmaCustom = NSigmaMinDefault, float tofNSigmaCustom = NSigmaMinDefault)
{
int pidTpc = statusTpc(track, tpcNSigmaCustom);
int pidTof = statusTof(track, tofNSigmaCustom);
Expand All @@ -426,7 +434,7 @@ class TrackSelectorPidBase
/// \param track track
/// \return status of combined PID (TPC and TOF) (see TrackSelectorPID::Status)
template <typename T>
TrackSelectorPID::Status statusTpcAndTof(const T& track, float tpcNSigmaCustom = -999.f, float tofNSigmaCustom = -999.f)
TrackSelectorPID::Status statusTpcAndTof(const T& track, float tpcNSigmaCustom = NSigmaMinDefault, float tofNSigmaCustom = NSigmaMinDefault)
{
int pidTpc = TrackSelectorPID::NotApplicable;
if (track.hasTPC()) {
Expand Down Expand Up @@ -464,23 +472,29 @@ class TrackSelectorPidBase
template <typename T>
bool isElectronAndNotPion(const T& track, bool useTof = true, bool useRich = true)
{
constexpr float NSigmaInvalid{-1000.f};
constexpr float PTofRichTElectronMin{0.4f};
constexpr float PTofRichTElectronMax{0.6f};
constexpr float PRichPionBandMin{1.0f};
constexpr float PRichPionBandMax{2.0f};

bool isSelTof = false;
bool isSelRich = false;
bool hasRich = track.richId() > -1;
bool hasTof = isValidForTof(track);
auto nSigmaTofEl = track.tofNSigmaEl();
auto nSigmaTofPi = track.tofNSigmaPi();
auto nSigmaRichEl = hasRich ? track.rich().richNsigmaEl() : -1000.;
auto nSigmaRichPi = hasRich ? track.rich().richNsigmaPi() : -1000.;
auto nSigmaRichEl = hasRich ? track.rich().richNsigmaEl() : NSigmaInvalid;
auto nSigmaRichPi = hasRich ? track.rich().richNsigmaPi() : NSigmaInvalid;
auto p = track.p();

// TOF
if (useTof && hasTof && (p < 0.6)) {
if (p > 0.4 && hasRich) {
if (useTof && hasTof && (p < PTofRichTElectronMax)) {
if (p > PTofRichTElectronMin && hasRich) {
if ((std::abs(nSigmaTofEl) < mNSigmaTofMax) && (std::abs(nSigmaRichEl) < mNSigmaRichMax)) {
isSelTof = true; // is selected as electron by TOF and RICH
}
} else if (p <= 0.4) {
} else if (p <= PTofRichTElectronMin) {
if (std::abs(nSigmaTofEl) < mNSigmaTofMax) {
isSelTof = true; // is selected as electron by TOF
}
Expand All @@ -499,7 +513,7 @@ class TrackSelectorPidBase
if (std::abs(nSigmaRichEl) < mNSigmaRichMax) {
isSelRich = true; // is selected as electron by RICH
}
if ((std::abs(nSigmaRichPi) < mNSigmaRichMax) && (p > 1.0) && (p < 2.0)) {
if ((std::abs(nSigmaRichPi) < mNSigmaRichMax) && (p > PRichPionBandMin) && (p < PRichPionBandMax)) {
isSelRich = false; // is selected as pion by RICH
}
} else {
Expand Down Expand Up @@ -551,6 +565,8 @@ class TrackSelectorPidBase
return track.bayesID() == o2::track::PID::Kaon;
} else if constexpr (pdg == kProton) {
return track.bayesID() == o2::track::PID::Proton;
} else if constexpr (pdg == o2::constants::physics::Pdg::kDeuteron) {
return track.bayesID() == o2::track::PID::Deuteron;
} else {
errorPdg();
return false;
Expand Down Expand Up @@ -579,6 +595,8 @@ class TrackSelectorPidBase
prob = track.bayesKa();
} else if constexpr (pdg == kProton) {
prob = track.bayesPr();
} else if constexpr (pdg == o2::constants::physics::Pdg::kDeuteron) {
prob = track.bayesDe();
} else {
errorPdg();
}
Expand Down Expand Up @@ -656,10 +674,11 @@ class TrackSelectorPidBase
};

// Predefined types
using TrackSelectorEl = TrackSelectorPidBase<kElectron>; // El
using TrackSelectorMu = TrackSelectorPidBase<kMuonMinus>; // Mu
using TrackSelectorPi = TrackSelectorPidBase<kPiPlus>; // Pi
using TrackSelectorKa = TrackSelectorPidBase<kKPlus>; // Ka
using TrackSelectorPr = TrackSelectorPidBase<kProton>; // Pr
using TrackSelectorEl = TrackSelectorPidBase<kElectron>; // El
using TrackSelectorMu = TrackSelectorPidBase<kMuonMinus>; // Mu
using TrackSelectorPi = TrackSelectorPidBase<kPiPlus>; // Pi
using TrackSelectorKa = TrackSelectorPidBase<kKPlus>; // Ka
using TrackSelectorPr = TrackSelectorPidBase<kProton>; // Pr
using TrackSelectorDe = TrackSelectorPidBase<o2::constants::physics::Pdg::kDeuteron>; // De

#endif // COMMON_CORE_TRACKSELECTORPID_H_
14 changes: 14 additions & 0 deletions PWGHF/Core/HfHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,20 @@ class HfHelper
return RecoDecay::m(std::array{candidate.pVectorProng2(), candidate.pVectorProng0()}, std::array{o2::constants::physics::MassProton, o2::constants::physics::MassPiPlus});
}

// Cd± → De± K∓ π±

template <typename T>
auto invMassCdToDeKPi(const T& candidate)
{
return candidate.m(std::array{o2::constants::physics::MassDeuteron, o2::constants::physics::MassKPlus, o2::constants::physics::MassPiPlus});
}

template <typename T>
auto invMassCdToPiKDe(const T& candidate)
{
return candidate.m(std::array{o2::constants::physics::MassPiPlus, o2::constants::physics::MassKPlus, o2::constants::physics::MassDeuteron});
}

// Ξc± → p± K∓ π±

template <typename T>
Expand Down
42 changes: 40 additions & 2 deletions PWGHF/Core/SelectorCuts.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,13 @@ static const std::vector<std::string> labelsCutVarTrack = {"min_dcaxytoprimary",
namespace hf_presel_pid
{
// default values for the PID cuts for protons in the track-index-skim-creator
constexpr float CutsPid[4][6] = {{0.f, 1000.f, 5.f, 0.f, 1000.f, 5.f},
constexpr float CutsPid[5][6] = {{0.f, 1000.f, 5.f, 0.f, 1000.f, 5.f},
{0.f, 1000.f, 5.f, 0.f, 1000.f, 5.f},
{0.f, 1000.f, 5.f, 0.f, 1000.f, 5.f},
{0.f, 1000.f, 5.f, 0.f, 1000.f, 5.f},
{0.f, 1000.f, 5.f, 0.f, 1000.f, 5.f}};
static const std::vector<std::string> labelsCutsPid = {"minPtTpc", "maxPtTpc", "nSigmaMaxTpc", "minPtTof", "maxPtTof", "nSigmaMaxTof"};
static const std::vector<std::string> labelsRowsPid = {"ProtonInLcToPKPi", "ProtonInXicToPKPi", "ProtonInLcToPK0S", "KaonIn3Prongs"};
static const std::vector<std::string> labelsRowsPid = {"ProtonInLcToPKPi", "ProtonInXicToPKPi", "ProtonInLcToPK0S", "KaonIn3Prongs", "DeuteronInCdToDeKPi"};
} // namespace hf_presel_pid

namespace hf_cuts_bdt_multiclass
Expand Down Expand Up @@ -1516,6 +1517,43 @@ static const std::vector<std::string> labelsPt = {
static const std::vector<std::string> labelsCutVar = {"max pKpi mass Lc", "max piKp mass Lc"};
} // namespace hf_cuts_sigmac_to_p_k_pi

namespace hf_cuts_cd_to_de_k_pi
{
static constexpr int NBinsPt = 6;
static constexpr int NCutVars = 10;
// 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] = {
0.,
2.,
4.,
6.,
8.,
12.,
24.};
const auto vecBinsPt = std::vector<double>{BinsPt, BinsPt + NBinsPt + 1};

// default values for the cuts m, ptP, ptK, ptPi, chi2PCA, dL, cosp, dLXY, NdLXY, ImpParXY, mass(Kpi)
constexpr double Cuts[NBinsPt][NCutVars] = {{0.4, 0.4, 0.4, 0.4, 0., 0.005, 0., 0., 0., 1e+10}, /* 0 < pT < 2 */
{0.4, 0.4, 0.4, 0.4, 0., 0.005, 0., 0., 0., 1e+10}, /* 2 < pT < 4 */
{0.4, 0.4, 0.4, 0.4, 0., 0.005, 0., 0., 0., 1e+10}, /* 4 < pT < 6 */
{0.4, 0.4, 0.4, 0.4, 0., 0.005, 0., 0., 0., 1e+10}, /* 6 < pT < 8 */
{0.4, 0.4, 0.4, 0.4, 0., 0.005, 0., 0., 0., 1e+10}, /* 8 < pT < 12 */
{0.4, 0.4, 0.4, 0.4, 0., 0.005, 0., 0., 0., 1e+10}}; /* 12 < pT < 24 */

// row labels
static const std::vector<std::string> labelsPt = {
"pT bin 0",
"pT bin 1",
"pT bin 2",
"pT bin 3",
"pT bin 4",
"pT bin 5"};

// column labels
static const std::vector<std::string> labelsCutVar = {"m", "pT De", "pT K", "pT Pi", "Chi2PCA", "decay length", "cos pointing angle", "decLengthXY", "normDecLXY", "impParXY"};
} // namespace hf_cuts_cd_to_de_k_pi

} // namespace o2::analysis

#endif // PWGHF_CORE_SELECTORCUTS_H_
5 changes: 5 additions & 0 deletions PWGHF/D2H/Tasks/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2019-2020 CERN and copyright holders of ALICE O2.

Check failure on line 1 in PWGHF/D2H/Tasks/CMakeLists.txt

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-workflow]

Use kebab-case for names of workflows and match the name of the workflow file.
# See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
# All rights not expressly granted are reserved.
#
Expand Down Expand Up @@ -49,6 +49,11 @@
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore
COMPONENT_NAME Analysis)

o2physics_add_dpl_workflow(task-cd
SOURCES taskCd.cxx
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::EventFilteringUtils
COMPONENT_NAME Analysis)

o2physics_add_dpl_workflow(task-charm-polarisation
SOURCES taskCharmPolarisation.cxx
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore
Expand Down Expand Up @@ -114,7 +119,7 @@
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore
COMPONENT_NAME Analysis)

o2physics_add_dpl_workflow(task-omegac0-to-omega-pi

Check failure on line 122 in PWGHF/D2H/Tasks/CMakeLists.txt

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-workflow]

Workflow name task-omegac0-to-omega-pi does not match its file name taskOmegac0ToOmegapi.cxx. (Matches taskOmegac0ToOmegaPi.cxx.)
SOURCES taskOmegac0ToOmegapi.cxx
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore
COMPONENT_NAME Analysis)
Expand Down
Loading
Loading