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
60 changes: 31 additions & 29 deletions PWGHF/Core/CentralityEstimation.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,80 +32,80 @@
};

template <typename T>
concept hasFT0ACent = requires(T collision) {

Check failure on line 35 in PWGHF/Core/CentralityEstimation.h

View workflow job for this annotation

GitHub Actions / O2 linter

[name/type]

Use UpperCamelCase for names of defined types (including concepts).
collision.centFT0A();
};

template <typename T>
concept hasFT0CCent = requires(T collision) {

Check failure on line 40 in PWGHF/Core/CentralityEstimation.h

View workflow job for this annotation

GitHub Actions / O2 linter

[name/type]

Use UpperCamelCase for names of defined types (including concepts).
collision.centFT0C();
};

template <typename T>
concept hasFT0MCent = requires(T collision) {

Check failure on line 45 in PWGHF/Core/CentralityEstimation.h

View workflow job for this annotation

GitHub Actions / O2 linter

[name/type]

Use UpperCamelCase for names of defined types (including concepts).
collision.centFT0M();
};

template <typename T>
concept hasFV0ACent = requires(T collision) {

Check failure on line 50 in PWGHF/Core/CentralityEstimation.h

View workflow job for this annotation

GitHub Actions / O2 linter

[name/type]

Use UpperCamelCase for names of defined types (including concepts).
collision.centFV0A();
};

template <typename T>
concept hasNTracksPVCent = requires(T collision) {

Check failure on line 55 in PWGHF/Core/CentralityEstimation.h

View workflow job for this annotation

GitHub Actions / O2 linter

[name/type]

Use UpperCamelCase for names of defined types (including concepts).
collision.centNTPV();
};

/// Evaluate centrality/multiplicity percentile using FT0A estimator
/// \param candidate is candidate
/// \return centrality/multiplicity percentile of the collision
template <hasFT0ACent Coll>
float getCentralityColl(const Coll& collision)
template <hasFT0ACent TCollision>
float getCentralityColl(const TCollision& collision)
{
return collision.centFT0A();
}

/// Evaluate centrality/multiplicity percentile using FT0C estimator
/// \param candidate is candidate
/// \return centrality/multiplicity percentile of the collision
template <hasFT0CCent Coll>
float getCentralityColl(const Coll& collision)
template <hasFT0CCent TCollision>
float getCentralityColl(const TCollision& collision)
{
return collision.centFT0C();
}

/// Evaluate centrality/multiplicity percentile using FT0M estimator
/// \param candidate is candidate
/// \return centrality/multiplicity percentile of the collision
template <hasFT0MCent Coll>
float getCentralityColl(const Coll& collision)
template <hasFT0MCent TCollision>
float getCentralityColl(const TCollision& collision)
{
return collision.centFT0M();
}

/// Evaluate centrality/multiplicity percentile using FV0A estimator
/// \param candidate is candidate
/// \return centrality/multiplicity percentile of the collision
template <hasFV0ACent Coll>
float getCentralityColl(const Coll& collision)
template <hasFV0ACent TCollision>
float getCentralityColl(const TCollision& collision)
{
return collision.centFV0A();
}

/// Evaluate centrality/multiplicity percentile using NTracksPV estimator
/// \param candidate is candidate
/// \return centrality/multiplicity percentile of the collision
template <hasNTracksPVCent Coll>
float getCentralityColl(const Coll& collision)
template <hasNTracksPVCent TCollision>
float getCentralityColl(const TCollision& collision)
{
return collision.centNTPV();
}

