Skip to content

Commit 44a519f

Browse files
committed
[PWGLF] Modify getFirstAncestor to return the first physical primary in the ancestry chain
1 parent 429d545 commit 44a519f

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

PWGLF/Tasks/Nuspex/antinucleiInJets.cxx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -505,12 +505,23 @@ struct AntinucleiInJets {
505505
{
506506
auto current = particle;
507507

508+
// If already physical primary, return it
509+
if (current.isPhysicalPrimary())
510+
return current;
511+
508512
while (current.has_mothers()) {
509513
auto motherId = current.mothersIds()[0];
514+
515+
// Stop if motherId is invalid
510516
if (motherId < 0 || motherId >= mcParticles.size()) {
511517
break;
512518
}
519+
520+
// Move up the chain
513521
current = mcParticles.iteratorAt(motherId);
522+
523+
if (current.isPhysicalPrimary())
524+
break;
514525
}
515526

516527
return current;

0 commit comments

Comments
 (0)