Re: Question on TTree branches

Rene Brun (Rene.Brun@cern.ch)
Sun, 29 Jun 1997 11:57:49 +0200


Terrence Brannon wrote:
>
> The documentation for the TTree says
>
> Various kinds of branches can be added to a tree:
> A - simple structures or list of variables. (may be for C or
> Fortran structures)
> B - any object (inheriting from TObject). (we expect this
> option be the most frequent)
> C - a ClonesArray. (a specialized object for collections of
> same class objects)
>
> My question is: must object inherit from TObject? Or is it sufficient
> that they be ClassDef'ed and ClassImp'ed?

case B explicitely says: object must inherit from TObject.

>
> If they must be derived from TObject, then I assume I am forced to use
> Case A and list out every field I want as a TTree branch.
>

NO. When you use case B, you can specify the option split.
Each component of your object will automatically go to a separate
branch.
See example in root/test/Event
and also:

http://root.cern.ch/root/HowtoWriteTree.html

Rene Brun