Skip to content

[RF] Don't wrap jointly normalized RooProdPdf factors for normalization - #24039

Open
guitargeek wants to merge 1 commit into
root-project:masterfrom
guitargeek:roofit-prodpdf-jointly-normalized-factors
Open

guitargeek wants to merge 1 commit into
root-project:masterfrom
guitargeek:roofit-prodpdf-jointly-normalized-factors

Conversation

@guitargeek

@guitargeek guitargeek commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Part of the final CPU backend bugfixes before the legacy NLL backend removal

Factors of a RooProdPdf with overlapping normalization observables are normalized together by a RooGenProdProj. RooProdPdf::compileForNormSet() now creates the computation graph of the RooFixedProdPdf from a shallow clone of the product where these factors are unwrapped from their RooNormalizedPdf, so the RooGenProdProj integrates the unnormalized pdfs like the scalar evaluation. The RooFixedProdPdf still forwards analytical integrals to the product with the wrapped pdfs: with the unwrapped ones, these integrals would not match its normalized value, which breaks nested products.

This fixes two problems with the wrapped pdfs:

  • The RooGenProdProj clones its pdfs, and the clone of a RooNormalizedPdf owns a copy of its normalization integral, which the RooFit::Evaluator doesn't keep up to date. If the normalization depends on an observable, for example for a pdf conditional on it, the likelihood in the new test was wrong by 36 %.

  • Integrals of normalized pdfs are smaller, so the absolute tolerance of the numerical integration costs more precision. For the rf305_condcorrprod model of the HS3 test suite, the relative error of 1e-6 exceeded the tolerance of the suite.

The new test requires agreement with the scalar evaluation to 1e-10.

🤖 Done with the help of AI

Factors of a RooProdPdf with overlapping normalization observables are
normalized together by a RooGenProdProj. RooProdPdf::compileForNormSet()
now creates the computation graph of the RooFixedProdPdf from a shallow
clone of the product where these factors are unwrapped from their
RooNormalizedPdf, so the RooGenProdProj integrates the unnormalized pdfs
like the scalar evaluation. The RooFixedProdPdf still forwards
analytical integrals to the product with the wrapped pdfs: with the
unwrapped ones, these integrals would not match its normalized value,
which breaks nested products.

This fixes two problems with the wrapped pdfs:

  * The RooGenProdProj clones its pdfs, and the clone of a
    RooNormalizedPdf owns a copy of its normalization integral, which
    the RooFit::Evaluator doesn't keep up to date. If the normalization
    depends on an observable, for example for a pdf conditional on it,
    the likelihood in the new test was wrong by 36 %.

  * Integrals of normalized pdfs are smaller, so the absolute tolerance
    of the numerical integration costs more precision. For the
    rf305_condcorrprod model of the HS3 test suite, the relative error
    of 1e-6 exceeded the tolerance of the suite.

The new test requires agreement with the scalar evaluation to 1e-10.

🤖 Done with the help of AI
@github-actions

github-actions Bot commented Nov 7, 2026

Copy link
Copy Markdown

Test Results

    22 files      22 suites   3d 15h 17m 25s ⏱️
 3 881 tests  3 880 ✅ 0 💤 1 ❌
76 015 runs  76 014 ✅ 0 💤 1 ❌

For more details on these failures, see this check.

Results for commit 550a9bd.

This branch has not been deployed

No deployments
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.

1 participant