From f27e2adc53eed50844f671fe4411c585da12017e Mon Sep 17 00:00:00 2001 From: Anton Riedel Date: Mon, 21 Sep 2026 09:56:40 +0200 Subject: [PATCH 1/4] Fix: fix autosubscription of MC tables --- PWGCF/Femto/Core/mcBuilder.h | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/PWGCF/Femto/Core/mcBuilder.h b/PWGCF/Femto/Core/mcBuilder.h index 7935ebbb2ad..4b9526d4ae9 100644 --- a/PWGCF/Femto/Core/mcBuilder.h +++ b/PWGCF/Femto/Core/mcBuilder.h @@ -149,18 +149,18 @@ class McBuilder mProduceMcParticles = utils::enableTable("FMcParticles_001", table.produceMcParticles.value, initContext); mProduceMcMothers = utils::enableTable("FMcMothers_001", table.produceMcMothers.value, initContext); mProduceMcPartonicMothers = utils::enableTable("FMcPartMoths_001", table.produceMcPartonicMothers.value, initContext); - mProduceMcMotherLabels = utils::enableTable("FMcMotherLabels", table.producedMcMotherLabels.value, initContext); - - mProduceCollisionLabels = utils::enableTable("FColLabels", table.producedCollisionLabels.value, initContext); - mProduceTrackLabels = utils::enableTable("FTrackLabels", table.producedTrackLabels.value, initContext); - mProduceLambdaLabels = utils::enableTable("FLambdaLabels", table.producedLambdaLabels.value, initContext); - mProduceK0shortLabels = utils::enableTable("FK0shortLabels", table.producedK0shortLabels.value, initContext); - mProduceD0Labels = utils::enableTable("FD0Labels", table.producedD0Labels.value, initContext); - mProduceLcLabels = utils::enableTable("FLcLabels", table.producedLcLabels.value, initContext); - mProduceSigmaLabels = utils::enableTable("FSigmaLabels", table.producedSigmaLabels.value, initContext); - mProduceSigmaPlusLabels = utils::enableTable("FSigmaPlusLabels", table.producedSigmaPlusLabels.value, initContext); - mProduceXiLabels = utils::enableTable("FXiLabels", table.producedXiLabels.value, initContext); - mProduceOmegaLabels = utils::enableTable("FOmegaLabels", table.producedOmegaLabels.value, initContext); + mProduceMcMotherLabels = utils::enableTable("FMcMotherLabels_001", table.producedMcMotherLabels.value, initContext); + + mProduceCollisionLabels = utils::enableTable("FColLabels_001", table.producedCollisionLabels.value, initContext); + mProduceTrackLabels = utils::enableTable("FTrackLabels_001", table.producedTrackLabels.value, initContext); + mProduceLambdaLabels = utils::enableTable("FLambdaLabels_001", table.producedLambdaLabels.value, initContext); + mProduceK0shortLabels = utils::enableTable("FK0shortLabels_001", table.producedK0shortLabels.value, initContext); + mProduceD0Labels = utils::enableTable("FD0Labels_001", table.producedD0Labels.value, initContext); + mProduceLcLabels = utils::enableTable("FLcLabels_001", table.producedLcLabels.value, initContext); + mProduceSigmaLabels = utils::enableTable("FSigmaLabels_001", table.producedSigmaLabels.value, initContext); + mProduceSigmaPlusLabels = utils::enableTable("FSigmaPlusLabels_001", table.producedSigmaPlusLabels.value, initContext); + mProduceXiLabels = utils::enableTable("FXiLabels_001", table.producedXiLabels.value, initContext); + mProduceOmegaLabels = utils::enableTable("FOmegaLabels_001", table.producedOmegaLabels.value, initContext); if (mProduceMcCollisions || mProduceCollisionLabels || mProduceMcParticles || mProduceMcMotherLabels || From c31d3b414e9b32184324dfe8b0207d6884b5d494 Mon Sep 17 00:00:00 2001 From: Anton Riedel Date: Mon, 21 Sep 2026 10:15:46 +0200 Subject: [PATCH 2/4] Fix: add guard to collision builder --- PWGCF/Femto/Core/collisionBuilder.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/PWGCF/Femto/Core/collisionBuilder.h b/PWGCF/Femto/Core/collisionBuilder.h index 7a425a0c2a2..1c4737bdb09 100644 --- a/PWGCF/Femto/Core/collisionBuilder.h +++ b/PWGCF/Femto/Core/collisionBuilder.h @@ -669,6 +669,9 @@ class CollisionBuilder template void initCollision(T1 const& bc, T2 const& col, T3 const& tracks, T4& ccdb, T5& histRegistry) { + if (!mFillAnyTable) { + return; // selection object was never configured (no collision table requested), applying selections would use an unset registry + } if (mRunNumber != bc.runNumber()) { mRunNumber = bc.runNumber(); if (mMagFieldForced == 0) { From 178a58f64f37094b0e727b62f2e379397e06285f Mon Sep 17 00:00:00 2001 From: Anton Riedel Date: Wed, 23 Sep 2026 11:06:19 +0200 Subject: [PATCH 3/4] Fix: use unsorted slicing for FMcParticles --- PWGCF/Femto/Core/pairBuilder.h | 6 +++--- PWGCF/Femto/Core/pairProcessHelpers.h | 6 +++--- PWGCF/Femto/Core/tripletBuilder.h | 12 ++++++------ PWGCF/Femto/Core/tripletProcessHelpers.h | 10 +++++----- PWGCF/Femto/Tasks/femtoDndetaPair.cxx | 12 +++++++++++- PWGCF/Femto/Tasks/femtoDndetaTriplet.cxx | 12 +++++++++++- PWGCF/Femto/Tasks/femtoMcParticleQa.cxx | 4 ++-- PWGCF/Femto/Tasks/femtoPairMcParticleMcParticle.cxx | 2 +- 8 files changed, 42 insertions(+), 22 deletions(-) diff --git a/PWGCF/Femto/Core/pairBuilder.h b/PWGCF/Femto/Core/pairBuilder.h index e3e485eabb8..51597b5e43b 100644 --- a/PWGCF/Femto/Core/pairBuilder.h +++ b/PWGCF/Femto/Core/pairBuilder.h @@ -2067,7 +2067,7 @@ class PairMcParticleMcParticleBuilder bool processSameEvent(T1 const& col, T2 const& mcParticles, T3 const& mcMothers, T4 const& mcPartonicMothers, T5& partition1, T6& partition2, T7& cache) { if (mSameSpecies) { - auto mcParticleSlice = partition1->sliceByCached(o2::aod::femtomcparticle::fMcColId, col.globalIndex(), cache); + auto mcParticleSlice = partition1->sliceByCachedUnsorted(o2::aod::femtomcparticle::fMcColId, col.globalIndex(), cache); if (mcParticleSlice.size() < nLimitPartitionIdenticalParticles) { return false; @@ -2080,8 +2080,8 @@ class PairMcParticleMcParticleBuilder return pairprocesshelpers::processSameEvent(mcParticleSlice, mcParticles, mcMothers, mcPartonicMothers, col, mMcParticleHistManager1, mPairHistManagerSe, mMcParticleCleaner1, mCprSe, mPcSe, pairOrder); } - auto mcParticleSlice1 = partition1->sliceByCached(o2::aod::femtomcparticle::fMcColId, col.globalIndex(), cache); - auto mcParticleSlice2 = partition2->sliceByCached(o2::aod::femtomcparticle::fMcColId, col.globalIndex(), cache); + auto mcParticleSlice1 = partition1->sliceByCachedUnsorted(o2::aod::femtomcparticle::fMcColId, col.globalIndex(), cache); + auto mcParticleSlice2 = partition2->sliceByCachedUnsorted(o2::aod::femtomcparticle::fMcColId, col.globalIndex(), cache); if (mcParticleSlice1.size() < nLimitPartitionParticles || mcParticleSlice2.size() < nLimitPartitionParticles) { return false; } diff --git a/PWGCF/Femto/Core/pairProcessHelpers.h b/PWGCF/Femto/Core/pairProcessHelpers.h index 70c681c78a1..54323079df3 100644 --- a/PWGCF/Femto/Core/pairProcessHelpers.h +++ b/PWGCF/Femto/Core/pairProcessHelpers.h @@ -667,7 +667,7 @@ void processMixedEvent(T1 const& Collisions, int windowSizeRaw = 0; int windowSizeEffective = 0; - std::optionalsliceByCached(o2::aod::femtomcparticle::fMcColId, 0, cache))> sliceParticle1; + std::optionalsliceByCachedUnsorted(o2::aod::femtomcparticle::fMcColId, 0, cache))> sliceParticle1; for (auto const& [collision1, collision2] : o2::soa::selfCombinations(policy, depth, -1, Collisions, Collisions)) { @@ -678,12 +678,12 @@ void processMixedEvent(T1 const& Collisions, windowSizeRaw = 0; windowSizeEffective = 0; lastCollisionIndex = collision1.globalIndex(); - sliceParticle1.emplace(Partition1->sliceByCached(o2::aod::femtomcparticle::fMcColId, collision1.globalIndex(), cache)); + sliceParticle1.emplace(Partition1->sliceByCachedUnsorted(o2::aod::femtomcparticle::fMcColId, collision1.globalIndex(), cache)); } ++windowSizeRaw; - auto sliceParticle2 = Partition2->sliceByCached(o2::aod::femtomcparticle::fMcColId, collision2.globalIndex(), cache); + auto sliceParticle2 = Partition2->sliceByCachedUnsorted(o2::aod::femtomcparticle::fMcColId, collision2.globalIndex(), cache); PairHistManager.resetTrackedParticlesPerEvent(); diff --git a/PWGCF/Femto/Core/tripletBuilder.h b/PWGCF/Femto/Core/tripletBuilder.h index 1f4c704a67b..ec68bd83de1 100644 --- a/PWGCF/Femto/Core/tripletBuilder.h +++ b/PWGCF/Femto/Core/tripletBuilder.h @@ -1076,7 +1076,7 @@ class TripletMcParticleMcParticleMcParticleBuilder tripletprocesshelpers::TripletOrder tripletOrder = tripletprocesshelpers::kOrder123; if (mParticle1Particle2Particle3AreSameSpecies) { - auto mcParticleSlice1 = partition1->sliceByCached(o2::aod::femtomcparticle::fMcColId, mcCol.globalIndex(), cache); + auto mcParticleSlice1 = partition1->sliceByCachedUnsorted(o2::aod::femtomcparticle::fMcColId, mcCol.globalIndex(), cache); if (mcParticleSlice1.size() < nLimitPartitionIdenticalParticles123) { return false; } @@ -1088,8 +1088,8 @@ class TripletMcParticleMcParticleMcParticleBuilder } if (mParticle1Particle2AreSameSpecies) { - auto mcParticleSlice1 = partition1->sliceByCached(o2::aod::femtomcparticle::fMcColId, mcCol.globalIndex(), cache); - auto mcParticleSlice3 = partition3->sliceByCached(o2::aod::femtomcparticle::fMcColId, mcCol.globalIndex(), cache); + auto mcParticleSlice1 = partition1->sliceByCachedUnsorted(o2::aod::femtomcparticle::fMcColId, mcCol.globalIndex(), cache); + auto mcParticleSlice3 = partition3->sliceByCachedUnsorted(o2::aod::femtomcparticle::fMcColId, mcCol.globalIndex(), cache); if (mcParticleSlice1.size() < nLimitPartitionIdenticalParticles12 || mcParticleSlice3.size() < nLimitPartitionParticles) { return false; } @@ -1100,9 +1100,9 @@ class TripletMcParticleMcParticleMcParticleBuilder return tripletprocesshelpers::processSameEventMcTruth(mcParticleSlice1, mcParticleSlice3, mcParticles, mcMothers, mcPartonicMothers, mcCol, mMcParticleHistManager1, mMcParticleHistManager3, mTripletHistManagerSe, mMcParticleCleaner1, mMcParticleCleaner3, mCtrSe, mTcSe, tripletOrder); } - auto mcParticleSlice1 = partition1->sliceByCached(o2::aod::femtomcparticle::fMcColId, mcCol.globalIndex(), cache); - auto mcParticleSlice2 = partition2->sliceByCached(o2::aod::femtomcparticle::fMcColId, mcCol.globalIndex(), cache); - auto mcParticleSlice3 = partition3->sliceByCached(o2::aod::femtomcparticle::fMcColId, mcCol.globalIndex(), cache); + auto mcParticleSlice1 = partition1->sliceByCachedUnsorted(o2::aod::femtomcparticle::fMcColId, mcCol.globalIndex(), cache); + auto mcParticleSlice2 = partition2->sliceByCachedUnsorted(o2::aod::femtomcparticle::fMcColId, mcCol.globalIndex(), cache); + auto mcParticleSlice3 = partition3->sliceByCachedUnsorted(o2::aod::femtomcparticle::fMcColId, mcCol.globalIndex(), cache); if (mcParticleSlice1.size() < nLimitPartitionParticles || mcParticleSlice2.size() < nLimitPartitionParticles || mcParticleSlice3.size() < nLimitPartitionParticles) { return false; } diff --git a/PWGCF/Femto/Core/tripletProcessHelpers.h b/PWGCF/Femto/Core/tripletProcessHelpers.h index 729ef2a9cc1..639ca0545af 100644 --- a/PWGCF/Femto/Core/tripletProcessHelpers.h +++ b/PWGCF/Femto/Core/tripletProcessHelpers.h @@ -1005,8 +1005,8 @@ void processMixedEventMcTruth(T1 const& McCollisions, int windowSizeRaw = 0; int windowSizeEffective = 0; - std::optionalsliceByCached(o2::aod::femtomcparticle::fMcColId, 0, cache))> sliceParticle1; - std::optionalsliceByCached(o2::aod::femtomcparticle::fMcColId, 0, cache))> sliceParticle2; + std::optionalsliceByCachedUnsorted(o2::aod::femtomcparticle::fMcColId, 0, cache))> sliceParticle1; + std::optionalsliceByCachedUnsorted(o2::aod::femtomcparticle::fMcColId, 0, cache))> sliceParticle2; for (auto const& [collision1, collision2, collision3] : o2::soa::selfCombinations(policy, depth, -1, McCollisions, McCollisions, McCollisions)) { @@ -1019,18 +1019,18 @@ void processMixedEventMcTruth(T1 const& McCollisions, windowSizeEffective = 0; lastCollisionIndex1 = collision1.globalIndex(); lastCollisionIndex2 = -1; // force sliceParticle2 to refresh below - sliceParticle1.emplace(Partition1->sliceByCached(o2::aod::femtomcparticle::fMcColId, collision1.globalIndex(), cache)); + sliceParticle1.emplace(Partition1->sliceByCachedUnsorted(o2::aod::femtomcparticle::fMcColId, collision1.globalIndex(), cache)); } // inner sub-window if (collision2.globalIndex() != lastCollisionIndex2) { lastCollisionIndex2 = collision2.globalIndex(); - sliceParticle2.emplace(Partition2->sliceByCached(o2::aod::femtomcparticle::fMcColId, collision2.globalIndex(), cache)); + sliceParticle2.emplace(Partition2->sliceByCachedUnsorted(o2::aod::femtomcparticle::fMcColId, collision2.globalIndex(), cache)); } ++windowSizeRaw; - auto sliceParticle3 = Partition3->sliceByCached(o2::aod::femtomcparticle::fMcColId, collision3.globalIndex(), cache); + auto sliceParticle3 = Partition3->sliceByCachedUnsorted(o2::aod::femtomcparticle::fMcColId, collision3.globalIndex(), cache); TripletHistManager.resetTrackedParticlesPerEvent(); diff --git a/PWGCF/Femto/Tasks/femtoDndetaPair.cxx b/PWGCF/Femto/Tasks/femtoDndetaPair.cxx index 5e3545af380..922e5f59a6e 100644 --- a/PWGCF/Femto/Tasks/femtoDndetaPair.cxx +++ b/PWGCF/Femto/Tasks/femtoDndetaPair.cxx @@ -80,7 +80,9 @@ struct FemtoDndetaPair { dndetahistmanager::ConfDndetaBinning confDndetaBinning; dndetabuilder::DndetaBuilder dndetaBuilder; - o2::framework::Preslice perMcColParticles = o2::aod::femtomcparticle::fMcColId; + // pass-through mode does not guarantee fMcColId is written in sorted order (reco-driven label + // rows can be created out of mc-collision order), so this must be an unsorted grouping + o2::framework::PresliceUnsorted perMcColParticles = o2::aod::femtomcparticle::fMcColId; // setup collisions (applied in the dndeta builder, no filter, so the cutflow sees every collision) collisionbuilder::ConfCollisionSelection collisionSelection; @@ -101,6 +103,12 @@ struct FemtoDndetaPair { o2::framework::Partition dndetaTrackWithLabelPartitionGlobal = MAKE_TRACK_PARTITION(confDndetaTracksGlobal); o2::framework::Partition dndetaTrackWithLabelPartitionItsOnly = MAKE_TRACK_PARTITION(confDndetaTracksItsOnly); + // the *Mc process functions take the ungrouped tables (no ::iterator first argument), so DPL never + // auto-registers the fColId slicing cache for FemtoTracksWithLabel; this unused Preslice is the only + // thing that requests/enables it, otherwise sliceByCached() throws "Disabled cache ... is requested" + // once the first accepted reco collision actually reaches it + o2::framework::Preslice perColTracksWithLabel = o2::aod::femtobase::stored::fColId; + // setup tracks (trigger) trackbuilder::ConfTrackSelection1 confTrackSelection1; trackhistmanager::ConfTrackBinning1 confTrackBinning1; @@ -127,6 +135,8 @@ struct FemtoDndetaPair { o2::framework::Partition lambdaPartition = MAKE_LAMBDA_PARTITION(confLambdaSelection); o2::framework::Partition lambdaWithLabelPartition = MAKE_LAMBDA_PARTITION(confLambdaSelection); + // same reason as perColTracksWithLabel above, needed by processTrackV0Mc + o2::framework::Preslice perColLambdasWithLabel = o2::aod::femtobase::stored::fColId; // setup strangeness yields (dedicated selections, independent of the trigger) v0builder::ConfLambdaSelectionStrangeness confStrangeLambdaSelection; diff --git a/PWGCF/Femto/Tasks/femtoDndetaTriplet.cxx b/PWGCF/Femto/Tasks/femtoDndetaTriplet.cxx index 8bdf06a3459..4be3c0f0751 100644 --- a/PWGCF/Femto/Tasks/femtoDndetaTriplet.cxx +++ b/PWGCF/Femto/Tasks/femtoDndetaTriplet.cxx @@ -82,7 +82,9 @@ struct FemtoDndetaTriplet { dndetahistmanager::ConfDndetaBinning confDndetaBinning; dndetabuilder::DndetaBuilder dndetaBuilder; - o2::framework::Preslice perMcColParticles = o2::aod::femtomcparticle::fMcColId; + // pass-through mode does not guarantee fMcColId is written in sorted order (reco-driven label + // rows can be created out of mc-collision order), so this must be an unsorted grouping + o2::framework::PresliceUnsorted perMcColParticles = o2::aod::femtomcparticle::fMcColId; // setup collisions (applied in the dndeta builder, no filter, so the cutflow sees every collision) collisionbuilder::ConfCollisionSelection collisionSelection; @@ -103,6 +105,12 @@ struct FemtoDndetaTriplet { o2::framework::Partition dndetaTrackWithLabelPartitionGlobal = MAKE_TRACK_PARTITION(confDndetaTracksGlobal); o2::framework::Partition dndetaTrackWithLabelPartitionItsOnly = MAKE_TRACK_PARTITION(confDndetaTracksItsOnly); + // the *Mc process functions take the ungrouped tables (no ::iterator first argument), so DPL never + // auto-registers the fColId slicing cache for FemtoTracksWithLabel; this unused Preslice is the only + // thing that requests/enables it, otherwise sliceByCached() throws "Disabled cache ... is requested" + // once the first accepted reco collision actually reaches it + o2::framework::Preslice perColTracksWithLabel = o2::aod::femtobase::stored::fColId; + // setup tracks (trigger) trackbuilder::ConfTrackSelection1 confTrackSelection1; trackhistmanager::ConfTrackBinning1 confTrackBinning1; @@ -135,6 +143,8 @@ struct FemtoDndetaTriplet { o2::framework::Partition lambdaPartition = MAKE_LAMBDA_PARTITION(confLambdaSelection); o2::framework::Partition lambdaWithLabelPartition = MAKE_LAMBDA_PARTITION(confLambdaSelection); + // same reason as perColTracksWithLabel above, needed by processTrackTrackV0Mc + o2::framework::Preslice perColLambdasWithLabel = o2::aod::femtobase::stored::fColId; // setup strangeness yields (dedicated selections, independent of the trigger) v0builder::ConfLambdaSelectionStrangeness confStrangeLambdaSelection; diff --git a/PWGCF/Femto/Tasks/femtoMcParticleQa.cxx b/PWGCF/Femto/Tasks/femtoMcParticleQa.cxx index 22e96ddaedb..f7f0706e16a 100644 --- a/PWGCF/Femto/Tasks/femtoMcParticleQa.cxx +++ b/PWGCF/Femto/Tasks/femtoMcParticleQa.cxx @@ -59,7 +59,7 @@ struct FemtoMcParticleQa { mcparticlehistmanager::McParticleHistManager mcParticleHistManager1; o2::framework::Partition mcParticlesPartition1 = MAKE_MC_PARTICLE_PARTITION(confMcParticleSelection1); - o2::framework::Preslice perColReco = o2::aod::femtomcparticle::fMcColId; + o2::framework::PresliceUnsorted perColReco = o2::aod::femtomcparticle::fMcColId; particlecleaner::ConfMcParticleCleaner1 confMcParticleCleaner1; particlecleaner::ParticleCleaner mcParticleCleaner; @@ -83,7 +83,7 @@ struct FemtoMcParticleQa { void process(FilteredFemtoMcCollision const& col, FemtoMcParticles const& /*mcParticles*/, o2::aod::FMcMothers const& mcMothers, o2::aod::FMcPartMoths const& mcPartonicMothers) { - auto mcParticleSlice = mcParticlesPartition1->sliceByCached(o2::aod::femtomcparticle::fMcColId, col.globalIndex(), cache); + auto mcParticleSlice = mcParticlesPartition1->sliceByCachedUnsorted(o2::aod::femtomcparticle::fMcColId, col.globalIndex(), cache); if (mcParticleSlice.size() == 0) { return; } diff --git a/PWGCF/Femto/Tasks/femtoPairMcParticleMcParticle.cxx b/PWGCF/Femto/Tasks/femtoPairMcParticleMcParticle.cxx index d7a36b69bf3..7be627972f8 100644 --- a/PWGCF/Femto/Tasks/femtoPairMcParticleMcParticle.cxx +++ b/PWGCF/Femto/Tasks/femtoPairMcParticleMcParticle.cxx @@ -76,7 +76,7 @@ struct FemtoPairMcParticleMcParticle { o2::framework::Partition mcParticlesPartition2 = MAKE_MC_PARTICLE_PARTITION(confMcParticleSelection2); - o2::framework::Preslice perColParticles = o2::aod::femtomcparticle::fMcColId; + o2::framework::PresliceUnsorted perColParticles = o2::aod::femtomcparticle::fMcColId; // setup pairs pairhistmanager::ConfPairBinning confPairBinning; From bf0c0b6d06ecc594c66e86ec917b5827e9895c4a Mon Sep 17 00:00:00 2001 From: Anton Riedel Date: Wed, 23 Sep 2026 13:03:22 +0200 Subject: [PATCH 4/4] Fix: various bug fixes --- PWGCF/Femto/Core/cascadeBuilder.h | 2 +- PWGCF/Femto/Core/cascadeHistManager.h | 2 +- PWGCF/Femto/Core/pairBuilder.h | 16 ++--- PWGCF/Femto/Core/tripletProcessHelpers.h | 37 ++++++---- .../Femto/Core/twoTrackResonanceHistManager.h | 4 +- PWGCF/Femto/Core/v0HistManager.h | 2 +- PWGCF/Femto/DataModel/FemtoTables.h | 4 +- PWGCF/Femto/TableProducer/femtoProducer.cxx | 67 ++++++++++--------- PWGCF/Femto/Tasks/femtoKinkQa.cxx | 2 +- 9 files changed, 70 insertions(+), 66 deletions(-) diff --git a/PWGCF/Femto/Core/cascadeBuilder.h b/PWGCF/Femto/Core/cascadeBuilder.h index 9b86483b61c..1248e0bfc8d 100644 --- a/PWGCF/Femto/Core/cascadeBuilder.h +++ b/PWGCF/Femto/Core/cascadeBuilder.h @@ -669,7 +669,7 @@ class CascadeBuilder } template - void fillCascade(T1& collisionBuilder, T2& cascadeProducts, T3 const& cascade, T4 const& col, int bachelorIndex, int posDaughterIndex, int negDaughterIndex) + void fillCascade(T1& collisionBuilder, T2& cascadeProducts, T3 const& cascade, T4 const& col, int64_t bachelorIndex, int64_t posDaughterIndex, int64_t negDaughterIndex) { float strangeTofBachelor = 0.f; float strangeTofPosDau = 0.f; diff --git a/PWGCF/Femto/Core/cascadeHistManager.h b/PWGCF/Femto/Core/cascadeHistManager.h index cbb8143feb5..5d60057b60a 100644 --- a/PWGCF/Femto/Core/cascadeHistManager.h +++ b/PWGCF/Femto/Core/cascadeHistManager.h @@ -475,7 +475,7 @@ class CascadeHistManager this->fillAnalysis(cascadeCandidate); } if constexpr (modes::isFlagSet(mode, modes::Mode::kQa)) { - this->fillQa(cascadeCandidate, bachelor, negDaughter, posDaughter); + this->fillQa(cascadeCandidate, bachelor, posDaughter, negDaughter); } if constexpr (modes::isFlagSet(mode, modes::Mode::kMc)) { this->template fillMc(cascadeCandidate, col, mcParticles, mcMothers, mcPartonicMothers); diff --git a/PWGCF/Femto/Core/pairBuilder.h b/PWGCF/Femto/Core/pairBuilder.h index 51597b5e43b..0b408b64487 100644 --- a/PWGCF/Femto/Core/pairBuilder.h +++ b/PWGCF/Femto/Core/pairBuilder.h @@ -398,14 +398,6 @@ class PairV0V0Builder << "). Overriding sameSpecies to false."; mSameSpecies = false; } - } else { - // same v0 species: both values are legitimate (e.g. lambda-lambda vs lambda-antilambda), - // but running as different species only makes sense if the two selections are disjoint - if (!mSameSpecies && confV0Selection1.sign.value == confV0Selection2.sign.value) { - LOG(warn) << "sameSpecies=false for identical v0 species with identical sign (" - << confV0Selection1.sign.value << "). If both selections match the same " - << "candidates, this produces self-pairs and double counting."; - } } mColHistManager.template init(registry, colHistSpec, confCollisionBinning); @@ -1910,17 +1902,17 @@ class PairTrackCascadeBuilder } template - void processMixedEvent(T1 const& cols, T2& trackTable, T3& trackPartition, T4& v0Partition, T5& cache, T6& binsVtxMult, T7& binsVtxCent, T8& binsVtxMultCent) + void processMixedEvent(T1 const& cols, T2& trackTable, T3& trackPartition, T4& cascadePartition, T5& cache, T6& binsVtxMult, T7& binsVtxCent, T8& binsVtxMultCent) { switch (mMixingPolicy) { case static_cast(pairhistmanager::kVtxMult): - pairprocesshelpers::processMixedEvent(cols, trackPartition, v0Partition, trackTable, cache, binsVtxMult, mMixingDepth, mPairHistManagerMe, mCprMe, mPcMe); + pairprocesshelpers::processMixedEvent(cols, trackPartition, cascadePartition, trackTable, cache, binsVtxMult, mMixingDepth, mPairHistManagerMe, mCprMe, mPcMe); break; case static_cast(pairhistmanager::kVtxCent): - pairprocesshelpers::processMixedEvent(cols, trackPartition, v0Partition, trackTable, cache, binsVtxCent, mMixingDepth, mPairHistManagerMe, mCprMe, mPcMe); + pairprocesshelpers::processMixedEvent(cols, trackPartition, cascadePartition, trackTable, cache, binsVtxCent, mMixingDepth, mPairHistManagerMe, mCprMe, mPcMe); break; case static_cast(pairhistmanager::kVtxMultCent): - pairprocesshelpers::processMixedEvent(cols, trackPartition, v0Partition, trackTable, cache, binsVtxMultCent, mMixingDepth, mPairHistManagerMe, mCprMe, mPcMe); + pairprocesshelpers::processMixedEvent(cols, trackPartition, cascadePartition, trackTable, cache, binsVtxMultCent, mMixingDepth, mPairHistManagerMe, mCprMe, mPcMe); break; default: LOG(fatal) << "Invalid binning policiy specifed. Breaking..."; diff --git a/PWGCF/Femto/Core/tripletProcessHelpers.h b/PWGCF/Femto/Core/tripletProcessHelpers.h index 639ca0545af..a5d7b812305 100644 --- a/PWGCF/Femto/Core/tripletProcessHelpers.h +++ b/PWGCF/Femto/Core/tripletProcessHelpers.h @@ -35,7 +35,9 @@ enum TripletOrder : uint8_t { kOrder123, // no swap kOrder213, // swap 1&2: for the case that particle 1 & 2 are the same species, particle 3 is something else kOrder132, // swap 2&3 - kOrder321, // reverse: swap 1&3 + kOrder231, // swap 1&2 & 1&3 + kOrder312, // swap 2&3 & 1&3 + kOrder321, // swap 1&3 }; // process same event for identical 3 particles @@ -76,6 +78,12 @@ bool processSameEvent(T1 const& SliceParticle, case kOrder132: TripletHistManager.setTriplet(p1, p3, p2, Collision); break; + case kOrder231: + TripletHistManager.setTriplet(p2, p3, p1, Collision); + break; + case kOrder312: + TripletHistManager.setTriplet(p3, p1, p2, Collision); + break; case kOrder321: TripletHistManager.setTriplet(p3, p2, p1, Collision); break; @@ -291,6 +299,12 @@ bool processSameEvent(T1 const& SliceParticle, case kOrder132: TripletHistManager.setTripletMc(p1, p3, p2, mcParticles, Collision, mcCollisions); break; + case kOrder231: + TripletHistManager.setTripletMc(p2, p3, p1, mcParticles, Collision, mcCollisions); + break; + case kOrder312: + TripletHistManager.setTripletMc(p3, p1, p2, mcParticles, Collision, mcCollisions); + break; case kOrder321: TripletHistManager.setTripletMc(p3, p2, p1, mcParticles, Collision, mcCollisions); break; @@ -403,7 +417,6 @@ bool processSameEvent(T1 const& SliceParticle1, } // process same event for 3 different particles with mc information -// NOTE: added `Cleaner1`, `Cleaner2`, `Cleaner3` (one per species) template fill(HIST(v0Prefix) + HIST(QaDir) + HIST(getHistName(kMassLambda, HistTable)), massLambda); diff --git a/PWGCF/Femto/DataModel/FemtoTables.h b/PWGCF/Femto/DataModel/FemtoTables.h index dd4af0506bb..958fb9cb99d 100644 --- a/PWGCF/Femto/DataModel/FemtoTables.h +++ b/PWGCF/Femto/DataModel/FemtoTables.h @@ -216,11 +216,11 @@ DECLARE_SOA_DYNAMIC_COLUMN(Pt, pt, //! transverse momentum }); DECLARE_SOA_DYNAMIC_COLUMN(Px, px, //! momentum in x [](float pt, float phi) -> float { - return std::fabs(pt) * std::sin(phi); + return std::fabs(pt) * std::cos(phi); }); DECLARE_SOA_DYNAMIC_COLUMN(Py, py, //! momentum in y [](float pt, float phi) -> float { - return std::fabs(pt) * std::cos(phi); + return std::fabs(pt) * std::sin(phi); }); DECLARE_SOA_DYNAMIC_COLUMN(Pz, pz, //! momentum in z [](float pt, float eta) -> float { diff --git a/PWGCF/Femto/TableProducer/femtoProducer.cxx b/PWGCF/Femto/TableProducer/femtoProducer.cxx index 16bd0b3726e..0053724e5a9 100644 --- a/PWGCF/Femto/TableProducer/femtoProducer.cxx +++ b/PWGCF/Femto/TableProducer/femtoProducer.cxx @@ -372,15 +372,14 @@ struct FemtoProducer { return true; } - template - bool processMcCollisions(T1 const& col, T2 const& mcCols, T3 const& /* bcs*/, T4 const& tracks, T5 const& mcParticles) + template + bool processMcCollisions(T1 const& col, T2 const& mcCols, T3 const& /* bcs*/, T4 const& tracks) { collisionBuilder.reset(); - // in pass-through the maps are built once per timeframe - // resetting here would wipe them and duplicate every mc collision and particle - if (!mcBuilder.isPassThrough()) { - mcBuilder.reset(mcCols, mcParticles); - } + // mcBuilder.reset() runs once per timeframe in the calling processTracksXXXMc function + // (both pass-through and lazy-fill mode); resetting here on every reco collision would + // wipe the dedup maps and duplicate every mc collision/particle referenced by more than + // one reco collision (e.g. split-vertex reconstruction under pileup) auto bc = col.template bc_as(); collisionBuilder.initCollision(bc, col, tracks, ccdb, hRegistry); if (!collisionBuilder.checkCollision(col, mcCols)) { @@ -678,8 +677,10 @@ struct FemtoProducer { // does no auto-grouping. Tables that are iterated over (tracks, v0s, cascades, // kinks) are sliced per collision; the full track table is passed alongside so // the v0/cascade/kink builders can resolve their daughter indices. - // These functions own the per-timeframe reset of the mc builder maps, which is - // why processMcCollisions skips its own reset in pass-through mode. + // These functions own the per-timeframe reset of the mc builder maps (once, before the + // reco-collision loop, in both pass-through and lazy-fill mode); processMcCollisions never + // resets them itself, since it runs once per reco collision and the dedup maps have to + // survive across all reco collisions in the timeframe. // ========================================================================== void processTracksRun3ppMc(rawinputs::Run3PpMcGenCollisions const& mcCols, @@ -688,14 +689,14 @@ struct FemtoProducer { rawinputs::Run3McRecoTracks const& tracks, rawinputs::Run3McGenParticles const& mcParticles) { + mcBuilder.reset(mcCols, mcParticles); if (mcBuilder.isPassThrough()) { - mcBuilder.reset(mcCols, mcParticles); mcBuilder.fillMcPassThrough(mcCols, mcParticles, perMcCollision, mcProducts); } for (const auto& col : cols) { auto tracksThisCol = tracks.sliceBy(perColRecoTracks, col.globalIndex()); - if (!processMcCollisions(col, mcCols, bcs, tracksThisCol, mcParticles)) { + if (!processMcCollisions(col, mcCols, bcs, tracksThisCol)) { continue; } auto tracksWithItsPid = o2::soa::Attach(mcCols, mcParticles, perMcCollision, mcProducts); } for (const auto& col : cols) { auto tracksThisCol = tracks.sliceBy(perColRecoTracks, col.globalIndex()); - if (!processMcCollisions(col, mcCols, bcs, tracksThisCol, mcParticles)) { + if (!processMcCollisions(col, mcCols, bcs, tracksThisCol)) { continue; } auto tracksWithItsPid = o2::soa::Attach(mcCols, mcParticles, perMcCollision, mcProducts); } for (const auto& col : cols) { auto tracksThisCol = tracks.sliceBy(perColRecoTracks, col.globalIndex()); - if (!processMcCollisions(col, mcCols, bcs, tracksThisCol, mcParticles)) { + if (!processMcCollisions(col, mcCols, bcs, tracksThisCol)) { continue; } auto tracksWithItsPid = o2::soa::Attach(mcCols, mcParticles, perMcCollision, mcProducts); } for (const auto& col : cols) { auto tracksThisCol = tracks.sliceBy(perColRecoTracks, col.globalIndex()); - if (!processMcCollisions(col, mcCols, bcs, tracksThisCol, mcParticles)) { + if (!processMcCollisions(col, mcCols, bcs, tracksThisCol)) { continue; } auto tracksWithItsPid = o2::soa::Attach(mcCols, mcParticles, perMcCollision, mcProducts); } for (const auto& col : cols) { auto tracksThisCol = tracks.sliceBy(perColRecoTracks, col.globalIndex()); - if (!processMcCollisions(col, mcCols, bcs, tracksThisCol, mcParticles)) { + if (!processMcCollisions(col, mcCols, bcs, tracksThisCol)) { continue; } auto tracksWithItsPid = o2::soa::Attach(mcCols, mcParticles, perMcCollision, mcProducts); } for (const auto& col : cols) { auto tracksThisCol = tracks.sliceBy(perColRecoTracks, col.globalIndex()); - if (!processMcCollisions(col, mcCols, bcs, tracksThisCol, mcParticles)) { + if (!processMcCollisions(col, mcCols, bcs, tracksThisCol)) { continue; } auto tracksWithItsPid = o2::soa::Attach(mcCols, mcParticles, perMcCollision, mcProducts); } for (const auto& col : cols) { auto tracksThisCol = tracks.sliceBy(perColRecoTracks, col.globalIndex()); - if (!processMcCollisions(col, mcCols, bcs, tracksThisCol, mcParticles)) { + if (!processMcCollisions(col, mcCols, bcs, tracksThisCol)) { continue; } auto tracksWithItsPid = o2::soa::Attach(mcCols, mcParticles, perMcCollision, mcProducts); } for (const auto& col : cols) { auto tracksThisCol = tracks.sliceBy(perColRecoTracks, col.globalIndex()); - if (!processMcCollisions(col, mcCols, bcs, tracksThisCol, mcParticles)) { + if (!processMcCollisions(col, mcCols, bcs, tracksThisCol)) { continue; } auto tracksWithItsPid = o2::soa::Attach(mcCols, mcParticles, perMcCollision, mcProducts); } for (const auto& col : cols) { auto tracksThisCol = tracks.sliceBy(perColRecoTracks, col.globalIndex()); - if (!processMcCollisions(col, mcCols, bcs, tracksThisCol, mcParticles)) { + if (!processMcCollisions(col, mcCols, bcs, tracksThisCol)) { continue; } auto tracksWithItsPid = o2::soa::Attach(mcCols, mcParticles, perMcCollision, mcProducts); } for (const auto& col : cols) { auto tracksThisCol = tracks.sliceBy(perColRecoTracks, col.globalIndex()); - if (!processMcCollisions(col, mcCols, bcs, tracksThisCol, mcParticles)) { + if (!processMcCollisions(col, mcCols, bcs, tracksThisCol)) { continue; } auto tracksWithItsPid = o2::soa::Attach(mcCols, mcParticles, perMcCollision, mcProducts); } for (const auto& col : cols) { auto tracksThisCol = tracks.sliceBy(perColRecoTracks, col.globalIndex()); - if (!processMcCollisions(col, mcCols, bcs, tracksThisCol, mcParticles)) { + if (!processMcCollisions(col, mcCols, bcs, tracksThisCol)) { continue; } auto tracksWithItsPid = o2::soa::Attach(mcCols, mcParticles, perMcCollision, mcProducts); } for (const auto& col : cols) { auto tracksThisCol = tracks.sliceBy(perColRecoTracks, col.globalIndex()); - if (!processMcCollisions(col, mcCols, bcs, tracksThisCol, mcParticles)) { + if (!processMcCollisions(col, mcCols, bcs, tracksThisCol)) { continue; } auto tracksWithItsPid = o2::soa::Attach sigmaPlusPartition = MAKE_SIGMAPLUS_PARTITION(confSigmaPlusSelection); o2::framework::Preslice perColSigmaPlus = o2::aod::femtobase::stored::fColId; - o2::framework::Partition sigmaPlusWithLabelPartition = MAKE_SIGMAPLUS_PARTITION(confSigmaSelection); + o2::framework::Partition sigmaPlusWithLabelPartition = MAKE_SIGMAPLUS_PARTITION(confSigmaPlusSelection); o2::framework::Preslice perColSigmaPlussWithLabel = o2::aod::femtobase::stored::fColId; kinkhistmanager::ConfSigmaPlusBinning1 confSigmaPlusBinning;