Loop over histogram names

Hi, I guess, it’s an easy question. How can I loop over the names of the histograms in a root file ?
Below are the format of the histogram names in the root file:

h_Name_1_eta h_Name_2_eta h_Name_3_eta

and the histograms are under a directory called “plots” in the root file.

p.s Since there are many histograms, I don’t want to use the following option

const Int_t nhist=5; char *hnames[nhist] = {"h_Name=1_eta","h_Name_2_eta",...}; TH1 *hist[nhist];

Thanks in advance .

Hi,

See for example the $ROOTSYS/tutorials/io/loopdir.C macro.

Cheers, Bertrand.