[RF] Throw when dataset has out-of-range values for the CPU eval backend - #22997
Open
guitargeek wants to merge 1 commit into
Open
[RF] Throw when dataset has out-of-range values for the CPU eval backend#22997guitargeek wants to merge 1 commit into
guitargeek wants to merge 1 commit into
Conversation
If an observable's range is shrunk after a dataset was already filled, the dataset's internal clone of the observable keeps the old, wider range metadata, decoupled from the live variable used by the pdf. The new vectorizing evaluation backends (EvalBackend::Cpu and friends) would then silently evaluate/normalize the likelihood over the shrunken range while still including the now out-of-range data points, biasing the fit without any warning. Add a check in RooEvaluatorWrapper::setData() that scans the data spans for each observable of the pdf (handling RooSimultaneous by looking at the "__obs__"-tagged, per-channel-prefixed clones) and throws a descriptive std::runtime_error if any value falls outside of the observable's current range. The check is skipped when a named range is explicitly passed to the fit, since out-of-range events are then intentionally and consistently dropped by RooFit::BatchModeDataHelpers::getDataSpans(). The error message points users at the correct fix: define a named range with setRange() and pass it via RooFit::Range() instead of shrinking the observable itself. Fixes root-project#22740 🤖 Done with the help of AI.
Test Results 23 files 23 suites 3d 12h 15m 16s ⏱️ For more details on these failures, see this check. Results for commit f7ab6ec. |
dpiparo
self-requested a review
August 4, 2026 06:00
dpiparo
approved these changes
Aug 4, 2026
dpiparo
left a comment
Member
There was a problem hiding this comment.
Thanks for these changes. The failure is unrelated.
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.
If an observable's range is shrunk after a dataset was already filled, the dataset's internal clone of the observable keeps the old, wider range metadata, decoupled from the live variable used by the pdf. The new vectorizing evaluation backends (EvalBackend::Cpu and friends) would then silently evaluate/normalize the likelihood over the shrunken range while still including the now out-of-range data points, biasing the fit without any warning.
Add a check in RooEvaluatorWrapper::setData() that scans the data spans for each observable of the pdf (handling RooSimultaneous by looking at the "obs"-tagged, per-channel-prefixed clones) and throws a descriptive std::runtime_error if any value falls outside of the observable's current range. The check is skipped when a named range is explicitly passed to the fit, since out-of-range events are then intentionally and consistently dropped by
RooFit::BatchModeDataHelpers::getDataSpans(). The error message points users at the correct fix: define a named range with setRange() and pass it via RooFit::Range() instead of shrinking the observable itself.
Fixes #22740
🤖 Done with the help of AI.