Re: Subclasses in TBranch: Browsing / arrays

From: Rene Brun (Rene.Brun@cern.ch)
Date: Fri Aug 20 1999 - 08:20:39 MEST


Hi Ingo,
What you are describing is a normal tree structure in memory.
When you design the branches of a Root TTree object, you have to think
  - what is happening with tree->Fill().
  - and symmetrically with tree->GetEntry()
  - Does it make sense to save a branch of a branch in a separate TBranch
    if I always need the parent branch for later processing.
Each call to the Fill function writes the current information to
the branch buffers. You do not want to write many times the same info
to the buffers.
The main function of the branches of a TTree is to allow selective read
of a branch later to save I/O resources.
Making too many branches will generate too many buffers in memory
and will not make the data base organisation very efficient.
The case where each class member (the final leaves) can go to a separate
branch happens at the mini/micro/nano event level only (ntuple case).

To make a recommendation on a good TBranching mechanism in your case,
I have to see your current class structure with some indications
of what you want to save. The tree structure you describe can be 
written in a Root TTree 
 - with just one branch
 - with one branch for each of your ClassA
 - with more complex mixtures.
I also have to understand your event size and number of events.

I am away until Monday

Rene Brun


On Thu, 19 Aug 1999, Ingo Froehlich wrote:

> On Thu, 19 Aug 1999, Rene Brun wrote:
> 
> > Ingo,
> > The user interface for TTree is in the TTree class itself.
> > Do not try to use classes such as TBranchObject, TBranch, TLeaf yourself
> > unless you understand deeply the TTree mechanism. All what you need
> > is in TTree.
> 
> Hello,
> 
> But is there any example, how to divide a branch into sub branches?
> What I want to do is:
> 
> I have a class called "ClassA" (Just to have an example - the analysis
> code is much more complicate..). This Class contains a pointer (or lets
> say many pointers...) to a subclass "ClassB"
> 
> How may a fill this into a root tree with a TBrowser that looks like:
> 
> my.root
>  +--TreeName
>     +--ClassA
>        +--ClassB
>           +--Members of ClassB
> 
> If I use splitlevel 1, it ends at ClassB (because it is a pointer), I
> know, but how to split it by hand if I use splitlevel = 0?
> 
> Has anyone an example code for this construction?
> 
> Thanks, Ingo
> 
> --
> Ingo Froehlich, II. Physikalisches Institut, Universitaet Giessen
> Heinrich-Buff-Ring 16, D-35392 Giessen           |  Tel.: 0641 - 99 33250
> EMail: Ingo.Froehlich@exp2.physik.uni-giessen.de |  Fax : 0641 - 99 33209
> Sekretariat II. Physik: 0641 - 99 33261          |                    :-)
> 



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:43:38 MET