How to have properly weighted error bar from a weighted RooDataset

Hi ROOT expert,

For the purpose of my analysis I have to work on invariant mass distributions, I have to use a huge statistic of exclusive simulated events, and then rescale them w.r.t. the expected number of event of each decay used. To do that I create a weighted RooDataset from numpy arrays (of mass and weights) with the ROOT.RooDataSet.from_numpy method :

sigbkg_mass = ROOT.RooDataSet.from_numpy(data={"mass": npsigbkgmass, "weight": npsigbkgweight}, variables=[mass, weight], weight_name="weight")

When I do that my points are well scaled but the error bars are very little as you can see in total_fit_result.pdf.

Do you know how can I obtain proper error bar for my weighted RooDataset ?

For now what I do to have plot with proper error bar is to generate a Toy from the fit, it works properly for that as you can see in fit_toy.pdf, but because of the toy generation and the small stat the shape can vary a lot.

Thank you in advance.

20-3_fit_toy.pdf (17,9 Ko)
20-3_total_fit_result.pdf (18,2 Ko)


Please read tips for efficient and successful posting and posting code

ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided


Hi!

Did you use the SumW2 option for RooDataSet::plotOn()?

E.g.:

data.plotOn(frame, DataError="SumW2")

Like this, it should correctly get the error from the sum of weights squared in each bin.

Hi Jonas, thanks for your answer.
Unfortunately doing

sigbkg_mass.plotOn(Mframe, DataError="SumW2")

at the moment to plot my data in a canvas change nothing, my y error bars are still very small.

But in the same time I tried with Poisson as DataError and this time it gives me
20-3_total_fit_result.pdf (18,3 Ko)
which looks nice !

Is it possible that because of small weights the sumW2 scaling leads to small error bar ?

On the other hand is that ok to go with a DataError=“Poisson” on weighted data ?