Skip to content

Commit 217e22a

Browse files
authored
Fix the sliceby issue
1 parent 7fb86c0 commit 217e22a

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

PWGHF/TableProducer/treeCreatorToXiPi.cxx

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,10 @@ DECLARE_SOA_TABLE(HfToXiPiEvs, "AOD", "HFTOXIPIEV",
177177
full::CentFDDM,
178178
full::MultZeqNTracksPV);
179179

180+
DECLARE_SOA_TABLE(HfToXiPiCollId, "AOD", "HFTOXIPICOLLID",
181+
full::CollisionId);
182+
180183
DECLARE_SOA_TABLE(HfToXiPiFulls, "AOD", "HFTOXIPIFULL",
181-
full::CollisionId,
182184
full::XPv, full::YPv, full::ZPv, collision::NumContrib, collision::Chi2,
183185
full::XDecayVtxCharmBaryon, full::YDecayVtxCharmBaryon, full::ZDecayVtxCharmBaryon,
184186
full::XDecayVtxCascade, full::YDecayVtxCascade, full::ZDecayVtxCascade,
@@ -245,8 +247,10 @@ struct HfTreeCreatorToXiPi {
245247
Produces<o2::aod::HfToXiPiFulls> rowCandidateFull;
246248
Produces<o2::aod::HfToXiPiLites> rowCandidateLite;
247249
Produces<o2::aod::HfToXiPiEvs> rowEv;
250+
Produces<o2::aod::HfToXiPiCollId> rowCollisionId;
248251

249252
Configurable<float> zPvCut{"zPvCut", 10., "Cut on absolute value of primary vertex z coordinate"};
253+
Configurable<bool> fillCollIdTable{"fillCollIdTable", false, "Fill a single-column table with collision index"};
250254

251255
SliceCache cache;
252256

@@ -413,6 +417,12 @@ struct HfTreeCreatorToXiPi {
413417
debugMc,
414418
originMc,
415419
collisionMatched);
420+
421+
if (fillCollIdTable) {
422+
/// save also candidate collision indices
423+
rowCollisionId(
424+
rowEv.lastIndex());
425+
}
416426
}
417427

418428
template <typename T>
@@ -517,12 +527,14 @@ struct HfTreeCreatorToXiPi {
517527
rowEv.reserve(collisions.size());
518528
for (const auto& collision : collisions) {
519529
auto thisCollId = collision.globalIndex();
520-
auto groupedXicCandidates = candidates.sliceBy(candXicPerCollision, thisCollId);
530+
auto groupedXicCandidates = candidates.sliceByCached(aod::hf_cand_xic0_omegac0::collisionId, thisCollId, cache); // FIXME
521531
auto sizeTableCand = groupedXicCandidates.size();
522532
fillEvent<true>(collision, zPvCut);
523533

524534
// Filling candidate properties
525535
rowCandidateFull.reserve(sizeTableCand);
536+
rowCollisionId.reserve(sizeTableCand);
537+
LOGF(debug, "Filling rec. collision %d at derived index %d", thisCollId, rowEv.lastIndex() + 1);
526538
for (const auto& candidate : groupedXicCandidates) {
527539
fillCandidate(candidate, -7, -7, RecoDecay::OriginType::None, false);
528540
}
@@ -554,12 +566,13 @@ struct HfTreeCreatorToXiPi {
554566
rowEv.reserve(collisions.size());
555567
for (const auto& collision : collisions) {
556568
auto thisCollId = collision.globalIndex();
557-
auto groupedXicCandidates = candidates.sliceBy(candXicPerCollision, thisCollId);
569+
auto groupedXicCandidates = candidates.sliceByCached(aod::hf_cand_xic0_omegac0::collisionId, thisCollId, cache); // FIXME
558570
auto sizeTableCand = groupedXicCandidates.size();
559571
fillEvent<true>(collision, zPvCut);
560572

561573
// Filling candidate properties
562574
rowCandidateFull.reserve(sizeTableCand);
575+
rowCollisionId.reserve(sizeTableCand);
563576
for (const auto& candidate : groupedXicCandidates) {
564577
fillCandidate(candidate, candidate.flagMcMatchRec(), candidate.debugMcRec(), candidate.originRec(), candidate.collisionMatched());
565578
}

0 commit comments

Comments
 (0)