Loading histograms in a loop

Hi,

I’m trying to open some histograms in a loop, but keep on getting objects of None Type. Here is the code:

root_files = ["file1.root", "file2.root", "file3.root"] for i in range (len(root_files)): f = TFile(root_files[i]) h = f.Get("myHisto") SetOwnership(h,0) l.append(h)

I find that the first two items in the list l are of None type, the last is the histogram as intended. I’ve played around with SetOwnership, but it doesn’t seem to help.

use h.SetDirectory(0) to keep it from being deleted when the file closes

That works great, thanks very much!