Thomas, With a TChain, you build a tree structure. You create a chain to which you add files, then you can create a super-chain to which you add other chains or files. Each chain references one single Tree. If you have multiple Trees per file, no problem. Just change the name of the Tree when you create the chain. Rene Brun Thomas Bretz wrote: > > Hi Rene, > > does this mean, I cannot add all files of one chain to another chain > which references a different tree by one call? It is not a problem for > me to use the loop like in the example below, but this means, that using > Add(TChain*) overrides the Tree-name which is given in the constructor. > Maybe this should be mentioned in the documentation (or that you assume, > that the chain to be added is referencing the same tree). > > We have several trees in our files and this trees are processed > independantly. I thought the idea of Add(TChain*) is to create easily > chains of the same file referencing different trees, but I was wrong. > > Thomas. > > > By definition, a TChain references always the same Tree name. You should do: > > > > TChain c1("Events"); // Tree containing 1000 Events > > c1.Add("file1.root"); > > c1.Add("file2.root"); > > > > TChain c2("Events"); // Tree containing one event > > c2.Add(&c1); > > c2.Add("file3.root"); > > > > > > > > I have to chains, which should contain the same files, I tried: > > > ------ > > > TChain c1("Events"); // Tree containing 1000 Events > > > c1.Add("file1.root"); > > > c1.Add("file2.root"); > > > > > > TChain c2("RunHeaders"); // Tree containing one event > > > c2.Add(&c1); > > > ----- > > > c2.GetEntries() results in 1000 instead of one and reading results in > > > reading "Events" instead of "RunHeaders". > > > > > > I tried the following, too, and this worked: > > > ------ > > > TChain chain("RunHeaders"); > > > TObject *obj; > > > TIter N(c1.GetListOfFiles()); > > > while ((obj=N())) > > > c2.Add(obj->GetTitle()); > > > -------
This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:51:06 MET