Skip to content

[RF] Throw when dataset has out-of-range values for the CPU eval backend - #22997

Merged
guitargeek merged 1 commit into
root-project:masterfrom
guitargeek:rf-oob-range-check-22740
Aug 6, 2026
Merged

guitargeek merged 1 commit into
root-project:masterfrom
guitargeek:rf-oob-range-check-22740

Conversation

@guitargeek

Copy link
Copy Markdown
Contributor

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.

@github-actions

github-actions Bot commented Aug 3, 2026 •

Copy link
Copy Markdown

Test Results

    23 files      23 suites   3d 17h 45m 50s ⏱️
 3 853 tests  3 852 ✅ 0 💤 1 ❌
78 505 runs  78 503 ✅ 1 💤 1 ❌

For more details on these failures, see this check.

Results for commit 4ed9b48.

♻️ This comment has been updated with latest results.

@dpiparo
dpiparo self-requested a review August 4, 2026 06:00

@dpiparo dpiparo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for these changes. The failure is unrelated.

@guitargeek
guitargeek force-pushed the rf-oob-range-check-22740 branch from f7ab6ec to e2b45b6 Compare August 5, 2026 20:56
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.
@guitargeek
guitargeek force-pushed the rf-oob-range-check-22740 branch from e2b45b6 to 4ed9b48 Compare August 5, 2026 22:12
@guitargeek
guitargeek merged commit f80b90b into root-project:master Aug 6, 2026
31 of 34 checks passed
@guitargeek
guitargeek deleted the rf-oob-range-check-22740 branch August 6, 2026 07:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[RF] Unexpected behaviour when clipping domain ranges and fitting

2 participants