Hi Peter,
There are no limitations on the number of filse in a TChain other than
the time necessary to process the TChain.
Note that to create the TChain, instead of calling TChain::Add for each
file, you can use the wildcarding facility, eg
mychain.Add("fil*.root");
If you have used TTree::MakeClass to generate myclass.h and myclass.C,
do:
root > myclass m
root > m.Loop()
The myclass constructor will take care of setting the branch addresses.
You should not set the branch addresses again in the Loop function.
I assume that you are using 3.05/05
Rene Brun
On
Mon, 2 Jun 2003, Peter H Fisher wrote:
> Hi Rooters,
>
> I have some trouble with chains - I do the following:
>
> 1. I have used h2root to make a set of rootfile from ntuples. There are
> 1436 files. I have used MakeClass to make a class for the tree in the
> rootfiles. The main of the tree is h1. The name of the class is myclass.
>
> 2. In a standalone program, I want to go through as many files as I can
> using chains. So I do
>
> TChain mychain("h1");
> mychain.Add("file1.root");
> mychain.Add("file2.root");
> .
> .
>
> Double_t nevent=mychain.GetEntries();
> TTree* mytree=mychain.GetTree();
> myclass *event=new myclass();
> mychain.SetBranchAddress("b_eventno",&event); /* Note: b_eventno is */
> /*branch in tree */
>
> for(int i=0;i<nevent;i++)
> {
> mychain.GetEvent(i,1);
> .
> .
> .
> }
>
> The correct data does not show up in event. what am I doing wrong?
>
> Two more general questions:
> 1. MakeClass seems to put every array from the cwm in it's own branch. do
> I need to do a SetBranchAddress for each one? Is there another way to do
> MakeClass?
> 2. What is the ultimate limit to the number of files/events in a chain? I
> have 1436 files with 150 events.
>
> thank you all for you time an effort answering questions. It really makes
> root work.
>
> Peter Fisher
> MIT
>
>
> Peter Fisher Office
> 617-253-8561
> Professor of Physics Fax 617-253-4100
> 44-118 MIT email fisherp@mit.edu
> Cambridge, MA, 02139
>
>
This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:12 MET