Discrepancy between TTree Draw method and RDataFrame result

_ROOT Version: 6.24.06
_Platform: lxplus
_Compiler: N/A

Dear ROOT Experts,

I was trying to create weighted histograms in a TTree using the TTree->Draw() method when I noticed the histograms that were drawn were different than the ones drawn by RDataFrame or even one drawn using a for loop in PyROOT. The file I am using can be found on “cernbox.cern.ch/index.php/s/XIHecdLh4F8wiEd”.

In order to create a histogram representing the sum of weights in a TTree, I ran the following command: TTree_500_350->Draw("weight >> inc(1, -1000, 1000)", "weight");inc->Print("all"). There, I get the following output:

Info in <TCanvas::MakeDefCanvas>:  created default TCanvas with name c1
TH1.Print Name  = inc, Entries= 4309258, Total sum= 62281.1
 fSumw[0]=0, x=-2000, error=0
 fSumw[1]=62281.1, x=0, error=33.3616
 fSumw[2]=0, x=2000, error=0

Now, if one were to compute the sum of weights using RDataFrame (or a for loop) in PyROOT, one gets 62519.9 events. This is a significant difference between the two methods. I would appreciate it if someone could clarify why this difference exists and whether one can trust TTree->Draw() or now.

Best Regards,
Sahibjeet Singh

P.S. the python script I used to get the sum of the weight branch in RDataFrame is:

import ROOT as rt
rdf = rt.RDataFrame("TTree_500_350", "allMC16-410429-nominal.root")
SumW = rdf.Sum('weight').GetValue()

ROOT Forum → Search → Hist.Precision

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.