Skip to content

[RF] Avoid RooAbsPdf::expectedEvents() calls in RooAddPdf::doEval()#21620

Merged
guitargeek merged 3 commits intoroot-project:masterfrom
guitargeek:addpdf_1
Mar 17, 2026
Merged

[RF] Avoid RooAbsPdf::expectedEvents() calls in RooAddPdf::doEval()#21620
guitargeek merged 3 commits intoroot-project:masterfrom
guitargeek:addpdf_1

Conversation

@guitargeek
Copy link
Contributor

@guitargeek guitargeek commented Mar 16, 2026

When evaluating pdfs with RooAbsReal::doEval() in the new RooFit evaluation backend, we have to avoid calling back into the old code paths that use getVal(). One place where this still happened was the RooAbsPdf, under the condition that that the coefficients represent expected numbers of events. It would call RooAbsPdf::expectedEvents() when updating the coefficients, which uses getVal().

Instead, the coefficients need to be replaced with RooAbsReals that represent the expected numbers of events, to fully expose this in the computation graph. Like this, we don't have to rely on the legacy "dirty state propagation" that is important for the getVal() code path.

A second commit in this PR avoids some name collisions of RooFit object in the new extended computation graph, and a third commit is about implementing the copy assignment for the RooAICRegistry class correctly, which is now hit.

@guitargeek guitargeek requested a review from lmoneta March 16, 2026 15:58
@guitargeek guitargeek self-assigned this Mar 16, 2026
Rule of five: if the copy constructor and destructor are implemented,
one also has to implement copy assignment, and the move constructor and
operator. The copy assignment here should mimic the copy constructor,
and the move assignment and constructor can be the default (although
it's good practive to make this explicit the make clear the intent).
This avoids name collisions of objects that are semantically different
but have the same name.
When evaluating pdfs with `RooAbsReal::doEval()` in the new RooFit
evaluation backend, we have to avoid calling back into the old code
paths that use `getVal()`. One place where this still happened was the
RooAbsPdf, under the condition that that the coefficients represent
expected numbers of events. It would call
`RooAbsPdf::expectedEvents()` when updating the coefficients, which uses
`getVal()`.

Instead, the coefficients need to be replaced with RooAbsReals that
represent the expected numbers of events, to fully expose this in the
computation graph. Like this, we don't have to rely on the legacy "dirty
state propagation" that is important for the `getVal()` code path.
Copy link
Member

@lmoneta lmoneta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@github-actions
Copy link

Test Results

    22 files      22 suites   3d 2h 12m 10s ⏱️
 3 810 tests  3 809 ✅ 1 💤 0 ❌
75 622 runs  75 613 ✅ 9 💤 0 ❌

Results for commit 3419e65.

@guitargeek guitargeek merged commit 4ebe103 into root-project:master Mar 17, 2026
29 of 30 checks passed
@guitargeek guitargeek deleted the addpdf_1 branch March 17, 2026 05:54
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.

2 participants