Skip to content

Conversation

sevmag
Copy link
Collaborator

@sevmag sevmag commented Aug 20, 2025

This PR addresses the bugs explained in #821.

Solving Issues

1. Negative visible length

set visible length to 0 if it would be negative

2. Track filtering only for top-level primaries

Look, if a track particle is in the subtree of any primary, not if the head-level primary is in the primaries list

3. Wrong return in get_bundle_HEP

return the right tuple

Additionally, I introduced the get_descendants function, which accelerates this code snippet:

e_p = np.array(
[
np.array([p.energy, p])
for p in particles
if (
(
(p.energy > min_e)
& (
frame[self.mctree].get_primary(p.id)
in primaries
)
)
& (not p.is_track)
)
]
).T

by not iterating through all particles, but only the descendants of the primaries

Copy link
Collaborator

@Aske-Rosted Aske-Rosted left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! Nice contribution, thanks.

@sevmag
Copy link
Collaborator Author

sevmag commented Aug 28, 2025

I made some more commits. They address further issues I explained in #821. Let me know if you agree, @Aske-Rosted.

@Aske-Rosted
Copy link
Collaborator

Aske-Rosted commented Aug 28, 2025

I made some more commits. They address further issues I explained in #821. Let me know if you agree, @Aske-Rosted.

I agree with the new changes as well. I also ran into the muongun issues a while back, but managed to remove them with the logic statements I had in play, guess some of the changes to the logic made them reappear...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants