I am trying to plot data points into a binned histogram using RooPlot. Some bins are empty and error bars in these bins seems to give wrong error bars (1.2 instead of 1.8 ). I tried passing DataError(RooAbsData::Poisson) option, but no luck. Is there any way to manually enter errors in these bins?
Please find minimum example below.
You cannot do it manually easily. The only way to do it I think is to extract the RooCurve and modify it by hand. It is a TGraphAsymmErrors so you can change the point errors using SetPointError.
if(!RooHistError::instance().getPoissonInterval(Int_t(n),ym,yp,_nSigma)) {
coutE(Plotting) << "RooHist::addBin: unable to add bin with " << n << " events" << endl;
return;}
Also added necessary headers into same file to be safe.
Then, compile and run. It should give you “correct” errors for zero entries (1.8 instead of 1.2). Call your dataSet with either Poisson or Idle. it worked for me same as my data is unweighted…
dataSet.plotOn(framex,Name(“dataX”));
or
dataSet.plotOn(framex,Name(“dataX”),DataError(RooAbsData::Poisson));