Re: [ROOT] Looping over files.

From: Rene Brun (Rene.Brun@cern.ch)
Date: Wed May 22 2002 - 21:07:20 MEST


Hi Creighton,

Example. A tree named "h42" in 4 files in $H1 directory
root > TChain ch("h42");
root > ch.Add("$H1/d*.root");
root > ch.ls(); gives
$H1/dstarmb.root tree:h42 entries=1234567890
$H1/dstarp1a.root tree:h42 entries=1234567890
$H1/dstarp1b.root tree:h42 entries=1234567890
$H1/dstarp2.root tree:h42 entries=1234567890

You can use wilcarding in TChain::Add

Rene Brun


On Wed, 22 May 2002, Creighton Hogg wrote:

> Hello,
> 
> I need to create a large chain of root files for plotting various
> histograms.  I can add them into a chain just fine, the problem is that
> there are over *800* files in the set, and so far I have failed to
> figure out a loop that I can use to add them all into the chain.   So
> far I have added only a few of them in by hand to help debug my script,
> but I still don't know how to put them all in.  The files only differ by
> an integer extension, and are all in their own separate directory, so it
> seems like it shouldn't be too hard to loop over the contents of the
> directory, but I haven't found a way of doing it yet.  I would
> appreciate any pointers that anyone has.
> 
> Thanks,
> 
> Creighton
> 



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:53 MET