[RooFit] Problem with weighted entries in a dataset

Hello all,
I’m having a problem when attempting to fit a dataset with weights. I’m taking events from an ntuple, which contains a branch with a different weight value for each entry. My problem is that my dataset doesn’t seem to be using the weights at all, and I’m not sure why. The shape of my data remains the same, no matter what I try to do with the weights.

I read on some other topics that previous versions of ROOT had problems with weights in cloned datasets, but I was under the impression that they had been fixed. The only other explanation I can think of is that there’s something wrong with my script. However, since it runs just fine and produces graphs, I can’t figure out where said problem is.

I’ve attached my script and an example of a graph that it produces. The shape of this graph remains exactly the same, even if I force the weights to be a certain value…

Any help would be enormously appreciated!

1.pdf (22.8 KB)
Fit_weights.cc (4.83 KB)


I cannot run your script because I don;t have the data. However I see you did not add the weight in the dataset., when filling it with the tree value. In


You should add the weight and do:


Best Regards