RooDataHist with non-integer entries

Hi,

I just went through the first RooFit Examples and tried to read a histogram (TH1F) with bin entries between 0 and 1 into a RooDataHist. (Root 5.12, RooFit 2.09) RooFit complained and rounded all values to either 0 or 1. Is there an option to allow for floating point values or did I miss something else? Below I post the relevant part of the code with two examples of the error message.

Cheers,

Marco

root [16] RooRealVar hx("hx","x",0,5)
root [18] RooPlot* hxframe = hx.frame()
root [22] TH1F* h2 = (TH1F*) gDirectory->Get("h_eva")
root [23] RooDataHist acc("acc","ev-by-ev acc",hx,h2)
root [24] acc.plotOn(hxframe)
acc_plot__hx::roundBin: rounding non-integer bin contents: 0.178397
...
acc_plot__hx::roundBin: rounding non-integer bin contents: 0.000548318

[quote=“gersabec”]Hi,

I just went through the first RooFit Examples and tried to read a histogram (TH1F) with bin entries between 0 and 1 into a RooDataHist. (Root 5.12, RooFit 2.09) RooFit complained and rounded all values to either 0 or 1. Is there an option to allow for floating point values or did I miss something else? Below I post the relevant part of the code with two examples of the error message.

Cheers,

Marco

root [16] RooRealVar hx("hx","x",0,5) root [18] RooPlot* hxframe = hx.frame() root [22] TH1F* h2 = (TH1F*) gDirectory->Get("h_eva") root [23] RooDataHist acc("acc","ev-by-ev acc",hx,h2) root [24] acc.plotOn(hxframe) acc_plot__hx::roundBin: rounding non-integer bin contents: 0.178397 ... acc_plot__hx::roundBin: rounding non-integer bin contents: 0.000548318 [/quote]
I think Roofit should draw non-integer bin with acc.plotOn(hxframe, ErrorType(RooAbsData::SumW2)) instead of acc.plotOn(hxframe) in your code. But it doesn’t work and issues the same message as you. I hope RooFit developers solve this problem.
However, I found some trick from RooFit source code for drawing non-integer bin.

RooRealVar hx("hx","x",0,5);
RooPlot* hxframe = hx.frame();
TH1F* h2 = (TH1F*) gDirectory->Get("h_eva");
RooHist* graph = new RooHist(*h2, 0, 1, RooAbsData::SumW2);
hxframe->addPlotable(graph, "P");
hxframe->Draw();

Hi,

By default the histogram plotting routines of RooFit assumes histograms bins have Poisson statistics, i.e. integer numbers. If that is not the case you can override the behaviour to show the sum-of-weights errors rather than the Poisson confidence interval, which is done as follows:

acc.plotOn(hxframe,DataError(RooAbsData::SumW2)) ;

Wouter

NB: you need to do ‘using namespace RooFit’ once somewhere to make the DataError() function available in the global name space.