joshhooker
2/23/2017 - 12:31 AM

PyROOT Import Histograms

PyROOT Import Histograms

import ROOT

tfile = ROOT.TFile.Open("output.root")
fileDict = {}

for h in tfile.GetListOfKeys():
  h = h.ReadObj()
  if(h.ClassName()=='TH1F' or h.ClassName()=='TH1D' or h.ClassName()=='TH2F' or h.ClassName()=='TH2D'):
    fileDict[h.GetName()] = h