[6.40] [RF] Fix fractions in expectedEvents for normed RooAddPdf components - #23517
Merged
guitargeek merged 1 commit intoSep 27, 2026
Merged
guitargeek merged 1 commit into
guitargeek merged 1 commit into
Conversation
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)
Test Results 22 files 22 suites 3d 9h 17m 47s ⏱️ Results for commit 9f85e80. |
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.
Backport of #23513, requested by @guitargeek.