Skip to content

Commit d83fd36

Browse files
authored
[PWGCF] Simplify daughter selections in femto framework (#18395)
1 parent cfd760e commit d83fd36

4 files changed

Lines changed: 65 additions & 21 deletions

File tree

‎PWGCF/Femto/Core/partitions.h‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,24 @@
5656
(o2::aod::femtobase::stored::mass > (selection).massMin) && \
5757
(o2::aod::femtobase::stored::mass < (selection).massMax)
5858

59+
// partition for resonance daughters (pion+/-, kaon+/- legs): unlike MAKE_TRACK_PARTITION, chargeSign
60+
// and chargeAbs are compile-time constants on the selection struct (ConfResonanceDaughterSelection in
61+
// trackBuilder.h), not runtime Configurables, so the sign comparison is just a comparison to a constant
62+
// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
63+
#define MAKE_RESONANCE_DAUGHTER_PARTITION(selection) \
64+
((selection).chargeSign > 0 ? o2::aod::femtobase::stored::signedPt > 0.f : o2::aod::femtobase::stored::signedPt < 0.f) && \
65+
(nabs((selection).chargeAbs * o2::aod::femtobase::stored::signedPt) > (selection).ptMin) && \
66+
(nabs((selection).chargeAbs * o2::aod::femtobase::stored::signedPt) < (selection).ptMax) && \
67+
(o2::aod::femtobase::stored::eta > (selection).etaMin) && \
68+
(o2::aod::femtobase::stored::eta < (selection).etaMax) && \
69+
(o2::aod::femtobase::stored::phi > (selection).phiMin) && \
70+
(o2::aod::femtobase::stored::phi < (selection).phiMax) && \
71+
ifnode(TRACK_MOMENTUM((selection).chargeAbs, o2::aod::femtobase::stored::signedPt, o2::aod::femtobase::stored::eta) <= (selection).pidThres, \
72+
ncheckbit(o2::aod::femtotracks::mask, (selection).maskLowMomentum) && \
73+
(o2::aod::femtotracks::mask & (selection).rejectionMaskLowMomentum) == static_cast<o2::analysis::femto::datatypes::TrackMaskType>(0), \
74+
ncheckbit(o2::aod::femtotracks::mask, (selection).maskHighMomentum) && \
75+
(o2::aod::femtotracks::mask & (selection).rejectionMaskHighMomentum) == static_cast<o2::analysis::femto::datatypes::TrackMaskType>(0))
76+
5977
// partition for phis and rhos, i.e. resonance that are their own antiparticle -- both daughters are
6078
// the same species, so the selection carries a single dauMask pair applied to both stored columns
6179
// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)

‎PWGCF/Femto/Core/trackBuilder.h‎

Lines changed: 37 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -160,12 +160,6 @@ constexpr const char PrefixTrackSelection1[] = "TrackSelection1";
160160
constexpr const char PrefixTrackSelection2[] = "TrackSelection2";
161161
constexpr const char PrefixTrackSelection3[] = "TrackSelection3";
162162

163-
// for resonances builder
164-
constexpr const char PrefixPionPlus[] = "PionPlusSelection";
165-
constexpr const char PrefixPionMinus[] = "PionMinusSelection";
166-
constexpr const char PrefixKaonPlus[] = "KaonPlusSelection";
167-
constexpr const char PrefixKaonMinus[] = "KaonMinusSelection";
168-
169163
// for dN/deta: tracks with TPC (ITS + TPC quality bits) and tracks without TPC (ITS quality bits only)
170164
// set maskLowMomentum = maskHighMomentum (quality bits only), chargeSign = 0 and the eta/pT range of the measurement
171165
constexpr const char PrefixTrackSelectionDndetaGlobal[] = "TrackSelectionDndetaGlobal"; // Global = ITS + TPC
@@ -176,14 +170,46 @@ using ConfTrackSelection1 = ConfTrackSelection<PrefixTrackSelection1>;
176170
using ConfTrackSelection2 = ConfTrackSelection<PrefixTrackSelection2>;
177171
using ConfTrackSelection3 = ConfTrackSelection<PrefixTrackSelection3>;
178172

179-
using ConfPionPlusSelection = ConfTrackSelection<PrefixPionPlus>;
180-
using ConfPionMinusSelection = ConfTrackSelection<PrefixPionMinus>;
181-
using ConfKaonPlusSelection = ConfTrackSelection<PrefixKaonPlus>;
182-
using ConfKaonMinusSelection = ConfTrackSelection<PrefixKaonMinus>;
183-
184173
using ConfTrackSelectionDndetaGlobal = ConfTrackSelection<PrefixTrackSelectionDndetaGlobal>;
185174
using ConfTrackSelectionDndetaItsOnly = ConfTrackSelection<PrefixTrackSelectionDndetaItsOnly>;
186175

176+
// Track selection for resonance daughters (pion+/-, kaon+/-). Charge sign and abs charge are fixed
177+
// by the species itself, so they are compile-time constants rather than configurables. No pdg code
178+
// here at all: the daughter mass used to reconstruct the resonance is set directly in the resonance
179+
// builder (e.g. MassPiPlus/MassKMinus), never read from this selection. Used exclusively by the
180+
// resonance builders via MAKE_RESONANCE_DAUGHTER_PARTITION.
181+
template <auto& Prefix, int ChargeSign, float PidThresDefault>
182+
struct ConfResonanceDaughterSelection : public o2::framework::ConfigurableGroup {
183+
std::string prefix = Prefix;
184+
static const int chargeAbs = 1;
185+
static const int chargeSign = ChargeSign;
186+
// filters for kinematics
187+
o2::framework::Configurable<float> ptMin{"ptMin", 0.0f, "Minimum pT (GeV/c)"};
188+
o2::framework::Configurable<float> ptMax{"ptMax", 6.f, "Maximum pT (GeV/c)"};
189+
o2::framework::Configurable<float> etaMin{"etaMin", -0.9f, "Minimum eta"};
190+
o2::framework::Configurable<float> etaMax{"etaMax", 0.9f, "Maximum eta"};
191+
o2::framework::Configurable<float> phiMin{"phiMin", 0.f, "Minimum phi"};
192+
o2::framework::Configurable<float> phiMax{"phiMax", 1.f * o2::constants::math::TwoPI, "Maximum phi"};
193+
// track selection masks
194+
o2::framework::Configurable<datatypes::TrackMaskType> maskLowMomentum{"maskLowMomentum", 1ul, "Bitmask for selections below momentum threshold"};
195+
o2::framework::Configurable<datatypes::TrackMaskType> maskHighMomentum{"maskHighMomentum", 2ul, "Bitmask for selections above momentum threshold"};
196+
// track rejection masks
197+
o2::framework::Configurable<datatypes::TrackMaskType> rejectionMaskLowMomentum{"rejectionMaskLowMomentum", 0ul, "Bitmask for rejections below momentum threshold"};
198+
o2::framework::Configurable<datatypes::TrackMaskType> rejectionMaskHighMomentum{"rejectionMaskHighMomentum", 0ul, "Bitmask for rejections above momentum threshold"};
199+
// momentum threshold for PID usage
200+
o2::framework::Configurable<float> pidThres{"pidThres", PidThresDefault, "Momentum threshold for using TPCTOF/TOF pid for tracks with large momentum (GeV/c)"};
201+
};
202+
203+
constexpr const char PrefixPionPlus[] = "PionPlusSelection";
204+
constexpr const char PrefixPionMinus[] = "PionMinusSelection";
205+
constexpr const char PrefixKaonPlus[] = "KaonPlusSelection";
206+
constexpr const char PrefixKaonMinus[] = "KaonMinusSelection";
207+
208+
using ConfPionPlusSelection = ConfResonanceDaughterSelection<PrefixPionPlus, 1, 0.5f>;
209+
using ConfPionMinusSelection = ConfResonanceDaughterSelection<PrefixPionMinus, -1, 0.5f>;
210+
using ConfKaonPlusSelection = ConfResonanceDaughterSelection<PrefixKaonPlus, 1, 0.4f>;
211+
using ConfKaonMinusSelection = ConfResonanceDaughterSelection<PrefixKaonMinus, -1, 0.4f>;
212+
187213
/// enum for all track selections
188214
enum TrackSels {
189215
// track quality cuts

‎PWGCF/Femto/TableProducer/femtoProducerResonances.cxx‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,16 @@ struct FemtoProducerResonances {
4747

4848
// setup for resonance daughter tracks
4949
trackbuilder::ConfPionPlusSelection confPionPlusSelection;
50-
o2::framework::Partition<FemtoTracks> pionPlusPartition = MAKE_TRACK_PARTITION(confPionPlusSelection);
50+
o2::framework::Partition<FemtoTracks> pionPlusPartition = MAKE_RESONANCE_DAUGHTER_PARTITION(confPionPlusSelection);
5151

5252
trackbuilder::ConfPionMinusSelection confPionMinusSelection;
53-
o2::framework::Partition<FemtoTracks> pionMinusPartition = MAKE_TRACK_PARTITION(confPionMinusSelection);
53+
o2::framework::Partition<FemtoTracks> pionMinusPartition = MAKE_RESONANCE_DAUGHTER_PARTITION(confPionMinusSelection);
5454

5555
trackbuilder::ConfKaonPlusSelection confKaonPlusSelection;
56-
o2::framework::Partition<FemtoTracks> kaonPlusPartition = MAKE_TRACK_PARTITION(confKaonPlusSelection);
56+
o2::framework::Partition<FemtoTracks> kaonPlusPartition = MAKE_RESONANCE_DAUGHTER_PARTITION(confKaonPlusSelection);
5757

5858
trackbuilder::ConfKaonMinusSelection confKaonMinusSelection;
59-
o2::framework::Partition<FemtoTracks> kaonMinusPartition = MAKE_TRACK_PARTITION(confKaonMinusSelection);
59+
o2::framework::Partition<FemtoTracks> kaonMinusPartition = MAKE_RESONANCE_DAUGHTER_PARTITION(confKaonMinusSelection);
6060

6161
o2::framework::Preslice<FemtoTracks> perColtracks = o2::aod::femtobase::stored::fColId;
6262

‎PWGCF/Femto/TableProducer/femtoProducerTrackTrackTwoPhotonResonances.cxx‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,14 @@ struct FemtoProducerTrackTrackTwoPhotonResonances {
5252
o2::framework::expressions::Filter collisionFilter = MAKE_COLLISION_FILTER(collisionSelection);
5353
colhistmanager::ConfCollisionBinning confCollisionBinning;
5454

55-
// setup for the two charged (pion) daughters -- plain track selections, same mechanism used for
56-
// any other track daughter; sign is configured through these, not hardcoded in the builder
57-
trackbuilder::ConfTrackSelection1 posDauSelection;
58-
o2::framework::Partition<FemtoTracks> posDauPartition = MAKE_TRACK_PARTITION(posDauSelection);
55+
// setup for the two charged (pion) daughters. Dedicated pion-species selections, same ones
56+
// femtoProducerResonances.cxx uses for other two track resonances
57+
trackbuilder::ConfPionPlusSelection posDauSelection;
58+
o2::framework::Partition<FemtoTracks> posDauPartition = MAKE_RESONANCE_DAUGHTER_PARTITION(posDauSelection);
5959
o2::framework::Preslice<FemtoTracks> perColPosDau = o2::aod::femtobase::stored::fColId;
6060

61-
trackbuilder::ConfTrackSelection2 negDauSelection;
62-
o2::framework::Partition<FemtoTracks> negDauPartition = MAKE_TRACK_PARTITION(negDauSelection);
61+
trackbuilder::ConfPionMinusSelection negDauSelection;
62+
o2::framework::Partition<FemtoTracks> negDauPartition = MAKE_RESONANCE_DAUGHTER_PARTITION(negDauSelection);
6363
o2::framework::Preslice<FemtoTracks> perColNegDau = o2::aod::femtobase::stored::fColId;
6464

6565
// setup for the neutral (pi0) daughter

0 commit comments

Comments
 (0)