/// Default case if no centrality/multiplicity estimator is provided
/// \param candidate is candidate
/// \return dummy value for centrality/multiplicity percentile of the collision
template <typename Coll>
float getCentralityColl(const Coll&)
template <typename TCollision>
float getCentralityColl(const TCollision&)
{
return 105.0f;
}
Expand All @@ -114,36 +114,36 @@
/// \param collision is the collision with the centrality information
/// \param centEstimator integer to select the centrality estimator
/// \return collision centrality
template <typename Coll>
float getCentralityColl(const Coll& collision, int centEstimator)
template <typename TCollision>
float getCentralityColl(const TCollision& collision, const int centEstimator)
{
switch (centEstimator) {
case CentralityEstimator::FT0A:
if constexpr (hasFT0ACent<Coll>) {
if constexpr (hasFT0ACent<TCollision>) {
return collision.centFT0A();
}
LOG(fatal) << "Collision does not have centFT0A().";
break;
case CentralityEstimator::FT0C:
if constexpr (hasFT0CCent<Coll>) {
if constexpr (hasFT0CCent<TCollision>) {
return collision.centFT0C();
}
LOG(fatal) << "Collision does not have centFT0C().";
break;
case CentralityEstimator::FT0M:
if constexpr (hasFT0MCent<Coll>) {
if constexpr (hasFT0MCent<TCollision>) {
return collision.centFT0M();
}
LOG(fatal) << "Collision does not have centFT0M().";
break;
case CentralityEstimator::FV0A:
if constexpr (hasFV0ACent<Coll>) {
if constexpr (hasFV0ACent<TCollision>) {
return collision.centFV0A();
}
LOG(fatal) << "Collision does not have centFV0A().";
break;
default:
LOG(fatal) << "Centrality estimator not valid. Possible values are V0A, T0M, T0A, T0C.";
LOG(fatal) << "Centrality estimator not valid. See CentralityEstimator for valid values.";
break;
}
return -999.f;
Expand All @@ -152,13 +152,14 @@
/// \brief Function to get MC collision centrality
/// \param collSlice collection of reconstructed collisions associated to a generated one
/// \return generated MC collision centrality
template <typename CCs>
float getCentralityGenColl(CCs const& collSlice)
template <typename TCollisions>
float getCentralityGenColl(TCollisions const& collSlice)
{
float centrality{-1};
float multiplicity{0.f};
using TMult = uint16_t; // type of numContrib
float centrality{-1.f};
TMult multiplicity{};
for (const auto& collision : collSlice) {
float collMult = collision.numContrib();
const TMult collMult = collision.numContrib();
if (collMult > multiplicity) {
centrality = getCentralityColl(collision);
multiplicity = collMult;
Expand All @@ -171,13 +172,14 @@
/// \param collSlice collection of reconstructed collisions associated to a generated one
/// \param centEstimator integer to select the centrality estimator
/// \return generated MC collision centrality
template <typename CCs>
float getCentralityGenColl(CCs const& collSlice, int centEstimator)
template <typename TCollisions>
float getCentralityGenColl(TCollisions const& collSlice, const int centEstimator)
{
float centrality{-1};
float multiplicity{0.f};
using TMult = uint16_t; // type of numContrib
float centrality{-1.f};
TMult multiplicity{};
for (const auto& collision : collSlice) {
float collMult = collision.numContrib();
const TMult collMult = collision.numContrib();
if (collMult > multiplicity) {
centrality = getCentralityColl(collision, centEstimator);
multiplicity = collMult;
Expand Down
22 changes: 12 additions & 10 deletions PWGHF/Core/DecayChannels.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,12 @@ namespace o2::hf_decay
// - HF cascades to LF cascades (Ωc0/Ξc0 → Ξ+ π−, Ξc+ → Ξ+ π− π+)
// - Σc

using HfDecayChannel = int8_t;

namespace hf_cand_2prong
{
/// @brief 2-prong candidates: main channels
enum DecayChannelMain : int8_t {
enum DecayChannelMain : HfDecayChannel {
// D0
D0ToPiK = 1, // π+ K−
D0ToPiKPi0 = 2, // π+ K− π0
Expand All @@ -47,7 +49,7 @@ enum DecayChannelMain : int8_t {
NChannelsMain = JpsiToMuMu // last channel
};
/// @brief 2-prong candidates: resonant channels
enum DecayChannelResonant : int8_t {
enum DecayChannelResonant : HfDecayChannel {
// D0
D0ToRhoplusPi = 1, // ρ+ π−
D0ToRhoplusK = 2, // ρ+ K−
Expand All @@ -61,7 +63,7 @@ enum DecayChannelResonant : int8_t {
namespace hf_cand_3prong
{
/// @brief 3-prong candidates: main channels
enum DecayChannelMain : int8_t {
enum DecayChannelMain : HfDecayChannel {
// D+
DplusToPiKPi = 1, // π+ K− π+
DplusToPiKPiPi0 = 2, // π+ K− π+ π0
Expand Down Expand Up @@ -94,7 +96,7 @@ enum DecayChannelMain : int8_t {
NChannelsMain = XicToSPiPi // last channel
};
/// @brief 3-prong candidates: resonant channels
enum DecayChannelResonant : int8_t {
enum DecayChannelResonant : HfDecayChannel {
// D+
DplusToPhiPi = 1, // φ π+
DplusToKstar0K = 2, // anti-K*0 K+
Expand Down Expand Up @@ -136,7 +138,7 @@ enum DecayChannelResonant : int8_t {
namespace hf_cand_dstar
{
/// @brief D*+ candidates: main channels
enum DecayChannelMain : int8_t {
enum DecayChannelMain : HfDecayChannel {
// D*+
DstarToPiKPi = 1, // π+ K− π+ (from [(D0 → π+ K−) π+])
DstarToPiKPiPi0 = 2, // π+ K− π+ π0 (from [(D0 → π+ K− π0) π+] or [(D+ → π+ K− π+) π0])
Expand All @@ -148,7 +150,7 @@ enum DecayChannelMain : int8_t {
namespace hf_cand_beauty
{
/// @brief beauty candidates: main channels
enum DecayChannelMain : int8_t {
enum DecayChannelMain : HfDecayChannel {
// B0
B0ToDminusPi = 1, // D− π+
B0ToDminusPiPi0 = 2, // D− π+ π0
Expand Down Expand Up @@ -176,7 +178,7 @@ enum DecayChannelMain : int8_t {
NChannelsMain = B0ToDsPi // last channel
};
/// @brief beauty candidates: resonant channels
enum DecayChannelResonant : int8_t {
enum DecayChannelResonant : HfDecayChannel {
// B0
B0ToDminusRhoplus = 1, // D− ρ+
B0ToDstarminusPi = 2, // D*− π+
Expand All @@ -195,7 +197,7 @@ enum DecayChannelResonant : int8_t {
NChannelsResonant = BplusToDstar0Pi // last channel
};
/// @brief beauty candidates: beauty to J/ψ decay channels
enum DecayChannelToJpsiMain : int8_t {
enum DecayChannelToJpsiMain : HfDecayChannel {
// B0
B0ToJpsiPiK = 1, // J/ψ π− K+
// Bs0
Expand All @@ -210,7 +212,7 @@ enum DecayChannelToJpsiMain : int8_t {
NChannelsToJpsiMain = BcToJpsiPi // last channel
};
/// @brief beauty candidates: beauty to J/ψ resonant decay channels
enum DecayChannelToJpsiResonant : int8_t {
enum DecayChannelToJpsiResonant : HfDecayChannel {
// B0
B0ToJpsiKstar0 = 1, // J/ψ K*0(892)
// Bs0
Expand All @@ -223,7 +225,7 @@ enum DecayChannelToJpsiResonant : int8_t {
namespace hf_cand_reso
{
/// @brief resonance candidates: main channels
enum DecayChannelMain : int8_t {
enum DecayChannelMain : HfDecayChannel {
// D1(2420)0
D1zeroToDstarPi = 1, // D*+ π-
// D2*(2460)0
Expand Down
26 changes: 13 additions & 13 deletions PWGHF/D2H/DataModel/ReducedDataModel.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ namespace aod
{
namespace hf_reduced_collision
{
DECLARE_SOA_COLUMN(Bz, bz, float); //! Magnetic field in z-direction
DECLARE_SOA_COLUMN(HfCollisionRejectionMap, hfCollisionRejectionMap, uint32_t); //! Bitmask with failed selection criteria
DECLARE_SOA_COLUMN(Bz, bz, float); //! Magnetic field in z-direction
DECLARE_SOA_COLUMN(HfCollisionRejectionMap, hfCollisionRejectionMap, o2::hf_evsel::HfCollisionRejectionMask); //! Bitmask with failed selection criteria
// keep track of the number of studied events (for normalization purposes)
DECLARE_SOA_COLUMN(OriginalCollisionCount, originalCollisionCount, int); //! Size of COLLISION table processed
DECLARE_SOA_COLUMN(ZvtxSelectedCollisionCount, zvtxSelectedCollisionCount, int); //! Number of COLLISIONS with |zvtx| < zvtxMax
Expand Down Expand Up @@ -1186,7 +1186,7 @@ DECLARE_SOA_COLUMN(Sign, sign, int8_t); //!
DECLARE_SOA_COLUMN(ItsNClsSoftPi, itsNClsSoftPi, int); //! minimum value of number of ITS clusters for the decay daughter tracks
DECLARE_SOA_COLUMN(TpcNClsCrossedRowsSoftPi, tpcNClsCrossedRowsSoftPi, int); //! minimum value of number of TPC crossed rows for the decay daughter tracks
DECLARE_SOA_COLUMN(TpcChi2NClSoftPi, tpcChi2NClSoftPi, float); //! maximum value of TPC chi2 for the decay daughter tracks
DECLARE_SOA_DYNAMIC_COLUMN(Px, px, //!
DECLARE_SOA_DYNAMIC_COLUMN(Px, px, //!
[](float pxProng0, float pxProng1, float pxProng2) -> float { return 1.f * pxProng0 + 1.f * pxProng1 + 1.f * pxProng2; });
DECLARE_SOA_DYNAMIC_COLUMN(Py, py, //!
[](float pyProng0, float pyProng1, float pyProng2) -> float { return 1.f * pyProng0 + 1.f * pyProng1 + 1.f * pyProng2; });
Expand Down Expand Up @@ -1398,16 +1398,16 @@ DECLARE_SOA_COLUMN(InvMassProng1, invMassProng1, float); //! Invariant Mass of V
DECLARE_SOA_COLUMN(Sign, sign, int8_t); //! Sign of the Resonance candidate
DECLARE_SOA_COLUMN(IsWrongSign, isWrongSign, int8_t); //! Flag for wrong sign of the Resonance candidate, 1 = wrong sign, 0 = right sign

DECLARE_SOA_COLUMN(FlagMcMatchRec, flagMcMatchRec, int8_t); // flag for resonance decay channel classification reconstruction level
DECLARE_SOA_COLUMN(FlagMcMatchRecD, flagMcMatchRecD, int8_t); // flag for D meson bachelor decay channel classification reconstruction level
DECLARE_SOA_COLUMN(FlagMcMatchChanD, flagMcMatchChanD, int8_t); // flag for D meson resonant channel classification reconstruction level
DECLARE_SOA_COLUMN(FlagMcMatchGen, flagMcMatchGen, int8_t); // flag for decay channel classification generator level
DECLARE_SOA_COLUMN(DebugMcRec, debugMcRec, uint16_t); // debug flag for mis-association at reconstruction level
DECLARE_SOA_COLUMN(Origin, origin, int8_t); // Flag for origin of MC particle 1=promt, 2=FD
DECLARE_SOA_COLUMN(SignD0, signD0, int8_t); // Sign of the D0 in the channels with D* -> D0 pi, needed in case of non-matched D*
DECLARE_SOA_COLUMN(PtGen, ptGen, float); // Pt at generation level in GeV/c
DECLARE_SOA_COLUMN(InvMassGen, invMassGen, float); //! Invariant mass at generation level in GeV/c2
DECLARE_SOA_DYNAMIC_COLUMN(Pt, pt, //!
DECLARE_SOA_COLUMN(FlagMcMatchRec, flagMcMatchRec, int8_t); // flag for resonance decay channel classification reconstruction level
DECLARE_SOA_COLUMN(FlagMcMatchRecD, flagMcMatchRecD, int8_t); // flag for D meson bachelor decay channel classification reconstruction level
DECLARE_SOA_COLUMN(FlagMcMatchChanD, flagMcMatchChanD, int8_t); // flag for D meson resonant channel classification reconstruction level
DECLARE_SOA_COLUMN(FlagMcMatchGen, flagMcMatchGen, int8_t); // flag for decay channel classification generator level
DECLARE_SOA_COLUMN(DebugMcRec, debugMcRec, uint16_t); // debug flag for mis-association at reconstruction level
DECLARE_SOA_COLUMN(Origin, origin, int8_t); // Flag for origin of MC particle 1=promt, 2=FD
DECLARE_SOA_COLUMN(SignD0, signD0, int8_t); // Sign of the D0 in the channels with D* -> D0 pi, needed in case of non-matched D*
DECLARE_SOA_COLUMN(PtGen, ptGen, float); // Pt at generation level in GeV/c
DECLARE_SOA_COLUMN(InvMassGen, invMassGen, float); //! Invariant mass at generation level in GeV/c2
DECLARE_SOA_DYNAMIC_COLUMN(Pt, pt, //!
[](float pxProng0, float pxProng1, float pyProng0, float pyProng1) -> float { return RecoDecay::pt((1.f * pxProng0 + 1.f * pxProng1), (1.f * pyProng0 + 1.f * pyProng1)); });
DECLARE_SOA_DYNAMIC_COLUMN(PtProng0, ptProng0, //!
[](float pxProng0, float pyProng0) -> float { return RecoDecay::pt(pxProng0, pyProng0); });
Expand Down
9 changes: 5 additions & 4 deletions PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1021,7 +1021,7 @@ struct HfDataCreatorCharmHadPiReduced {
{
registry.fill(HIST("hEvents"), 1 + Event::Processed);
float centrality = -1.f;
auto hfRejMap = hfEvSel.getHfCollisionRejectionMask<true, o2::hf_centrality::CentralityEstimator::None, aod::BCsWithTimestamps>(collision, centrality, ccdb, registry);
const auto hfRejMap = hfEvSel.getHfCollisionRejectionMask<true, o2::hf_centrality::CentralityEstimator::None, aod::BCsWithTimestamps>(collision, centrality, ccdb, registry);
if (configs.skipRejectedCollisions && hfRejMap != 0) {
return;
}
Expand Down Expand Up @@ -1487,15 +1487,16 @@ struct HfDataCreatorCharmHadPiReduced {
// Check event selection
float centDummy{-1.f}, centFT0C{-1.f}, centFT0M{-1.f};
const auto collSlice = collisions.sliceBy(preslices.colPerMcCollision, mcCollision.globalIndex());
auto hfRejMap = hfEvSelMc.getHfMcCollisionRejectionMask<BCsInfo, o2::hf_centrality::CentralityEstimator::None>(mcCollision, collSlice, centDummy);
const auto hfRejMap = hfEvSelMc.getHfMcCollisionRejectionMask<BCsInfo, o2::hf_centrality::CentralityEstimator::None>(mcCollision, collSlice, centDummy);
if (configs.skipRejectedCollisions && hfRejMap != 0) {
return;
}

// get centrality
float multiplicity{0.f};
using TMult = uint16_t; // type of numContrib
TMult multiplicity{};
for (const auto& collision : collSlice) {
float collMult = collision.numContrib();
const TMult collMult = collision.numContrib();
if (collMult > multiplicity) {
centFT0C = collision.centFT0C();
centFT0M = collision.centFT0M();
Expand Down
8 changes: 4 additions & 4 deletions PWGHF/D2H/TableProducer/dataCreatorCharmResoReduced.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -830,8 +830,8 @@ struct HfDataCreatorCharmResoReduced {
CCand const& candCharmBach,
BBachTr const& bachelorTrack,
Tr const& tracks,
int& indexHfCandCharm,
int64_t& indexCandTrBach)
const int64_t indexHfCandCharm,
const int64_t indexCandTrBach)
{
std::vector<typename Tr::iterator> vecDaughtersReso{};
int8_t sign{0}, nKinkedTracks{0}, origin{0}, flagCharmBach{0}, flagCharmBachInterm{0}, flagTrack{0}, flagReso{0};
Expand Down Expand Up @@ -992,7 +992,7 @@ struct HfDataCreatorCharmResoReduced {
{
// helpers for ReducedTables filling
float centrality = -1.f;
uint16_t hfRejMap = hfEvSel.getHfCollisionRejectionMask<true, o2::hf_centrality::CentralityEstimator::None, BCs>(collision, centrality, ccdb, registry);
const auto hfRejMap = hfEvSel.getHfCollisionRejectionMask<true, o2::hf_centrality::CentralityEstimator::None, BCs>(collision, centrality, ccdb, registry);
if (rejectCollisionsWithBadEvSel && hfRejMap != 0) {
return;
}
Expand Down Expand Up @@ -1546,7 +1546,7 @@ struct HfDataCreatorCharmResoReduced {
const auto mcParticlesPerMcColl = mcParticles.sliceBy(mcParticlesPerMcCollision, mcCollision.globalIndex());
// Slice the collisions table to get the collision info for the current MC collision
float centrality{-1.f};
uint16_t rejectionMask{0};
o2::hf_evsel::HfCollisionRejectionMask rejectionMask{};
int nSplitColl = 0;
const auto collSlice = collInfos.sliceBy(colPerMcCollision, mcCollision.globalIndex());
rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask<BCsInfo, o2::hf_centrality::CentralityEstimator::None>(mcCollision, collSlice, centrality);
Expand Down
Loading
Loading