Skip to content

Add a unit test for isFromRadDecay and fix its ancestry walk - #15675

Open
sawenzel wants to merge 1 commit into
AliceO2Group:devfrom
sawenzel:fix-isFromRadDecay-ancestry-walk
Open

Add a unit test for isFromRadDecay and fix its ancestry walk#15675
sawenzel wants to merge 1 commit into
AliceO2Group:devfrom
sawenzel:fix-isFromRadDecay-ancestry-walk

Conversation

@sawenzel

Copy link
Copy Markdown
Collaborator

This PR adds a unit test and fixes two bugs in the isFromRadDecay query introduced in #15470.

  • New test case in testStack.cxx — builds a small stack with a radioactive decay as the first secondary of its primary. Four of its checks fail on dev today.
  • Primaries wrongly returned truemTrackIDtoParticlesEntry is meaningless for a primary, since primaries never enter mParticles, so the lookup landed on an unrelated secondary.
  • Descendants of a radioactive decay wrongly returned falsewhile (imo > 0) skipped buffer entry 0, which after FinishPrimary() is the first secondary of the current primary.
  • Fix: walk trackIDs, stop at mNumberOfPrimaryParticles — the same primary test selectTracks() uses, so the mapping is never consulted for a primary.
  • Const correctness, reference-vs-copy, and include fixes.

The query added in AliceO2Group#15470 gave two wrong answers. Primaries returned true,
because mTrackIDtoParticlesEntry is meaningless for them - primaries never
enter mParticles - so the lookup landed on an unrelated secondary. Descendants
of a radioactive decay returned false, because the `imo > 0` guard skipped
buffer entry 0, which after FinishPrimary() is the first secondary of the
current primary.

Walking trackIDs and stopping at mNumberOfPrimaryParticles removes both, and
the method becomes const, binds a reference instead of copying the MCTrack, and
drops the two includes MCTrack.h already provides. The new test case fails on
all four affected checks without this change.
@sawenzel
sawenzel requested a review from shahor02 as a code owner August 10, 2026 13:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant