Skip to content

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

Open
guitargeek wants to merge 1 commit into
root-project:masterfrom
guitargeek:rf-oob-range-check-22740
Open

[RF] Throw when dataset has out-of-range values for the CPU eval backend#22997
guitargeek wants to merge 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.

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.
@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown

Test Results

    23 files      23 suites   3d 12h 15m 16s ⏱️
 3 856 tests  3 855 ✅ 0 💤 1 ❌
78 544 runs  78 543 ✅ 0 💤 1 ❌

For more details on these failures, see this check.

Results for commit f7ab6ec.

@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.

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