Re: [ROOT] TChain and AddFriend() problem

From: Rene Brun (Rene.Brun@cern.ch)
Date: Thu Sep 19 2002 - 15:22:30 MEST


Hi Ole,

On Thu, 19 Sep 2002, Ole Streicher wrote:

> Hello Rene!
> 
> Rene Brun writes:
>  > TTree::AddFriend accepts a TTree as input. It is not clever enough
>  > to accept a TChain.
> 
> Oh. I thought that a TChain is just an extended TTree (since it
> inherits from a TTree).
> 

Yes TChain inherits from TTree. A base class is not supposed to be aware
of its derived classes, but it should be protected.

>  > However, a TChain::AddFriend accepts either a TTree or a TChain as
>  > argument. TTree::AddFriend should be protected against use with a TChain.
> 
> Is there any drawback when I use a TChain instead of a TTree?

Well, in your case, you already had a TChain. Simply, you cannot
AddFriend a TChain to a TTree, but you can to a TChain.
If you have only one file, you better use a TTree. If you have many files
to be processed sequentially use a TChain.

Rene Brun



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