Avoid to plot empty bins in roofit

hi all

by default in roofit empty bins are plotted with markers and error bands (ie like when in root one plots with the E0 option). is there a way to turn this feature off and have “empty” empty bins?

i’ve seen this question posted several times, but failed to find an easy solution.

thanks a lot in advance
f

do you have a small reproducer ?

sure!

i didn’t have a simple example at hand so i copy-pasted from a roofit tutorial:

#include "RooRealVar.h"
#include "RooDataSet.h"
#include "RooGaussian.h"
#include "TCanvas.h"
#include "RooPlot.h"
#include "TAxis.h"
using namespace RooFit ;


int main()
{

  RooRealVar x("x","x",-10,10) ;
  RooRealVar mean("mean","mean of gaussian",1,-10,10) ;
  RooRealVar sigma("sigma","width of gaussian",1,0.1,10) ;

  // Build gaussian p.d.f in terms of x,mean and sigma
  RooGaussian gauss("gauss","gaussian PDF",x,mean,sigma) ;

  RooDataSet* data = gauss.generate(x,100) ;

  RooPlot* xframe2 = x.frame(Title("Gaussian p.d.f. with data")) ;
  data->plotOn(xframe2) ;
  gauss.plotOn(xframe2) ;

  TCanvas* c1 = new TCanvas("c1", "c1", 600, 600);
  c1->cd();

  xframe2->Draw();

  c1->SaveAs("test.eps");

  return 0;

}

this produces test.eps, which has a lot of empty bins with markers and error bars:

[attachment=0]Screenshot 2016-02-24 10.35.20.png[/attachment]

thanks
f


Roofit has its own way of managing options. Saving your plot to a .C file I saw that the error bars are not produced using an histogram. Therefore the E0 you are looking for option is not active.
They are produced using a TGraphAsymError.
The error drawing options https://root.cern.ch/doc/master/classTGraphPainter.html#GP03 for graphs do not have that possibility. Which, if you think in term of graph, is normal.

yolo