Skip to content

fix: get_event_tree reject legal unique tree in sub-dir - #26

Merged
mrzimu merged 2 commits into
mainfrom
fix/get-event-tree
Nov 10, 2026
Merged

mrzimu merged 2 commits into
mainfrom
fix/get-event-tree

Conversation

@mrzimu

@mrzimu mrzimu commented Nov 10, 2026

Copy link
Copy Markdown
Owner

This pull request refactors the logic for selecting valid event trees in the assemble_event function and improves the robustness of the get_event_tree function. The main changes simplify tree selection, avoid unsupported event types, and make the code more maintainable.

Event tree selection and filtering improvements:

  • Refactored get_event_tree to return None instead of raising an error when the expected number of trees is not found, and to skip trees whose names end with "Header" or whose "m_event" field has a streamer type of "JM::SmartRef".
  • Updated assemble_event to:
    • Skip the /Event/Gen path, which is not supported.
    • Collect only valid event trees using the updated get_event_tree logic, and process only those trees, improving overall robustness and clarity.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

A critical indexing bug can associate trees with the wrong paths and event data when entries are filtered or missing, causing incorrect results until the index-to-tree relationship is preserved.

1 open issue
What changed in this PR

Refactors JUNO event-tree discovery and assembly to tolerate missing or unsupported sub-event trees while excluding unsupported event data.

Changes:

  • Makes get_event_tree return None when no suitable event tree is found.
  • Skips header trees and trees containing JM::SmartRef event branches.
  • Excludes /Event/Gen and collects valid trees before assembling event arrays.
File Description
pyjuno/​junoio.py Updates event-tree selection and assembly to filter unsupported or missing trees before processing event data.

Review effort: Lite

Comment thread pyjuno/junoio.py Resolved
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@mrzimu
mrzimu merged commit 61b1139 into main Nov 10, 2026
19 checks passed
@mrzimu
mrzimu deleted the fix/get-event-tree branch November 10, 2026 19:51
@mrzimu mrzimu added the fix label Nov 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants