Fix: Update eventsProcessed lookup for ROOT 6.38 and add fallback warning#512
Open
ShreyasBakare wants to merge 1 commit intoHEP-FCC:masterfrom
Open
Fix: Update eventsProcessed lookup for ROOT 6.38 and add fallback warning#512ShreyasBakare wants to merge 1 commit intoHEP-FCC:masterfrom
ShreyasBakare wants to merge 1 commit intoHEP-FCC:masterfrom
Conversation
- Replaced PyROOT dynamic lookup with explicit .Get() to fix AttributeError on ROOT 6.38. - Removed GetListOfKeys() loop by fetching the parameter directly. - Added LOGGER.warning to alert users if cross-section scaling falls back to the current tree's entry count.
Contributor
|
Hi @ShreyasBakare, thanks for the fix. |
kjvbrt
reviewed
Mar 19, 2026
| if events_param: | ||
| nevents_meta += events_param.GetVal() | ||
| else: | ||
| LOGGER.warning('Missing "eventsProcessed" in %s! Cross-section scaling may fall back to filtered event count.', file_name) |
Contributor
There was a problem hiding this comment.
The warning message might be a bit too much, since this will be issued for every file. Maybe a debug message would be more suitable.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR addresses an AttributeError encountered when reading metadata using the latest Key4hep stack, as reported in this FCCSW-Forum post.
The
run_histmakerfunction inpython/run_analysis.pypreviously used PyROOT's dynamic attribute lookup to check for the 'eventsProcessed'TParameter. On the newer Key4hep stack (-r 2026-02-01), which updates to ROOT 6.38, this dynamic lookup fails, leading to the following error when reading files from EOS:To resolve this incompatibility, this PR replaces the dynamic lookup
infile.eventsProcessed.GetVal()withinfile.Get("eventsProcessed").GetVal().Additional improvements in this PR:
Removed the
GetListOfKeys()loop, fetching the parameter directly.Added a
LOGGER.warning. If a user runs Stage 2 (or later) scripts on an input file missing this metadata tag (e.g., after intermediate processing withuproot), the framework will explicitly warn them that cross-section scaling will fall back to the current tree's entry count, which may artificially inflate results. As described in this FCCSW-Forum post.This change can be tested by running any Stage 2 histmaker script over EOS files (root://eosuser.cern.ch/...) on the new Key4hep stack (
-r 2026-02-01).