Skip to content

Commit 178a58f

Browse files
committed
Fix: use unsorted slicing for FMcParticles
1 parent c31d3b4 commit 178a58f

8 files changed

Lines changed: 42 additions & 22 deletions

‎PWGCF/Femto/Core/pairBuilder.h‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2067,7 +2067,7 @@ class PairMcParticleMcParticleBuilder
20672067
bool processSameEvent(T1 const& col, T2 const& mcParticles, T3 const& mcMothers, T4 const& mcPartonicMothers, T5& partition1, T6& partition2, T7& cache)
20682068
{
20692069
if (mSameSpecies) {
2070-
auto mcParticleSlice = partition1->sliceByCached(o2::aod::femtomcparticle::fMcColId, col.globalIndex(), cache);
2070+
auto mcParticleSlice = partition1->sliceByCachedUnsorted(o2::aod::femtomcparticle::fMcColId, col.globalIndex(), cache);
20712071

20722072
if (mcParticleSlice.size() < nLimitPartitionIdenticalParticles) {
20732073
return false;
@@ -2080,8 +2080,8 @@ class PairMcParticleMcParticleBuilder
20802080
return pairprocesshelpers::processSameEvent<mode>(mcParticleSlice, mcParticles, mcMothers, mcPartonicMothers, col, mMcParticleHistManager1, mPairHistManagerSe, mMcParticleCleaner1, mCprSe, mPcSe, pairOrder);
20812081
}
20822082

2083-
auto mcParticleSlice1 = partition1->sliceByCached(o2::aod::femtomcparticle::fMcColId, col.globalIndex(), cache);
2084-
auto mcParticleSlice2 = partition2->sliceByCached(o2::aod::femtomcparticle::fMcColId, col.globalIndex(), cache);
2083+
auto mcParticleSlice1 = partition1->sliceByCachedUnsorted(o2::aod::femtomcparticle::fMcColId, col.globalIndex(), cache);
2084+
auto mcParticleSlice2 = partition2->sliceByCachedUnsorted(o2::aod::femtomcparticle::fMcColId, col.globalIndex(), cache);
20852085
if (mcParticleSlice1.size() < nLimitPartitionParticles || mcParticleSlice2.size() < nLimitPartitionParticles) {
20862086
return false;
20872087
}

‎PWGCF/Femto/Core/pairProcessHelpers.h‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -667,7 +667,7 @@ void processMixedEvent(T1 const& Collisions,
667667
int windowSizeRaw = 0;
668668
int windowSizeEffective = 0;
669669

670-
std::optional<decltype(Partition1->sliceByCached(o2::aod::femtomcparticle::fMcColId, 0, cache))> sliceParticle1;
670+
std::optional<decltype(Partition1->sliceByCachedUnsorted(o2::aod::femtomcparticle::fMcColId, 0, cache))> sliceParticle1;
671671

672672
for (auto const& [collision1, collision2] : o2::soa::selfCombinations(policy, depth, -1, Collisions, Collisions)) {
673673

@@ -678,12 +678,12 @@ void processMixedEvent(T1 const& Collisions,
678678
windowSizeRaw = 0;
679679
windowSizeEffective = 0;
680680
lastCollisionIndex = collision1.globalIndex();
681-
sliceParticle1.emplace(Partition1->sliceByCached(o2::aod::femtomcparticle::fMcColId, collision1.globalIndex(), cache));
681+
sliceParticle1.emplace(Partition1->sliceByCachedUnsorted(o2::aod::femtomcparticle::fMcColId, collision1.globalIndex(), cache));
682682
}
683683

684684
++windowSizeRaw;
685685

686-
auto sliceParticle2 = Partition2->sliceByCached(o2::aod::femtomcparticle::fMcColId, collision2.globalIndex(), cache);
686+
auto sliceParticle2 = Partition2->sliceByCachedUnsorted(o2::aod::femtomcparticle::fMcColId, collision2.globalIndex(), cache);
687687

688688
PairHistManager.resetTrackedParticlesPerEvent();
689689

‎PWGCF/Femto/Core/tripletBuilder.h‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1076,7 +1076,7 @@ class TripletMcParticleMcParticleMcParticleBuilder
10761076
tripletprocesshelpers::TripletOrder tripletOrder = tripletprocesshelpers::kOrder123;
10771077

10781078
if (mParticle1Particle2Particle3AreSameSpecies) {
1079-
auto mcParticleSlice1 = partition1->sliceByCached(o2::aod::femtomcparticle::fMcColId, mcCol.globalIndex(), cache);
1079+
auto mcParticleSlice1 = partition1->sliceByCachedUnsorted(o2::aod::femtomcparticle::fMcColId, mcCol.globalIndex(), cache);
10801080
if (mcParticleSlice1.size() < nLimitPartitionIdenticalParticles123) {
10811081
return false;
10821082
}
@@ -1088,8 +1088,8 @@ class TripletMcParticleMcParticleMcParticleBuilder
10881088
}
10891089

10901090
if (mParticle1Particle2AreSameSpecies) {
1091-
auto mcParticleSlice1 = partition1->sliceByCached(o2::aod::femtomcparticle::fMcColId, mcCol.globalIndex(), cache);
1092-
auto mcParticleSlice3 = partition3->sliceByCached(o2::aod::femtomcparticle::fMcColId, mcCol.globalIndex(), cache);
1091+
auto mcParticleSlice1 = partition1->sliceByCachedUnsorted(o2::aod::femtomcparticle::fMcColId, mcCol.globalIndex(), cache);
1092+
auto mcParticleSlice3 = partition3->sliceByCachedUnsorted(o2::aod::femtomcparticle::fMcColId, mcCol.globalIndex(), cache);
10931093
if (mcParticleSlice1.size() < nLimitPartitionIdenticalParticles12 || mcParticleSlice3.size() < nLimitPartitionParticles) {
10941094
return false;
10951095
}
@@ -1100,9 +1100,9 @@ class TripletMcParticleMcParticleMcParticleBuilder
11001100
return tripletprocesshelpers::processSameEventMcTruth<mode>(mcParticleSlice1, mcParticleSlice3, mcParticles, mcMothers, mcPartonicMothers, mcCol, mMcParticleHistManager1, mMcParticleHistManager3, mTripletHistManagerSe, mMcParticleCleaner1, mMcParticleCleaner3, mCtrSe, mTcSe, tripletOrder);
11011101
}
11021102

1103-
auto mcParticleSlice1 = partition1->sliceByCached(o2::aod::femtomcparticle::fMcColId, mcCol.globalIndex(), cache);
1104-
auto mcParticleSlice2 = partition2->sliceByCached(o2::aod::femtomcparticle::fMcColId, mcCol.globalIndex(), cache);
1105-
auto mcParticleSlice3 = partition3->sliceByCached(o2::aod::femtomcparticle::fMcColId, mcCol.globalIndex(), cache);
1103+
auto mcParticleSlice1 = partition1->sliceByCachedUnsorted(o2::aod::femtomcparticle::fMcColId, mcCol.globalIndex(), cache);
1104+
auto mcParticleSlice2 = partition2->sliceByCachedUnsorted(o2::aod::femtomcparticle::fMcColId, mcCol.globalIndex(), cache);
1105+
auto mcParticleSlice3 = partition3->sliceByCachedUnsorted(o2::aod::femtomcparticle::fMcColId, mcCol.globalIndex(), cache);
11061106
if (mcParticleSlice1.size() < nLimitPartitionParticles || mcParticleSlice2.size() < nLimitPartitionParticles || mcParticleSlice3.size() < nLimitPartitionParticles) {
11071107
return false;
11081108
}

‎PWGCF/Femto/Core/tripletProcessHelpers.h‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,8 +1005,8 @@ void processMixedEventMcTruth(T1 const& McCollisions,
10051005
int windowSizeRaw = 0;
10061006
int windowSizeEffective = 0;
10071007

1008-
std::optional<decltype(Partition1->sliceByCached(o2::aod::femtomcparticle::fMcColId, 0, cache))> sliceParticle1;
1009-
std::optional<decltype(Partition2->sliceByCached(o2::aod::femtomcparticle::fMcColId, 0, cache))> sliceParticle2;
1008+
std::optional<decltype(Partition1->sliceByCachedUnsorted(o2::aod::femtomcparticle::fMcColId, 0, cache))> sliceParticle1;
1009+
std::optional<decltype(Partition2->sliceByCachedUnsorted(o2::aod::femtomcparticle::fMcColId, 0, cache))> sliceParticle2;
10101010

10111011
for (auto const& [collision1, collision2, collision3] : o2::soa::selfCombinations(policy, depth, -1, McCollisions, McCollisions, McCollisions)) {
10121012

@@ -1019,18 +1019,18 @@ void processMixedEventMcTruth(T1 const& McCollisions,
10191019
windowSizeEffective = 0;
10201020
lastCollisionIndex1 = collision1.globalIndex();
10211021
lastCollisionIndex2 = -1; // force sliceParticle2 to refresh below
1022-
sliceParticle1.emplace(Partition1->sliceByCached(o2::aod::femtomcparticle::fMcColId, collision1.globalIndex(), cache));
1022+
sliceParticle1.emplace(Partition1->sliceByCachedUnsorted(o2::aod::femtomcparticle::fMcColId, collision1.globalIndex(), cache));
10231023
}
10241024

10251025
// inner sub-window
10261026
if (collision2.globalIndex() != lastCollisionIndex2) {
10271027
lastCollisionIndex2 = collision2.globalIndex();
1028-
sliceParticle2.emplace(Partition2->sliceByCached(o2::aod::femtomcparticle::fMcColId, collision2.globalIndex(), cache));
1028+
sliceParticle2.emplace(Partition2->sliceByCachedUnsorted(o2::aod::femtomcparticle::fMcColId, collision2.globalIndex(), cache));
10291029
}
10301030

10311031
++windowSizeRaw;
10321032

1033-
auto sliceParticle3 = Partition3->sliceByCached(o2::aod::femtomcparticle::fMcColId, collision3.globalIndex(), cache);
1033+
auto sliceParticle3 = Partition3->sliceByCachedUnsorted(o2::aod::femtomcparticle::fMcColId, collision3.globalIndex(), cache);
10341034

10351035
TripletHistManager.resetTrackedParticlesPerEvent();
10361036

‎PWGCF/Femto/Tasks/femtoDndetaPair.cxx‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,9 @@ struct FemtoDndetaPair {
8080
dndetahistmanager::ConfDndetaBinning confDndetaBinning;
8181
dndetabuilder::DndetaBuilder dndetaBuilder;
8282

83-
o2::framework::Preslice<FemtoMcParticles> perMcColParticles = o2::aod::femtomcparticle::fMcColId;
83+
// pass-through mode does not guarantee fMcColId is written in sorted order (reco-driven label
84+
// rows can be created out of mc-collision order), so this must be an unsorted grouping
85+
o2::framework::PresliceUnsorted<FemtoMcParticles> perMcColParticles = o2::aod::femtomcparticle::fMcColId;
8486

8587
// setup collisions (applied in the dndeta builder, no filter, so the cutflow sees every collision)
8688
collisionbuilder::ConfCollisionSelection collisionSelection;
@@ -101,6 +103,12 @@ struct FemtoDndetaPair {
101103
o2::framework::Partition<FemtoTracksWithLabel> dndetaTrackWithLabelPartitionGlobal = MAKE_TRACK_PARTITION(confDndetaTracksGlobal);
102104
o2::framework::Partition<FemtoTracksWithLabel> dndetaTrackWithLabelPartitionItsOnly = MAKE_TRACK_PARTITION(confDndetaTracksItsOnly);
103105

106+
// the *Mc process functions take the ungrouped tables (no ::iterator first argument), so DPL never
107+
// auto-registers the fColId slicing cache for FemtoTracksWithLabel; this unused Preslice is the only
108+
// thing that requests/enables it, otherwise sliceByCached() throws "Disabled cache ... is requested"
109+
// once the first accepted reco collision actually reaches it
110+
o2::framework::Preslice<FemtoTracksWithLabel> perColTracksWithLabel = o2::aod::femtobase::stored::fColId;
111+
104112
// setup tracks (trigger)
105113
trackbuilder::ConfTrackSelection1 confTrackSelection1;
106114
trackhistmanager::ConfTrackBinning1 confTrackBinning1;
@@ -127,6 +135,8 @@ struct FemtoDndetaPair {
127135

128136
o2::framework::Partition<FemtoLambdas> lambdaPartition = MAKE_LAMBDA_PARTITION(confLambdaSelection);
129137
o2::framework::Partition<FemtoLambdasWithLabel> lambdaWithLabelPartition = MAKE_LAMBDA_PARTITION(confLambdaSelection);
138+
// same reason as perColTracksWithLabel above, needed by processTrackV0Mc
139+
o2::framework::Preslice<FemtoLambdasWithLabel> perColLambdasWithLabel = o2::aod::femtobase::stored::fColId;
130140

131141
// setup strangeness yields (dedicated selections, independent of the trigger)
132142
v0builder::ConfLambdaSelectionStrangeness confStrangeLambdaSelection;

‎PWGCF/Femto/Tasks/femtoDndetaTriplet.cxx‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,9 @@ struct FemtoDndetaTriplet {
8282
dndetahistmanager::ConfDndetaBinning confDndetaBinning;
8383
dndetabuilder::DndetaBuilder dndetaBuilder;
8484

85-
o2::framework::Preslice<FemtoMcParticles> perMcColParticles = o2::aod::femtomcparticle::fMcColId;
85+
// pass-through mode does not guarantee fMcColId is written in sorted order (reco-driven label
86+
// rows can be created out of mc-collision order), so this must be an unsorted grouping
87+
o2::framework::PresliceUnsorted<FemtoMcParticles> perMcColParticles = o2::aod::femtomcparticle::fMcColId;
8688

8789
// setup collisions (applied in the dndeta builder, no filter, so the cutflow sees every collision)
8890
collisionbuilder::ConfCollisionSelection collisionSelection;
@@ -103,6 +105,12 @@ struct FemtoDndetaTriplet {
103105
o2::framework::Partition<FemtoTracksWithLabel> dndetaTrackWithLabelPartitionGlobal = MAKE_TRACK_PARTITION(confDndetaTracksGlobal);
104106
o2::framework::Partition<FemtoTracksWithLabel> dndetaTrackWithLabelPartitionItsOnly = MAKE_TRACK_PARTITION(confDndetaTracksItsOnly);
105107

108+
// the *Mc process functions take the ungrouped tables (no ::iterator first argument), so DPL never
109+
// auto-registers the fColId slicing cache for FemtoTracksWithLabel; this unused Preslice is the only
110+
// thing that requests/enables it, otherwise sliceByCached() throws "Disabled cache ... is requested"
111+
// once the first accepted reco collision actually reaches it
112+
o2::framework::Preslice<FemtoTracksWithLabel> perColTracksWithLabel = o2::aod::femtobase::stored::fColId;
113+
106114
// setup tracks (trigger)
107115
trackbuilder::ConfTrackSelection1 confTrackSelection1;
108116
trackhistmanager::ConfTrackBinning1 confTrackBinning1;
@@ -135,6 +143,8 @@ struct FemtoDndetaTriplet {
135143

136144
o2::framework::Partition<FemtoLambdas> lambdaPartition = MAKE_LAMBDA_PARTITION(confLambdaSelection);
137145
o2::framework::Partition<FemtoLambdasWithLabel> lambdaWithLabelPartition = MAKE_LAMBDA_PARTITION(confLambdaSelection);
146+
// same reason as perColTracksWithLabel above, needed by processTrackTrackV0Mc
147+
o2::framework::Preslice<FemtoLambdasWithLabel> perColLambdasWithLabel = o2::aod::femtobase::stored::fColId;
138148

139149
// setup strangeness yields (dedicated selections, independent of the trigger)
140150
v0builder::ConfLambdaSelectionStrangeness confStrangeLambdaSelection;

‎PWGCF/Femto/Tasks/femtoMcParticleQa.cxx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ struct FemtoMcParticleQa {
5959
mcparticlehistmanager::McParticleHistManager<mcparticlehistmanager::PrefixMcParticle1> mcParticleHistManager1;
6060

6161
o2::framework::Partition<FemtoMcParticles> mcParticlesPartition1 = MAKE_MC_PARTICLE_PARTITION(confMcParticleSelection1);
62-
o2::framework::Preslice<FemtoMcParticles> perColReco = o2::aod::femtomcparticle::fMcColId;
62+
o2::framework::PresliceUnsorted<FemtoMcParticles> perColReco = o2::aod::femtomcparticle::fMcColId;
6363

6464
particlecleaner::ConfMcParticleCleaner1 confMcParticleCleaner1;
6565
particlecleaner::ParticleCleaner mcParticleCleaner;
@@ -83,7 +83,7 @@ struct FemtoMcParticleQa {
8383

8484
void process(FilteredFemtoMcCollision const& col, FemtoMcParticles const& /*mcParticles*/, o2::aod::FMcMothers const& mcMothers, o2::aod::FMcPartMoths const& mcPartonicMothers)
8585
{
86-
auto mcParticleSlice = mcParticlesPartition1->sliceByCached(o2::aod::femtomcparticle::fMcColId, col.globalIndex(), cache);
86+
auto mcParticleSlice = mcParticlesPartition1->sliceByCachedUnsorted(o2::aod::femtomcparticle::fMcColId, col.globalIndex(), cache);
8787
if (mcParticleSlice.size() == 0) {
8888
return;
8989
}

‎PWGCF/Femto/Tasks/femtoPairMcParticleMcParticle.cxx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ struct FemtoPairMcParticleMcParticle {
7676

7777
o2::framework::Partition<FemtoMcParticles> mcParticlesPartition2 = MAKE_MC_PARTICLE_PARTITION(confMcParticleSelection2);
7878

79-
o2::framework::Preslice<FemtoMcParticles> perColParticles = o2::aod::femtomcparticle::fMcColId;
79+
o2::framework::PresliceUnsorted<FemtoMcParticles> perColParticles = o2::aod::femtomcparticle::fMcColId;
8080

8181
// setup pairs
8282
pairhistmanager::ConfPairBinning confPairBinning;

0 commit comments

Comments
 (0)