Posts Tagged ‘data analysis’

Articles

Loop over histograms in ROOT file

In python on Jul 29, 2016 by theoryl Tagged: , ,

Looping over all histograms in a ROOT file using pyROOT

from ROOT import TFile
tfile = TFile.Open("histos.root")
tfile.cd()
for h in tfile.GetListOfKeys():
    h = h.ReadObj()
    print h.ClassName(), h.GetName()