RooDataHist from a TH1 odd behaviour of mean and RMS


I have a few questions about converting a TH1 (TH1D in my particular case) into a RooDataHist object.

I have a TH1D object which has been drawn from a TTree object, below,

I create a RooDataHist object with it using the constructor,

RooDataHist(const char* name, const char* title, const RooArgList& vars, const TH1* hist, Double_t initWgt = 1.0)

to give the RooDataHist below,

However, the mean of the two plots are somehow different!

Further more if I create another empty TH1D with the same binning as the first TH1D and fill it using the RooDataHist::fillHistogram method I get,

which still has the same wrong mean.

Also, if I normalise my histogram before I convert it into a RooDataHist with the following code,

h1.Sumw2() h1.Scale(1./h1.Integral())

I get,

Now both the mean and the RMS of the distributions different (greatly in the case of the RMS).

I’m a bit confused… Can you explain what is happening here?