Skip to content

[6.40] [RF] Fix fractions in expectedEvents for normed RooAddPdf components - #23517

Merged
guitargeek merged 1 commit into
root-project:v6-40-00-patchesfrom
root-project-bot:BP_6.40_pull_23513
Sep 27, 2026
Merged

guitargeek merged 1 commit into
root-project:v6-40-00-patchesfrom
root-project-bot:BP_6.40_pull_23513

Conversation

@root-project-bot

Copy link
Copy Markdown

Backport of #23513, requested by @guitargeek.

In RooAddPdf::createExpectedEventsFunc(), the range fractions for the
extended likelihood term were computed via 1/(integral of the component
pdf over the full default range). This only yields the fraction of the
component inside the norm range if the component is normalized over
the full default range.

That assumption is violated in the new evaluation backend, where pdfs
are compiled with arbitrary internal normalization. For example, a
RooProdPdf might have each factor normalized over the per-observable
union of the fit ranges, which for disjoint multi-dimensional ranges
is not the full default range. The extended likelihood term then used
wrong expected events and produced wrong fitted yields, e.g. for the
product of two Gaussians fitted over eight sideband boxes in two
observables, where the Gaussian product got a range fraction of 1.0
instead of ~0.089.

Instead, multiply each coefficient with the ratio of two integrals of
the same component: numerator over the norm range, denominator over
the coefficient reference range (full default range by default, or the
range fixed by selectNormalizationRange(), e.g. via the SumCoefRange
fit option). Any constant normalization cancels in the ratio, matching
the RooAddPdf::expectedEvents() semantics used by the legacy backend.

The new C++ unit test covers an extended fit of a Gaussian product
plus uniform background in eight 2D sideband ranges, with reference
values computed with plain math (erf and logarithms) instead of the
legacy backend.

Closes root-project#23512.

🤖 Done with the help of AI

(cherry picked from commit 7b50e59)
@github-actions

Copy link
Copy Markdown

Test Results

    22 files      22 suites   3d 9h 17m 47s ⏱️
 3 875 tests  3 875 ✅ 0 💤 0 ❌
77 355 runs  77 355 ✅ 0 💤 0 ❌

Results for commit 9f85e80.

@guitargeek
guitargeek merged commit c4a1c1a into root-project:v6-40-00-patches Sep 27, 2026
41 checks passed
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.

3 participants