ProjWData behaviour in RooAddPdf

Hello,

I am trying to make what I think is a simple toy:

signal: gaussian in x with per-event resolution dx
background: some polynomial, does not care about dx

When I generate and plot with the signal model only, using ProjWData to average over dx, things work as expected.

When I make a RooAddPdf of the signal+background, then generate and plot using ProjWData in the same way, my data and model disagree. The disagreement looks like the kind you normally get when accidentally integrating a per-event observable instead of averaging.

I attached a quick script to show the problem.

Maybe this is a “logical problem” rather than a root problem. If so, how do I construct a signal+background model in this fashion, where the signal pdf depends on some per-event observable, but the background does not at all?
conditional.cxx (2 KB)

Did you find a solution to this issue ?

Hello,

I am reviving this thread as I have ran into the same problem again, which I think is a root bug.

If you run the script attached to the previous post, the printout is as follows:

[quote]
[#1] INFO:Plotting – RooAbsReal::plotOn(sg_x) plot on x averages using data variables (dx)
[#1] INFO:Plotting – RooAbsReal::plotOn(sg_x) only the following components of the projection data will be used: (dx)
[#1] INFO:Plotting – RooDataWeightedAverage::ctor(sg_xDataWgtAvg) constructing data weighted average of function sg_x_Norm[x] over 1000 data points of (dx) with a total weight of 1000
…[/quote]
This is the projection of the signal model only… so far ok. I bolded one section for emphasis to compare to the following:

Is this a bug? I specifically ask to average over dx in the projection, not integrate. There is no pdf for dx specified, what I try to plot is

S(x|dx) + B(x)

(individually plotting S(x|dx) and B(x), both using ProjWData to average over dx, produce reasonable results)

HI,
Probably the integral is computed when evaluating the pdf. Since this is a pdf, it needs to be normalised

Lorenzo