Re: [ROOT] TChain and AddFriend() problem

From: Ole Streicher (ole@ifh.de)
Date: Thu Sep 19 2002 - 15:39:51 MEST


Hi again!

 > Rene Brun writes:
 >  > TTree::AddFriend accepts a TTree as input. It is not clever enough
 >  > to accept a TChain.

This makes things quite complicated. Here is what I am doing in the
moment in my analysis frame:

In a first step, I create a "basic" header tree and some other trees
(one per subdetector) which are mounted to the header tree as
"friends". Every of these trees goes into its own file (so that people
can just copy the data they want for their analysis). 

In each analysis step, all these files are opened and the trees are
again mounted together (as they are available). The results of each
analysis step are going again into new TTrees, and each new TTree into
an extra file (The file contains also some meta information about the
analysis step).

To allow several subsequent analysis steps, I mount any new tree
directly after creation to the header tree as "friend" so that the
next step can access its data even in the same program with
GetBranch()->SetAddress(). 

Now it occurs that some of the trees are going to be >2GB, forcing to
use TChains for their access. The subsequent creation of the files of
the chain is solved due to the extension in 3.03/08. 

However, I cannot access them in my program: Since I want to have the
possibility to put anything into one program, the "header" tree must
be a TTree and not a TChain (because it is created in the first step
as a TTree). But, as Rene explained, I cannot mount a TChain to a
TTree as "friend". For some reason (why??) I can't do it even in the
following way:

TTree *header = new TChain(...);
TChain *friend = new TChain(...);
header->AddFriend(friend, "friendname");

since it crashes the same was as it would if "header" would point to a
TTree. This looks to me like there is something wrong in the inner
structure or in the design of the TTree/TChain inheritance.

How can I solve the problem? I need "something" that stores a TTree or
a TChain pointer and is able to mount 
- TTrees if it is a TTree
- TTrees and TChains if it is a TChain.

Can you help me here? Or is my concept totally brain-dead?

Ole



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