Skip to content

[RF] Compute global correlations of external covariance matrices lazily - #23875

Merged
dpiparo merged 1 commit into
root-project:masterfrom
guitargeek:lazy-global-corr
Oct 28, 2026
Merged

dpiparo merged 1 commit into
root-project:masterfrom
guitargeek:lazy-global-corr

Conversation

@guitargeek

Copy link
Copy Markdown
Contributor

Since bd0a3eb, RooFitResult::setCovarianceMatrix() inverted the correlation matrix right away to derive the global correlation coefficients, and warned when the matrix was singular. This produced spurious warnings in xRooFit, which legitimately builds placeholder covariance matrices for parameter snapshots: a diagonal matrix with the current parameter errors, which is singular as soon as one parameter has no error, as is the usual pre-fit state when drawing from a workspace. The coefficients are derived data that nothing consumes unless the user asks for them, so there is no reason to pay for the inversion, or to complain about it, at the time the matrix is set.

Move the computation into a new RooFitResult::fillGlobalCorr() helper that runs on demand from the globalCorr() accessors, printMultiline() and isIdentical(). For a singular matrix the coefficients are set to zero and the warning is emitted once, at the point where they are actually requested. The _GC member becomes mutable so the const accessors can fill it.

🤖 Done with the help of AI

FYI @TomasDado, this should silence the harmless errors when using xRooFit

Since bd0a3eb, RooFitResult::setCovarianceMatrix() inverted the
correlation matrix right away to derive the global correlation
coefficients, and warned when the matrix was singular. This produced
spurious warnings in xRooFit, which legitimately builds placeholder
covariance matrices for parameter snapshots: a diagonal matrix with the
current parameter errors, which is singular as soon as one parameter has
no error, as is the usual pre-fit state when drawing from a workspace.
The coefficients are derived data that nothing consumes unless the user
asks for them, so there is no reason to pay for the inversion, or to
complain about it, at the time the matrix is set.

Move the computation into a new RooFitResult::fillGlobalCorr() helper
that runs on demand from the globalCorr() accessors, printMultiline()
and isIdentical(). For a singular matrix the coefficients are set to
zero and the warning is emitted once, at the point where they are
actually requested. The _GC member becomes mutable so the const
accessors can fill it.

🤖 Done with the help of AI
@guitargeek guitargeek added this to the 6.42.00-rc1 milestone Oct 28, 2026
@guitargeek
guitargeek requested a review from dpiparo October 28, 2026 09:53
@guitargeek guitargeek self-assigned this Oct 28, 2026
@guitargeek guitargeek added in:RooFit experiment Affects an experiment / reported by its software & computimng experts labels Oct 28, 2026
@guitargeek
guitargeek requested a review from hageboeck as a code owner October 28, 2026 09:53
@github-actions

Copy link
Copy Markdown

Test Results

    24 files      24 suites   3d 21h 34m 0s ⏱️
 3 900 tests  3 900 ✅ 0 💤 0 ❌
83 501 runs  83 501 ✅ 0 💤 0 ❌

Results for commit 61683ab.

@dpiparo
dpiparo merged commit 8d180c2 into root-project:master Oct 28, 2026
43 of 44 checks passed
@guitargeek
guitargeek deleted the lazy-global-corr branch October 28, 2026 18:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI-Assisted experiment Affects an experiment / reported by its software & computimng experts in:RooFit

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants