I am seeing a weird behavoir in RooDataHist and I want to make sure I am not doing something wrong. I am using RooFit to take a TH1 histogram, fit it and then do some stat studies. Because I am getting unexpected results, I started looking into the smallest details of my code.
In short, I have a TH1 histogram with data, where the errors should be just
sqrt(N), load it into a RooDataHist, defining a Pdf, and then do
fitTo that RooDataHist.
The problem is that if I check at the errors of that RooDataHist, they are not the same as the TH1 (nor sqrt(N)). This is how I am checking this:
>>> file = ROOT.TFile("Rootfiles/jetObservables_histograms_JetHT2017ALL.root") >>> histo = file.Get("jetObservables/recoJet2_mass_nom_AK8PFJet450_dijetSel") >>> msd = ROOT.RooRealVar('msd', 'msd', 125., 0, 400) >>> data = ROOT.RooDataHist( 'data', 'data', ROOT.RooArgList(msd), histo) [#1] INFO:DataHandling -- RooDataHist::adjustBinning(data): fit range of variable msd expanded to nearest bin boundaries: [0,200] --> [0,200] >>> data.get(10) <ROOT.RooArgSet object at 0x474a088> >>> data.weight() 23884.0 >>> data.weightError() 154.54530080206314 >>> histo.GetBinContent(11) 23884.0 >>> histo.GetBinError(11) 154.544491975612
or more noticeable:
>>> data.get(34) <ROOT.RooArgSet object at 0x47ba198> >>> data.weight() 12.0 >>> data.weightError() 3.987542525845706 >>> histo.GetBinContent(35) 12.0 >>> histo.GetBinError(35) 3.4641016151377544
Am I doing this correct?
Please let me know if you have any further questions