Adding histograms from all root files in a directory

Hi,

I have a directory containing all large number of root files, each of which contains the same set of histograms. What I’d like to do is merge all these files into one. I found the macro hadd.C, which adds the histograms together very nicely, but I was wondering if there’s a way to use wildcards to build the list of files? I know, for example, that using a TChain I can do ch->Add("*.root"); Is there something analogous that works here?

Thanks a lot!
Heather

Hi Heather,

Use the hadd utility in $ROOTSYS/bin
hadd -f result.root xxx*.root

Rene

1 Like