Skip to content

Conversation

@guitargeek
Copy link
Contributor

After a8ef8b0, when plotting an extended pdf it automatically scales
itself to the number of expected events.

However, when plotting slices of a RooSimultaneous, the normalization is
already precomputed in RooSimultanous::plotOn() and should not be
overridden again. To prevent this, flag the calculated normatization as
the final number of events, and not some relative factor, which it is by
default.

Closes #20383.

The tutorials are also updated to use less confusing statements to plot slices of the RooSimultaneous.

@VanyaBelyaev, is that okay for you now?

After a8ef8b0, when plotting an extended pdf it automatically scales
itself to the number of expected events.

However, when plotting slices of a RooSimultaneous, the normalization is
already precomputed in `RooSimultanous::plotOn()` and should not be
overridden again. To prevent this, flag the calculated normatization as
the final number of events, and not some relative factor, which it is by
default.

Closes root-project#20383.
It greatly helps debugging if the error message tells you which objects
are actually existing.
In the documentation of the RooSimultaneous, it says about the
`ProjWData()` argument:

> For observables present in given dataset projection of PDF is achieved
  by constructing an average over all observable values in given set.

And about `Slice()`, it says:

> Override default projection behaviour by omitting the specified
  category observable from the projection, i.e., by not integrating over
  all states of this category.

Starting from this explanation, it is highly unintuitive that one should
do things like `simPdf.plotOn(Slice(sample, "state"), ProjWData(same))` when
plotting the pdf of state `"state"` from a RooSimultaneous.

I think that instead, we should promote easy patterns in the tutorials.

That is, if you want to plot a slice pdf from a RooSimultaneous, you are
retreiving it with `getPdf()` and then plot it. The result is the same.
@github-actions
Copy link

github-actions bot commented Dec 3, 2025

Test Results

    22 files      22 suites   4d 2h 17m 20s ⏱️
 3 785 tests  3 785 ✅ 0 💤 0 ❌
81 252 runs  81 252 ✅ 0 💤 0 ❌

Results for commit 2517b0b.

@VanyaBelyaev
Copy link

Dear @guitargeek
Thank you for the fix!
As soon as it propagates to the LCG-de3 nightly slot, I'll be happy to test it in my working environment and to report the results.

And I like a lot significantly simplified "interface" without Slice&ProjWData.
It always was rather non-intuitive and partly confusing
It is nice to know better alternative exists. It will take some time to
update all my code for new model, but definitely it is a step in right direction.

@ferdymercury
Copy link
Collaborator

@guitargeek does this PR also clarify/close https://its.cern.ch/jira/browse/ROOT-7499 ?

@guitargeek
Copy link
Contributor Author

@guitargeek does this PR also clarify/close https://its.cern.ch/jira/browse/ROOT-7499 ?

No. But I have created another PR for that:

@guitargeek
Copy link
Contributor Author

And I like a lot significantly simplified "interface" without Slice&ProjWData.

Just to be clear: the simplified interface is not new. Plotting the slices as I suggest now has always worked in RooFit, and I'm just changing the tutorials to use simpler patterns 🙂 Why the plot command in the tutorial was so convoluted is not clear to me.

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.

[RF] Broken rf501_simultaneouspdf.py in dev3/nighlies

3 participants