ROOT Version: 6.10/09
Platform: Ubuntu 16.04
Compiler: gcc530
Hi, I have a root file with TTree with branch of let’s say… AODCaloJetPt…
I can simply create a TH1F object of the histogram with
mytree16 = _file0.Get("Ntuple/EventTree")
mytree16.Draw("AODCaloJetPt")
temp = TH1F()
temp = mytree16.GetHistogram()
I am looping over multiple Ntuplized files and want to look at the added histogram for the variable of AODCaloJetPt.
I believed it could be simply done with
h16 = TH1F()
for i in range (10):
filename = DY16dir[i]
_file0 = TFile.Open(filename,'read')
#myfile = TFile.Open(_file0)
mytree16 = _file0.Get("Ntuple/EventTree")
mytree16.Draw("AODCaloJetPt")
temp = TH1F()
temp = mytree16.GetHistogram()
h16.Add(temp)
temp.Delete()
However, since the tree’s GetHistogram does not have defined binning and dependent on its maximum value of branch content, It has different binning.
So, it gives these messages…
Info in TH1F::Add: Attempt to add histograms with different number of bins
Is there an ingenious way to accomplish the goals without looping over all contents of the branch and filling the histogram? (Takes too much time in python script…)
If you could instruct me how to do this in pandas or uproot… I would sincerely appreciate as well!
Thank you.!