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
14 changes: 8 additions & 6 deletions PWGHF/D2H/TableProducer/candidateSelectorB0ToDPiReduced.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,13 @@
#include "PWGHF/DataModel/CandidateReconstructionTables.h"
#include "PWGHF/DataModel/CandidateSelectionTables.h"
#include "PWGHF/D2H/DataModel/ReducedDataModel.h"
#include "PWGHF/Utils/utilsPid.h"

using namespace o2;
using namespace o2::aod;
using namespace o2::framework;
using namespace o2::analysis;
using namespace o2::aod::pid_tpc_tof_utils;

struct HfCandidateSelectorB0ToDPiReduced {
Produces<aod::HfSelB0ToDPi> hfSelB0ToDPiCandidate; // table defined in CandidateSelectionTables.h
Expand All @@ -42,7 +44,7 @@ struct HfCandidateSelectorB0ToDPiReduced {
Configurable<float> ptCandMin{"ptCandMin", 0., "Lower bound of candidate pT"};
Configurable<float> ptCandMax{"ptCandMax", 50., "Upper bound of candidate pT"};
// Enable PID
Configurable<int> pionPidMethod{"pionPidMethod", 1, "PID selection method for the bachelor pion (0: none, 1: TPC or TOF, 2: TPC and TOF)"};
Configurable<int> pionPidMethod{"pionPidMethod", PidMethod::TpcOrTof, "PID selection method for the bachelor pion (PidMethod::NoPid: none, PidMethod::TpcOrTof: TPC or TOF, PidMethod::TpcAndTof: TPC and TOF)"};
Configurable<bool> acceptPIDNotApplicable{"acceptPIDNotApplicable", true, "Switch to accept Status::NotApplicable [(NotApplicable for one detector) and (NotApplicable or Conditional for the other)] in PID selection"};
// TPC PID
Configurable<float> ptPidTpcMin{"ptPidTpcMin", 0.15, "Lower bound of track pT for TPC PID"};
Expand Down Expand Up @@ -97,11 +99,11 @@ struct HfCandidateSelectorB0ToDPiReduced {
LOGP(fatal, "Only one process function for data should be enabled at a time.");
}

if (pionPidMethod < 0 || pionPidMethod > 2) {
if (pionPidMethod < 0 || pionPidMethod >= PidMethod::NPidMethods) {
LOGP(fatal, "Invalid PID option in configurable, please set 0 (no PID), 1 (TPC or TOF), or 2 (TPC and TOF)");
}

if (pionPidMethod) {
if (pionPidMethod != PidMethod::NoPid) {
selectorPion.setRangePtTpc(ptPidTpcMin, ptPidTpcMax);
selectorPion.setRangeNSigmaTpc(-nSigmaTpcMax, nSigmaTpcMax);
selectorPion.setRangeNSigmaTpcCondTof(-nSigmaTpcCombinedMax, nSigmaTpcCombinedMax);
Expand Down Expand Up @@ -190,11 +192,11 @@ struct HfCandidateSelectorB0ToDPiReduced {

// track-level PID selection
auto trackPi = hfCandB0.template prong1_as<TracksPion>();
if (pionPidMethod) {
if (pionPidMethod == PidMethod::TpcOrTof || pionPidMethod == PidMethod::TpcAndTof) {
int pidTrackPi{TrackSelectorPID::Status::NotApplicable};
if (pionPidMethod == 1) {
if (pionPidMethod == PidMethod::TpcOrTof) {
pidTrackPi = selectorPion.statusTpcOrTof(trackPi);
} else {
} else if (pionPidMethod == PidMethod::TpcAndTof) {
pidTrackPi = selectorPion.statusTpcAndTof(trackPi);
}
if (!hfHelper.selectionB0ToDPiPid(pidTrackPi, acceptPIDNotApplicable.value)) {
Expand Down
18 changes: 10 additions & 8 deletions PWGHF/D2H/TableProducer/candidateSelectorBplusToD0PiReduced.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,13 @@
#include "PWGHF/DataModel/CandidateReconstructionTables.h"
#include "PWGHF/DataModel/CandidateSelectionTables.h"
#include "PWGHF/D2H/DataModel/ReducedDataModel.h"
#include "PWGHF/Utils/utilsPid.h"

using namespace o2;
using namespace o2::aod;
using namespace o2::framework;
using namespace o2::analysis;
using namespace o2::aod::pid_tpc_tof_utils;

struct HfCandidateSelectorBplusToD0PiReduced {
Produces<aod::HfSelBplusToD0Pi> hfSelBplusToD0PiCandidate; // table defined in CandidateSelectionTables.h
Expand All @@ -41,7 +43,7 @@ struct HfCandidateSelectorBplusToD0PiReduced {
Configurable<double> ptCandMin{"ptCandMin", 0., "Lower bound of candidate pT"};
Configurable<double> ptCandMax{"ptCandMax", 50., "Upper bound of candidate pT"};
// Enable PID
Configurable<int> pionPidMethod{"pionPidMethod", 1, "PID selection method for the bachelor pion (0: none, 1: TPC or TOF, 2: TPC and TOF)"};
Configurable<int> pionPidMethod{"pionPidMethod", PidMethod::TpcOrTof, "PID selection method for the bachelor pion (PidMethod::NoPid: none, PidMethod::TpcOrTof: TPC or TOF, PidMethod::TpcAndTof: TPC and TOF)"};
Configurable<bool> acceptPIDNotApplicable{"acceptPIDNotApplicable", true, "Switch to accept Status::NotApplicable [(NotApplicable for one detector) and (NotApplicable or Conditional for the other)] in PID selection"};
// TPC PID
Configurable<double> ptPidTpcMin{"ptPidTpcMin", 0.15, "Lower bound of track pT for TPC PID"};
Expand Down Expand Up @@ -86,22 +88,22 @@ struct HfCandidateSelectorBplusToD0PiReduced {
HfHelper hfHelper;
TrackSelectorPi selectorPion;

HistogramRegistry registry{"registry"};

using TracksPion = soa::Join<HfRedTracks, HfRedTracksPid>;

HistogramRegistry registry{"registry"};

void init(InitContext const&)
{
std::array<bool, 2> doprocess{doprocessSelection, doprocessSelectionWithDmesMl};
if ((std::accumulate(doprocess.begin(), doprocess.end(), 0)) != 1) {
LOGP(fatal, "Only one process function for data should be enabled at a time.");
}

if (pionPidMethod < 0 || pionPidMethod > 2) {
if (pionPidMethod < 0 || pionPidMethod >= PidMethod::NPidMethods) {
LOGP(fatal, "Invalid PID option in configurable, please set 0 (no PID), 1 (TPC or TOF), or 2 (TPC and TOF)");
}

if (pionPidMethod) {
if (pionPidMethod != PidMethod::NoPid) {
selectorPion.setRangePtTpc(ptPidTpcMin, ptPidTpcMax);
selectorPion.setRangeNSigmaTpc(-nSigmaTpcMax, nSigmaTpcMax);
selectorPion.setRangeNSigmaTpcCondTof(-nSigmaTpcCombinedMax, nSigmaTpcCombinedMax);
Expand Down Expand Up @@ -191,11 +193,11 @@ struct HfCandidateSelectorBplusToD0PiReduced {

// track-level PID selection
auto trackPi = hfCandBp.template prong1_as<TracksPion>();
if (pionPidMethod) {
if (pionPidMethod == PidMethod::TpcOrTof || pionPidMethod == PidMethod::TpcAndTof) {
int pidTrackPi{TrackSelectorPID::Status::NotApplicable};
if (pionPidMethod == 1) {
if (pionPidMethod == PidMethod::TpcOrTof) {
pidTrackPi = selectorPion.statusTpcOrTof(trackPi);
} else {
} else if (pionPidMethod == PidMethod::TpcAndTof) {
pidTrackPi = selectorPion.statusTpcAndTof(trackPi);
}
if (!hfHelper.selectionBplusToD0PiPid(pidTrackPi, acceptPIDNotApplicable.value)) {
Expand Down
14 changes: 8 additions & 6 deletions PWGHF/D2H/TableProducer/candidateSelectorBsToDsPiReduced.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,13 @@
#include "PWGHF/DataModel/CandidateReconstructionTables.h"
#include "PWGHF/DataModel/CandidateSelectionTables.h"
#include "PWGHF/D2H/DataModel/ReducedDataModel.h"
#include "PWGHF/Utils/utilsPid.h"

using namespace o2;
using namespace o2::aod;
using namespace o2::framework;
using namespace o2::analysis;
using namespace o2::aod::pid_tpc_tof_utils;

struct HfCandidateSelectorBsToDsPiReduced {
Produces<aod::HfSelBsToDsPi> hfSelBsToDsPiCandidate; // table defined in CandidateSelectionTables.h
Expand All @@ -41,7 +43,7 @@ struct HfCandidateSelectorBsToDsPiReduced {
Configurable<float> ptCandMin{"ptCandMin", 0., "Lower bound of candidate pT"};
Configurable<float> ptCandMax{"ptCandMax", 50., "Upper bound of candidate pT"};
// Enable PID
Configurable<int> pionPidMethod{"pionPidMethod", 1, "PID selection method for the bachelor pion (0: none, 1: TPC or TOF, 2: TPC and TOF)"};
Configurable<int> pionPidMethod{"pionPidMethod", PidMethod::TpcOrTof, "PID selection method for the bachelor pion (PidMethod::NoPid: none, PidMethod::TpcOrTof: TPC or TOF, PidMethod::TpcAndTof: TPC and TOF)"};
Configurable<bool> acceptPIDNotApplicable{"acceptPIDNotApplicable", true, "Switch to accept Status::NotApplicable [(NotApplicable for one detector) and (NotApplicable or Conditional for the other)] in PID selection"};
// TPC PID
Configurable<float> ptPidTpcMin{"ptPidTpcMin", 0.15, "Lower bound of track pT for TPC PID"};
Expand Down Expand Up @@ -93,11 +95,11 @@ struct HfCandidateSelectorBsToDsPiReduced {
LOGP(fatal, "Only one process function for data should be enabled at a time.");
}

if (pionPidMethod < 0 || pionPidMethod > 2) {
if (pionPidMethod < 0 || pionPidMethod >= PidMethod::NPidMethods) {
LOGP(fatal, "Invalid PID option in configurable, please set 0 (no PID), 1 (TPC or TOF), or 2 (TPC and TOF)");
}

if (pionPidMethod) {
if (pionPidMethod != PidMethod::NoPid) {
selectorPion.setRangePtTpc(ptPidTpcMin, ptPidTpcMax);
selectorPion.setRangeNSigmaTpc(-nSigmaTpcMax, nSigmaTpcMax);
selectorPion.setRangeNSigmaTpcCondTof(-nSigmaTpcCombinedMax, nSigmaTpcCombinedMax);
Expand Down Expand Up @@ -180,11 +182,11 @@ struct HfCandidateSelectorBsToDsPiReduced {

// track-level PID selection
auto trackPi = hfCandBs.template prong1_as<TracksPion>();
if (pionPidMethod) {
if (pionPidMethod == PidMethod::TpcOrTof || pionPidMethod == PidMethod::TpcAndTof) {
int pidTrackPi{TrackSelectorPID::Status::NotApplicable};
if (pionPidMethod == 1) {
if (pionPidMethod == PidMethod::TpcOrTof) {
pidTrackPi = selectorPion.statusTpcOrTof(trackPi);
} else {
} else if (pionPidMethod == PidMethod::TpcAndTof) {
pidTrackPi = selectorPion.statusTpcAndTof(trackPi);
}
if (!hfHelper.selectionBsToDsPiPid(pidTrackPi, acceptPIDNotApplicable.value)) {
Expand Down
20 changes: 8 additions & 12 deletions PWGHF/D2H/TableProducer/candidateSelectorLbToLcPiReduced.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,13 @@
#include "PWGHF/DataModel/CandidateReconstructionTables.h"
#include "PWGHF/DataModel/CandidateSelectionTables.h"
#include "PWGHF/D2H/DataModel/ReducedDataModel.h"
#include "PWGHF/Utils/utilsPid.h"

using namespace o2;
using namespace o2::aod;
using namespace o2::framework;
using namespace o2::analysis;

enum PidMethod {
NoPid = 0, // none
TpcOrTof, // TPC or TOF
TpcAndTof // TPC and TOF
};
using namespace o2::aod::pid_tpc_tof_utils;

struct HfCandidateSelectorLbToLcPiReduced {
Produces<aod::HfSelLbToLcPi> hfSelLbToLcPiCandidate; // table defined in CandidateSelectionTables.h
Expand All @@ -47,7 +43,7 @@ struct HfCandidateSelectorLbToLcPiReduced {
Configurable<float> ptCandMin{"ptCandMin", 0., "Lower bound of candidate pT"};
Configurable<float> ptCandMax{"ptCandMax", 50., "Upper bound of candidate pT"};
// Enable PID
Configurable<int> pidMethod{"pidMethod", 1, "PID selection method for the bachelor pion (PidMethod::NoPid: none, PidMethod::TpcOrTof: TPC or TOF, PidMethod::TpcAndTof: TPC and TOF)"};
Configurable<int> pionPidMethod{"pionPidMethod", PidMethod::TpcOrTof, "PID selection method for the bachelor pion (PidMethod::NoPid: none, PidMethod::TpcOrTof: TPC or TOF, PidMethod::TpcAndTof: TPC and TOF)"};
Configurable<bool> acceptPIDNotApplicable{"acceptPIDNotApplicable", true, "Switch to accept Status::NotApplicable [(NotApplicable for one detector) and (NotApplicable or Conditional for the other)] in PID selection"};
// TPC PID
Configurable<float> ptPidTpcMin{"ptPidTpcMin", 0.15, "Lower bound of track pT for TPC PID"};
Expand Down Expand Up @@ -100,11 +96,11 @@ struct HfCandidateSelectorLbToLcPiReduced {
LOGP(fatal, "Only one process function for data should be enabled at a time.");
}

if (pidMethod < PidMethod::NoPid || pidMethod > PidMethod::TpcAndTof) {
if (pionPidMethod < 0 || pionPidMethod >= PidMethod::NPidMethods) {
LOGP(fatal, "Invalid PID option in configurable, please set 0 (no PID), 1 (TPC or TOF), or 2 (TPC and TOF)");
}

if (pidMethod == PidMethod::TpcOrTof || pidMethod == PidMethod::TpcAndTof) {
if (pionPidMethod != PidMethod::NoPid) {
selectorPion.setRangePtTpc(ptPidTpcMin, ptPidTpcMax);
selectorPion.setRangeNSigmaTpc(-nSigmaTpcMax, nSigmaTpcMax);
selectorPion.setRangeNSigmaTpcCondTof(-nSigmaTpcCombinedMax, nSigmaTpcCombinedMax);
Expand Down Expand Up @@ -187,11 +183,11 @@ struct HfCandidateSelectorLbToLcPiReduced {

// track-level PID selection
auto trackPi = hfCandLb.template prong1Track_as<TracksPion>();
if (pidMethod == PidMethod::TpcOrTof || pidMethod == PidMethod::TpcAndTof) {
if (pionPidMethod == PidMethod::TpcOrTof || pionPidMethod == PidMethod::TpcAndTof) {
int pidTrackPi{TrackSelectorPID::Status::NotApplicable};
if (pidMethod == PidMethod::TpcOrTof) {
if (pionPidMethod == PidMethod::TpcOrTof) {
pidTrackPi = selectorPion.statusTpcOrTof(trackPi);
} else {
} else if (pionPidMethod == PidMethod::TpcAndTof) {
pidTrackPi = selectorPion.statusTpcAndTof(trackPi);
}
if (!hfHelper.selectionLbToLcPiPid(pidTrackPi, acceptPIDNotApplicable.value)) {
Expand Down
14 changes: 8 additions & 6 deletions PWGHF/TableProducer/candidateSelectorB0ToDPi.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,13 @@
#include "PWGHF/Core/SelectorCuts.h"
#include "PWGHF/DataModel/CandidateReconstructionTables.h"
#include "PWGHF/DataModel/CandidateSelectionTables.h"
#include "PWGHF/Utils/utilsPid.h"

using namespace o2;
using namespace o2::aod;
using namespace o2::framework;
using namespace o2::analysis;
using namespace o2::aod::pid_tpc_tof_utils;

struct HfCandidateSelectorB0ToDPi {
Produces<aod::HfSelB0ToDPi> hfSelB0ToDPiCandidate; // table defined in CandidateSelectionTables.h
Expand All @@ -42,7 +44,7 @@ struct HfCandidateSelectorB0ToDPi {
Configurable<double> ptCandMin{"ptCandMin", 0., "Lower bound of candidate pT"};
Configurable<double> ptCandMax{"ptCandMax", 50., "Upper bound of candidate pT"};
// Enable PID
Configurable<int> pionPidMethod{"pionPidMethod", 1, "PID selection method for the bachelor pion (0: none, 1: TPC or TOF, 2: TPC and TOF)"};
Configurable<int> pionPidMethod{"pionPidMethod", PidMethod::TpcOrTof, "PID selection method for the bachelor pion (PidMethod::NoPid: none, PidMethod::TpcOrTof: TPC or TOF, PidMethod::TpcAndTof: TPC and TOF)"};
Configurable<bool> acceptPIDNotApplicable{"acceptPIDNotApplicable", true, "Switch to accept Status::NotApplicable [(NotApplicable for one detector) and (NotApplicable or Conditional for the other)] in PID selection"};
// TPC PID
Configurable<double> ptPidTpcMin{"ptPidTpcMin", 0.15, "Lower bound of track pT for TPC PID"};
Expand Down Expand Up @@ -95,11 +97,11 @@ struct HfCandidateSelectorB0ToDPi {
LOGP(fatal, "Only one process function for data should be enabled at a time.");
}

if (pionPidMethod < 0 || pionPidMethod > 2) {
if (pionPidMethod < 0 || pionPidMethod >= PidMethod::NPidMethods) {
LOGP(fatal, "Invalid PID option in configurable, please set 0 (no PID), 1 (TPC or TOF), or 2 (TPC and TOF)");
}

if (pionPidMethod != 0) {
if (pionPidMethod != PidMethod::NoPid) {
selectorPion.setRangePtTpc(ptPidTpcMin, ptPidTpcMax);
selectorPion.setRangeNSigmaTpc(-nSigmaTpcMax, nSigmaTpcMax);
selectorPion.setRangeNSigmaTpcCondTof(-nSigmaTpcCombinedMax, nSigmaTpcCombinedMax);
Expand Down Expand Up @@ -188,11 +190,11 @@ struct HfCandidateSelectorB0ToDPi {
}

// track-level PID selection
if (pionPidMethod) {
if (pionPidMethod == PidMethod::TpcOrTof || pionPidMethod == PidMethod::TpcAndTof) {
int pidTrackPi{TrackSelectorPID::Status::NotApplicable};
if (pionPidMethod == 1) {
if (pionPidMethod == PidMethod::TpcOrTof) {
pidTrackPi = selectorPion.statusTpcOrTof(trackPi);
} else {
} else if (pionPidMethod == PidMethod::TpcAndTof) {
pidTrackPi = selectorPion.statusTpcAndTof(trackPi);
}
if (!hfHelper.selectionB0ToDPiPid(pidTrackPi, acceptPIDNotApplicable.value)) {
Expand Down
14 changes: 8 additions & 6 deletions PWGHF/TableProducer/candidateSelectorBplusToD0Pi.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,13 @@
#include "PWGHF/Core/SelectorCuts.h"
#include "PWGHF/DataModel/CandidateReconstructionTables.h"
#include "PWGHF/DataModel/CandidateSelectionTables.h"
#include "PWGHF/Utils/utilsPid.h"

using namespace o2;
using namespace o2::aod;
using namespace o2::framework;
using namespace o2::analysis;
using namespace o2::aod::pid_tpc_tof_utils;

struct HfCandidateSelectorBplusToD0Pi {
Produces<aod::HfSelBplusToD0Pi> hfSelBplusToD0PiCandidate; // table defined in CandidateSelectionTables.h
Expand All @@ -44,7 +46,7 @@ struct HfCandidateSelectorBplusToD0Pi {
Configurable<double> ptCandMin{"ptCandMin", 0., "Lower bound of candidate pT"};
Configurable<double> ptCandMax{"ptCandMax", 50., "Upper bound of candidate pT"};
// Enable PID
Configurable<int> pionPidMethod{"pionPidMethod", 1, "PID selection method for the bachelor pion (0: none, 1: TPC or TOF, 2: TPC and TOF)"};
Configurable<int> pionPidMethod{"pionPidMethod", PidMethod::TpcOrTof, "PID selection method for the bachelor pion (PidMethod::NoPid: none, PidMethod::TpcOrTof: TPC or TOF, PidMethod::TpcAndTof: TPC and TOF)"};
Configurable<bool> acceptPIDNotApplicable{"acceptPIDNotApplicable", true, "Switch to accept Status::NotApplicable [(NotApplicable for one detector) and (NotApplicable or Conditional for the other)] in PID selection"};
// TPC PID
Configurable<double> ptPidTpcMin{"ptPidTpcMin", 0.15, "Lower bound of track pT for TPC PID"};
Expand Down Expand Up @@ -97,11 +99,11 @@ struct HfCandidateSelectorBplusToD0Pi {
LOGP(fatal, "Only one process function for data should be enabled at a time.");
}

if (pionPidMethod < 0 || pionPidMethod > 2) {
if (pionPidMethod < 0 || pionPidMethod >= PidMethod::NPidMethods) {
LOGP(fatal, "Invalid PID option in configurable, please set 0 (no PID), 1 (TPC or TOF), or 2 (TPC and TOF)");
}

if (pionPidMethod != 0) {
if (pionPidMethod != PidMethod::NoPid) {
selectorPion.setRangePtTpc(ptPidTpcMin, ptPidTpcMax);
selectorPion.setRangeNSigmaTpc(-nSigmaTpcMax, nSigmaTpcMax);
selectorPion.setRangeNSigmaTpcCondTof(-nSigmaTpcCombinedMax, nSigmaTpcCombinedMax);
Expand Down Expand Up @@ -194,11 +196,11 @@ struct HfCandidateSelectorBplusToD0Pi {
}

// track-level PID selection
if (pionPidMethod) {
if (pionPidMethod == PidMethod::TpcOrTof || pionPidMethod == PidMethod::TpcAndTof) {
int pidTrackPi{TrackSelectorPID::Status::NotApplicable};
if (pionPidMethod == 1) {
if (pionPidMethod == PidMethod::TpcOrTof) {
pidTrackPi = selectorPion.statusTpcOrTof(trackPi);
} else {
} else if (pionPidMethod == PidMethod::TpcAndTof) {
pidTrackPi = selectorPion.statusTpcAndTof(trackPi);
}
if (!hfHelper.selectionBplusToD0PiPid(pidTrackPi, acceptPIDNotApplicable.value)) {
Expand Down
18 changes: 15 additions & 3 deletions PWGHF/Utils/utilsPid.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,21 @@

namespace o2::aod::pid_tpc_tof_utils
{
enum HfProngSpecies : uint8_t { Pion = 0,
Kaon,
Proton };
/// @brief Species of HF-candidate daughter tracks
enum HfProngSpecies : uint8_t {
Pion = 0,
Kaon,
Proton,
NHfProngSpecies
};

/// @brief PID methods used for HF-candidate daughter tracks
enum PidMethod {
NoPid = 0, // none
TpcOrTof, // TPC or TOF
TpcAndTof, // TPC and TOF
NPidMethods
};

/// Function to combine TPC and TOF NSigma
/// \param tiny switch between full and tiny (binned) PID tables
Expand Down
Loading