RooPlot normalization with variable binning

Hi,

I have a RooHistPdf with variable binning which I am plotting with data that has the same variable binning. The code that does the important plotting is shown below. In the attached plot you can clearly see that the normalization is wrong. I’m pretty sure that this is only a normalization problem in the plotting. I have done same using uniform binning and the fit values are essentially unchanged and the plot looks look just fine. How do I get the plotting to do the right thing?

Thanks,
Jake

RooAbsBinning& plotBins = var->getBinning(“plotBinning”);
var->setBinning(plotBins);
RooPlot * sframe = var->frame();
data->plotOn(sframe, RooFit::DataError(errorType_),
RooFit::Binning(plotBins),
RooFit::Name(“h_data”),
RooFit::Invisible());

totalPdf->plotOn(sframe,ProjWData(*data), DrawOption(“LF”), FillStyle(1001),
FillColor(kOrange), LineColor(kOrange), Name(“h_total”),
VLines(), Range(“RangeForPlot”));

data->plotOn(sframe, RooFit::DataError(errorType_), Name(“theData”),
RooFit::Binning(plotBins));