From 934d98bfa5693236309c013f2042325a5f98286f Mon Sep 17 00:00:00 2001 From: Anton Riedel Date: Wed, 21 Oct 2026 18:40:46 +0200 Subject: [PATCH 1/2] Feat: Simplify daughter selections for resonances --- PWGCF/Femto/Core/partitions.h | 18 +++++++ PWGCF/Femto/Core/trackBuilder.h | 48 ++++++++++++++----- .../TableProducer/femtoProducerResonances.cxx | 8 ++-- ...oProducerTrackTrackTwoPhotonResonances.cxx | 12 ++--- 4 files changed, 65 insertions(+), 21 deletions(-) diff --git a/PWGCF/Femto/Core/partitions.h b/PWGCF/Femto/Core/partitions.h index 4f03bbe7c04..cb3cfe24b53 100644 --- a/PWGCF/Femto/Core/partitions.h +++ b/PWGCF/Femto/Core/partitions.h @@ -56,6 +56,24 @@ (o2::aod::femtobase::stored::mass > (selection).massMin) && \ (o2::aod::femtobase::stored::mass < (selection).massMax) +// partition for resonance daughters (pion+/-, kaon+/- legs): unlike MAKE_TRACK_PARTITION, chargeSign +// and chargeAbs are compile-time constants on the selection struct (ConfResonanceDaughterSelection in +// trackBuilder.h), not runtime Configurables, so the sign comparison is just a comparison to a constant +// NOLINTNEXTLINE(cppcoreguidelines-macro-usage) +#define MAKE_RESONANCE_DAUGHTER_PARTITION(selection) \ + ((selection).chargeSign > 0 ? o2::aod::femtobase::stored::signedPt > 0.f : o2::aod::femtobase::stored::signedPt < 0.f) && \ + (nabs((selection).chargeAbs * o2::aod::femtobase::stored::signedPt) > (selection).ptMin) && \ + (nabs((selection).chargeAbs * o2::aod::femtobase::stored::signedPt) < (selection).ptMax) && \ + (o2::aod::femtobase::stored::eta > (selection).etaMin) && \ + (o2::aod::femtobase::stored::eta < (selection).etaMax) && \ + (o2::aod::femtobase::stored::phi > (selection).phiMin) && \ + (o2::aod::femtobase::stored::phi < (selection).phiMax) && \ + ifnode(TRACK_MOMENTUM((selection).chargeAbs, o2::aod::femtobase::stored::signedPt, o2::aod::femtobase::stored::eta) <= (selection).pidThres, \ + ncheckbit(o2::aod::femtotracks::mask, (selection).maskLowMomentum) && \ + (o2::aod::femtotracks::mask & (selection).rejectionMaskLowMomentum) == static_cast(0), \ + ncheckbit(o2::aod::femtotracks::mask, (selection).maskHighMomentum) && \ + (o2::aod::femtotracks::mask & (selection).rejectionMaskHighMomentum) == static_cast(0)) + // partition for phis and rhos, i.e. resonance that are their own antiparticle -- both daughters are // the same species, so the selection carries a single dauMask pair applied to both stored columns // NOLINTNEXTLINE(cppcoreguidelines-macro-usage) diff --git a/PWGCF/Femto/Core/trackBuilder.h b/PWGCF/Femto/Core/trackBuilder.h index 6ea1d97ebe5..118aaa7cb6d 100644 --- a/PWGCF/Femto/Core/trackBuilder.h +++ b/PWGCF/Femto/Core/trackBuilder.h @@ -160,12 +160,6 @@ constexpr const char PrefixTrackSelection1[] = "TrackSelection1"; constexpr const char PrefixTrackSelection2[] = "TrackSelection2"; constexpr const char PrefixTrackSelection3[] = "TrackSelection3"; -// for resonances builder -constexpr const char PrefixPionPlus[] = "PionPlusSelection"; -constexpr const char PrefixPionMinus[] = "PionMinusSelection"; -constexpr const char PrefixKaonPlus[] = "KaonPlusSelection"; -constexpr const char PrefixKaonMinus[] = "KaonMinusSelection"; - // for dN/deta: tracks with TPC (ITS + TPC quality bits) and tracks without TPC (ITS quality bits only) // set maskLowMomentum = maskHighMomentum (quality bits only), chargeSign = 0 and the eta/pT range of the measurement constexpr const char PrefixTrackSelectionDndetaGlobal[] = "TrackSelectionDndetaGlobal"; // Global = ITS + TPC @@ -176,14 +170,46 @@ using ConfTrackSelection1 = ConfTrackSelection; using ConfTrackSelection2 = ConfTrackSelection; using ConfTrackSelection3 = ConfTrackSelection; -using ConfPionPlusSelection = ConfTrackSelection; -using ConfPionMinusSelection = ConfTrackSelection; -using ConfKaonPlusSelection = ConfTrackSelection; -using ConfKaonMinusSelection = ConfTrackSelection; - using ConfTrackSelectionDndetaGlobal = ConfTrackSelection; using ConfTrackSelectionDndetaItsOnly = ConfTrackSelection; +// Track selection for resonance daughters (pion+/-, kaon+/-). Charge sign and abs charge are fixed +// by the species itself, so they are compile-time constants rather than configurables. No pdg code +// here at all: the daughter mass used to reconstruct the resonance is set directly in the resonance +// builder (e.g. MassPiPlus/MassKMinus), never read from this selection. Used exclusively by the +// resonance builders via MAKE_RESONANCE_DAUGHTER_PARTITION. +template +struct ConfResonanceDaughterSelection : public o2::framework::ConfigurableGroup { + std::string prefix = Prefix; + static constexpr int chargeAbs = 1; + static constexpr int chargeSign = ChargeSign; + // filters for kinematics + o2::framework::Configurable ptMin{"ptMin", 0.0f, "Minimum pT (GeV/c)"}; + o2::framework::Configurable ptMax{"ptMax", 6.f, "Maximum pT (GeV/c)"}; + o2::framework::Configurable etaMin{"etaMin", -0.9f, "Minimum eta"}; + o2::framework::Configurable etaMax{"etaMax", 0.9f, "Maximum eta"}; + o2::framework::Configurable phiMin{"phiMin", 0.f, "Minimum phi"}; + o2::framework::Configurable phiMax{"phiMax", 1.f * o2::constants::math::TwoPI, "Maximum phi"}; + // track selection masks + o2::framework::Configurable maskLowMomentum{"maskLowMomentum", 1ul, "Bitmask for selections below momentum threshold"}; + o2::framework::Configurable maskHighMomentum{"maskHighMomentum", 2ul, "Bitmask for selections above momentum threshold"}; + // track rejection masks + o2::framework::Configurable rejectionMaskLowMomentum{"rejectionMaskLowMomentum", 0ul, "Bitmask for rejections below momentum threshold"}; + o2::framework::Configurable rejectionMaskHighMomentum{"rejectionMaskHighMomentum", 0ul, "Bitmask for rejections above momentum threshold"}; + // momentum threshold for PID usage + o2::framework::Configurable pidThres{"pidThres", PidThresDefault, "Momentum threshold for using TPCTOF/TOF pid for tracks with large momentum (GeV/c)"}; +}; + +constexpr const char PrefixPionPlus[] = "PionPlusSelection"; +constexpr const char PrefixPionMinus[] = "PionMinusSelection"; +constexpr const char PrefixKaonPlus[] = "KaonPlusSelection"; +constexpr const char PrefixKaonMinus[] = "KaonMinusSelection"; + +using ConfPionPlusSelection = ConfResonanceDaughterSelection; +using ConfPionMinusSelection = ConfResonanceDaughterSelection; +using ConfKaonPlusSelection = ConfResonanceDaughterSelection; +using ConfKaonMinusSelection = ConfResonanceDaughterSelection; + /// enum for all track selections enum TrackSels { // track quality cuts diff --git a/PWGCF/Femto/TableProducer/femtoProducerResonances.cxx b/PWGCF/Femto/TableProducer/femtoProducerResonances.cxx index 38b787c2c0e..179023fc657 100644 --- a/PWGCF/Femto/TableProducer/femtoProducerResonances.cxx +++ b/PWGCF/Femto/TableProducer/femtoProducerResonances.cxx @@ -47,16 +47,16 @@ struct FemtoProducerResonances { // setup for resonance daughter tracks trackbuilder::ConfPionPlusSelection confPionPlusSelection; - o2::framework::Partition pionPlusPartition = MAKE_TRACK_PARTITION(confPionPlusSelection); + o2::framework::Partition pionPlusPartition = MAKE_RESONANCE_DAUGHTER_PARTITION(confPionPlusSelection); trackbuilder::ConfPionMinusSelection confPionMinusSelection; - o2::framework::Partition pionMinusPartition = MAKE_TRACK_PARTITION(confPionMinusSelection); + o2::framework::Partition pionMinusPartition = MAKE_RESONANCE_DAUGHTER_PARTITION(confPionMinusSelection); trackbuilder::ConfKaonPlusSelection confKaonPlusSelection; - o2::framework::Partition kaonPlusPartition = MAKE_TRACK_PARTITION(confKaonPlusSelection); + o2::framework::Partition kaonPlusPartition = MAKE_RESONANCE_DAUGHTER_PARTITION(confKaonPlusSelection); trackbuilder::ConfKaonMinusSelection confKaonMinusSelection; - o2::framework::Partition kaonMinusPartition = MAKE_TRACK_PARTITION(confKaonMinusSelection); + o2::framework::Partition kaonMinusPartition = MAKE_RESONANCE_DAUGHTER_PARTITION(confKaonMinusSelection); o2::framework::Preslice perColtracks = o2::aod::femtobase::stored::fColId; diff --git a/PWGCF/Femto/TableProducer/femtoProducerTrackTrackTwoPhotonResonances.cxx b/PWGCF/Femto/TableProducer/femtoProducerTrackTrackTwoPhotonResonances.cxx index 3aed1730218..20308a135a4 100644 --- a/PWGCF/Femto/TableProducer/femtoProducerTrackTrackTwoPhotonResonances.cxx +++ b/PWGCF/Femto/TableProducer/femtoProducerTrackTrackTwoPhotonResonances.cxx @@ -52,14 +52,14 @@ struct FemtoProducerTrackTrackTwoPhotonResonances { o2::framework::expressions::Filter collisionFilter = MAKE_COLLISION_FILTER(collisionSelection); colhistmanager::ConfCollisionBinning confCollisionBinning; - // setup for the two charged (pion) daughters -- plain track selections, same mechanism used for - // any other track daughter; sign is configured through these, not hardcoded in the builder - trackbuilder::ConfTrackSelection1 posDauSelection; - o2::framework::Partition posDauPartition = MAKE_TRACK_PARTITION(posDauSelection); + // setup for the two charged (pion) daughters. Dedicated pion-species selections, same ones + // femtoProducerResonances.cxx uses for other two track resonances + trackbuilder::ConfPionPlusSelection posDauSelection; + o2::framework::Partition posDauPartition = MAKE_RESONANCE_DAUGHTER_PARTITION(posDauSelection); o2::framework::Preslice perColPosDau = o2::aod::femtobase::stored::fColId; - trackbuilder::ConfTrackSelection2 negDauSelection; - o2::framework::Partition negDauPartition = MAKE_TRACK_PARTITION(negDauSelection); + trackbuilder::ConfPionMinusSelection negDauSelection; + o2::framework::Partition negDauPartition = MAKE_RESONANCE_DAUGHTER_PARTITION(negDauSelection); o2::framework::Preslice perColNegDau = o2::aod::femtobase::stored::fColId; // setup for the neutral (pi0) daughter From 29c0db1cfd10360e2993f918fe6f9c9430bed1e6 Mon Sep 17 00:00:00 2001 From: Anton Riedel Date: Wed, 21 Oct 2026 18:57:23 +0200 Subject: [PATCH 2/2] Fix: fix linter warnings --- PWGCF/Femto/Core/trackBuilder.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PWGCF/Femto/Core/trackBuilder.h b/PWGCF/Femto/Core/trackBuilder.h index 118aaa7cb6d..eaf95a5c033 100644 --- a/PWGCF/Femto/Core/trackBuilder.h +++ b/PWGCF/Femto/Core/trackBuilder.h @@ -181,8 +181,8 @@ using ConfTrackSelectionDndetaItsOnly = ConfTrackSelection struct ConfResonanceDaughterSelection : public o2::framework::ConfigurableGroup { std::string prefix = Prefix; - static constexpr int chargeAbs = 1; - static constexpr int chargeSign = ChargeSign; + static const int chargeAbs = 1; + static const int chargeSign = ChargeSign; // filters for kinematics o2::framework::Configurable ptMin{"ptMin", 0.0f, "Minimum pT (GeV/c)"}; o2::framework::Configurable ptMax{"ptMax", 6.f, "Maximum pT (GeV/c)"};