Re: [ROOT] storing branches in trees ...

From: Rene Brun (Rene.Brun@cern.ch)
Date: Mon Jan 21 2002 - 09:42:45 MET


Hi Volker,

Volker Hejny wrote:
> 
> Hi all,
> 
> somehow I didn't find the right subject. I have to general questions
> concerning branches. I think, they are quite common, so I hope, that
> somebody can give me some advice.
> 
> i) In my program I have a set of data classes, which can be stored
>    in a tree, each as a seperate top-level branch. The set is not
>    fixed, number and type of classes can vary depending on the
>    user analysis of data. Since I have different types of classes,
>    e.g. representing raw data, calibrated data, intermediate results,
>    etc., I really like to store them in some hierachy within the
>    tree rather then having them as top-level classes.
>    Normally one would do that writing a class for each category
>    holding one object of each data class. However, this would
>    break the flexibility and modularity. Whenever adding/removing a
>    data class, the 'top-level' classes have to be redefined. That's
>    not appropriate for me.
>    Is there any way to form (dynamically) a hierachy in a tree.
>    Let's say I have three class objects 'det1', 'det2', 'det3' and
>    I want to put them into a top-level hierachy 'raw' in the tree.
>    Without forming any additional classes!

In 3.02, I introduced a branch constructor supporting a collection in input.
See : http://root.cern.ch/root/html302/src/TTree.cxx.html#TTree:Branch
 Branch(TCollection *list, Int_t bufsize, Int_t splitlevel, const char *name)


> 
> ii)Some of these classes are used twice or more, because similiar
>    sets of detectors are used or the data are raw/calibrated. There
>    are variables in the classes, which only change from instance to
>    instance, but not from event to event. However, they are used
>    to identify the object and the analysis conditions when the tree
>    is read back later.
>    As far as I know, there are only two modes to handle these data,
>    either to write them to the tree as a normal variable and, therefore,
>    write the same value for each entry, or to discard the variable at
>    all. Both are not very convenient. To store these data in a
>    separate class is not practical due to modularity and flexibility.
>    As I see this, the best solution would be, if a TBranch could store
>    some pseudo-constant variables of the class at the beginning, which
>    will not change later on.
> 

If you run in compression mode (default), elements that do not change from
event to event will be highly compressed. See the result with TTree::Print.

Rene Brun


> Are they any suggestions to handle these tasks?
> 
> Thanks in advance and best regards,
> Volker
> 
> --
> Dr. Volker Hejny                Tel: 02461/616853                      **
> Institut f. Kernphysik          Fax: 02461/613930                     **
> ---------------------------------------------------------------- **  ** ---
> Forschungszentrum Juelich GmbH, D-52425 Juelich                    **



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