pullHist only uses upper range

If one plots a pdf in specific ranges and then makes a pull histogram, only the upper range is included. Reproducer below.


import ROOT as r

ws = r.RooWorkspace("workspace")
x = ws.factory("x[-10, 10]")
x.setRange("lo", -10, -5)
x.setRange("hi", 5, 10)
pdf = ws.factory("Gaussian::pdf(x, m1[0], s1[3])")
ds = pdf.generate(r.RooArgSet(x), 1000)

fr = x.frame()
ds.plotOn(fr)
pdf.plotOn(fr, r.RooFit.Range("lo,hi"))
pull = fr.pullHist()

c = r.TCanvas()
fr2 = x.frame()
fr2.addPlotable(pull, "P")
fr2.Draw()
c.SaveAs("output.pdf")

output.pdf (14.9 KB)

Hi,
The problem is that when you have separate range two RooCurve objects represent the pdf in the two range. The RooCurve’s have the same name so you cannot retrieve both of them and only the last one is used for drawing.
I will open a GitHub issue on this
Thank you for reporting this problem.

Lorenzo

See [RF] RooPlot::pullHist only uses upper range · Issue #9741 · root-project/root · GitHub

A PR was opened to fix this problem in ROOT 6.28: