Two dimensional pullhist using RooFit

Hi all,

I am performing a 2D fit in RooFit and would like to use a two-dimensional pullhist to assess the quality of the fit.
For a 1D fit this is rather simple. But for a 2D hist I get some problems with the scaling.
Using createHistogram I was able to create a TH2 of both, the fit function and the fitted data. In a first step I wanted to subtract them from each other. But here I already encounter a problem with the scaling of the fit function … it doesn’t match data. Btw. this is also the case for 1D plots, plotting the fit function w/o data shows a completely different scale.
So, long story short: How can I get the correct scaling when plotting the fit function only? Or did someone this 2D pullhist already?

Cheers and Thanks,

Torsten

So here is a quick follow-up. I suppose this problem is related to the overall normalization of the fit function when plotting. I reduced the problem to a 1D fit. The minimal code example is as follows

RooRealVar x("x","x", -10.,10.)
RooRealVar mu("mu","mu", 0.,-1.,1.)
RooRealVar s("s","s", 1.,0.,5.)
RooGaussian gauss("gauss","gauss",x,mu,s)
RooDataSet *data = gauss.generate(x,100)
RooRealVar N("N","N",1.,0.,10.)
RooExtendPdf pdf("pdf","pdf",gauss,N)
pdf.fitTo(*data,RooFit::Extended(),RooFit::Save())
RooPlot* frame = x.frame()
data->plotOn(frame)
pdf->plotOn(frame)
frame->Draw()

The fit is successful and the resulting plot is


What I would have expected is that the drawn pdf would show that the signal yield is wrong. I get the same result when I constrain the signal yield N to values larger 1000, the fit is successful and the plot looks fine.
Is that an intended behavior? Am I doing something wrong here?

Cheers and Thanks,

Torsten