Accessing histograms in a TFile

I suspect this is a trivial question, but here goes:
I generally use two .C files to look at data, the first to do the heavy crunching and filling of histograms, and the second to do the plotting (and dandifying) of the histograms.

If in the first file I want to create an array of histogram pointers, then dynamically create and fille the TH1F objects, then write them out to a TFile, then is there any way in the second program to read in the TFile and access the histograms through an array of pointers?

A specific example is if I had a file with a variable number of names in it. I would want to be able to read in each name and make a histogram for the name. Then write out all created histograms to a TFile, then in a seperate .C file, read in the TFile and the name file and access the histograms without explicitly writing the names in the .C file.


This is demonstrated in $ROOTSYS/tutorials/loopdir.C


many thanks!