Re: [ROOT] branch splitting

From: Rene Brun (Rene.Brun@cern.ch)
Date: Thu Jun 10 2004 - 08:19:31 MEST


Mark,

I cannot reproduce this problem.
I created a file levels.C with your classes, then did

root > .L levels.C+
root > level1 *l = new level1
root > TTree T("T","test")
root > T.Branch("top","level1",&l,16000,99)
root > T.Print()
The last command produces the correct output below

Rene Brun

******************************************************************************
*Tree    :T         : test                                                   *
*Entries :        0 : Total =           19515 bytes  File  Size = 0 *
*        :          : Tree compression factor =   1.00                       *
******************************************************************************
*Branch  :top                                                                *
*Entries :        0 : BranchElement (see below)                              *
*............................................................................*
*Br    0 :fUniqueID :                                                        *
*Entries :        0 : Total  Size=        588 bytes  One basket in memory    *
*Baskets :        0 : Basket Size=      16000 bytes  Compression=   1.00     *
*............................................................................*
*Br    1 :fBits     :                                                        *
*Entries :        0 : Total  Size=        564 bytes  One basket in memory    *
*Baskets :        0 : Basket Size=      16000 bytes  Compression=   1.00     *
*............................................................................*
*Br    2 :det1      :                                                        *
*Entries :        0 : Total  Size=       7947 bytes  One basket in memory    *
*Baskets :        0 : Basket Size=      16000 bytes  Compression=   1.00     *
*............................................................................*
*Br    3 :det1.fUniqueID :                                                   *
*Entries :        0 : Total  Size=        618 bytes  One basket in memory    *
*Baskets :        0 : Basket Size=      16000 bytes  Compression=   1.00     *
*............................................................................*
*Br    4 :det1.fBits :                                                       *
*Entries :        0 : Total  Size=        594 bytes  One basket in memory    *
*Baskets :        0 : Basket Size=      16000 bytes  Compression=   1.00     *
*............................................................................*
*Br    5 :det1.det1.fUniqueID :                                              *
*Entries :        0 : Total  Size=        648 bytes  One basket in memory    *
*Baskets :        0 : Basket Size=      16000 bytes  Compression=   1.00     *
*............................................................................*
*Br    6 :det1.det1.fBits :                                                  *
*Entries :        0 : Total  Size=        624 bytes  One basket in memory    *
*Baskets :        0 : Basket Size=      16000 bytes  Compression=   1.00     *
*............................................................................*
*Br    7 :det1.det1.energy :                                                 *
*Entries :        0 : Total  Size=        630 bytes  One basket in memory    *
*Baskets :        0 : Basket Size=      16000 bytes  Compression=   1.00     *
*............................................................................*
*Br    8 :det1.det1.time :                                                   *
*Entries :        0 : Total  Size=        618 bytes  One basket in memory    *
*Baskets :        0 : Basket Size=      16000 bytes  Compression=   1.00     *
*............................................................................*
*Br    9 :det1.det2.fUniqueID :                                              *
*Entries :        0 : Total  Size=        648 bytes  One basket in memory    *
*Baskets :        0 : Basket Size=      16000 bytes  Compression=   1.00     *
*............................................................................*
*Br   10 :det1.det2.fBits :                                                  *
*Entries :        0 : Total  Size=        624 bytes  One basket in memory    *
*Baskets :        0 : Basket Size=      16000 bytes  Compression=   1.00     *
*............................................................................*
*Br   11 :det1.det2.energy :                                                 *
*Entries :        0 : Total  Size=        630 bytes  One basket in memory    *
*Baskets :        0 : Basket Size=      16000 bytes  Compression=   1.00     *
*............................................................................*
*Br   12 :det1.det2.time :                                                   *
*Entries :        0 : Total  Size=        618 bytes  One basket in memory    *
*Baskets :        0 : Basket Size=      16000 bytes  Compression=   1.00     *
*............................................................................*
*Br   13 :det1.energy :                                                      *
*Entries :        0 : Total  Size=        600 bytes  One basket in memory    *
*Baskets :        0 : Basket Size=      16000 bytes  Compression=   1.00     *
*............................................................................*
*Br   14 :det1.time :                                                        *
*Entries :        0 : Total  Size=        588 bytes  One basket in memory    *
*Baskets :        0 : Basket Size=      16000 bytes  Compression=   1.00     *
*............................................................................*
*Br   15 :det2      :                                                        *
*Entries :        0 : Total  Size=       7947 bytes  One basket in memory    *
*Baskets :        0 : Basket Size=      16000 bytes  Compression=   1.00     *
*............................................................................*
*Br   16 :det2.fUniqueID :                                                   *
*Entries :        0 : Total  Size=        618 bytes  One basket in memory    *
*Baskets :        0 : Basket Size=      16000 bytes  Compression=   1.00     *
*............................................................................*
*Br   17 :det2.fBits :                                                       *
*Entries :        0 : Total  Size=        594 bytes  One basket in memory    *
*Baskets :        0 : Basket Size=      16000 bytes  Compression=   1.00     *
*............................................................................*
*Br   18 :det2.det1.fUniqueID :                                              *
*Entries :        0 : Total  Size=        648 bytes  One basket in memory    *
*Baskets :        0 : Basket Size=      16000 bytes  Compression=   1.00     *
*............................................................................*
*Br   19 :det2.det1.fBits :                                                  *
*Entries :        0 : Total  Size=        624 bytes  One basket in memory    *
*Baskets :        0 : Basket Size=      16000 bytes  Compression=   1.00     *
*............................................................................*
*Br   20 :det2.det1.energy :                                                 *
*Entries :        0 : Total  Size=        630 bytes  One basket in memory    *
*Baskets :        0 : Basket Size=      16000 bytes  Compression=   1.00     *
*............................................................................*
*Br   21 :det2.det1.time :                                                   *
*Entries :        0 : Total  Size=        618 bytes  One basket in memory    *
*Baskets :        0 : Basket Size=      16000 bytes  Compression=   1.00     *
*............................................................................*
*Br   22 :det2.det2.fUniqueID :                                              *
*Entries :        0 : Total  Size=        648 bytes  One basket in memory    *
*Baskets :        0 : Basket Size=      16000 bytes  Compression=   1.00     *
*............................................................................*
*Br   23 :det2.det2.fBits :                                                  *
*Entries :        0 : Total  Size=        624 bytes  One basket in memory    *
*Baskets :        0 : Basket Size=      16000 bytes  Compression=   1.00     *
*............................................................................*
*Br   24 :det2.det2.energy :                                                 *
*Entries :        0 : Total  Size=        630 bytes  One basket in memory    *
*Baskets :        0 : Basket Size=      16000 bytes  Compression=   1.00     *
*............................................................................*
*Br   25 :det2.det2.time :                                                   *
*Entries :        0 : Total  Size=        618 bytes  One basket in memory    *
*Baskets :        0 : Basket Size=      16000 bytes  Compression=   1.00     *
*............................................................................*
*Br   26 :det2.energy :                                                      *
*Entries :        0 : Total  Size=        600 bytes  One basket in memory    *
*Baskets :        0 : Basket Size=      16000 bytes  Compression=   1.00     *
*............................................................................*
*Br   27 :det2.time :                                                        *
*Entries :        0 : Total  Size=        588 bytes  One basket in memory    *
*Baskets :        0 : Basket Size=      16000 bytes  Compression=   1.00     *
*............................................................................*
*Br   28 :energy    :                                                        *
*Entries :        0 : Total  Size=        570 bytes  One basket in memory    *
*Baskets :        0 : Basket Size=      16000 bytes  Compression=   1.00     *
*............................................................................*
*Br   29 :time      :                                                        *
*Entries :        0 : Total  Size=        558 bytes  One basket in memory    *
*Baskets :        0 : Basket Size=      16000 bytes  Compression=   1.00     *
*............................................................................*



Mark Wallace wrote:
> 
> Hello,
>     I'm using root 3.10/01 on debian linux.  I'm trying to understand how to
> use the splitting of a branch.  I have classes of classes of classes and want
> to make the tree containing branches of branches of branches and I can't seem
> to do that.  If I try
> 
> TTree *t2 = new TTree("t2","Test of class");
> level1 *test = new level1();
> t2->Branch("test","level1",&test,32000,99);
> 
> where the classes are defined below, I get a tree with only splitting of the
> first level.  I saw somewhere on the web that said this was the limit for
> branch splitting when the branch is a class.  The question I have is how could
> you do this manually.  If you can't split a class more then level 2, what can
> you split 99 times?  I would like something like this.
> 
> det1
>         -energy
>         -time
>         det1
>                 -energy
>                 -time
>                 det1
>                             -energy
>                             -time
>                 det2
>                             -energy
>                             -time
>         det2
>                 -energy
>                 -time
>                 det1
>                             -energy
>                             -time
>                 det2
>                             -energy
>                             -time
> 
> Can this be done? if so how?
> 
> Thanks for help!
> 
> Mark Wallace
> 
> class level3 : public TObject {
>  public:
>   Float_t energy;
>   Float_t time;
>   level3() {};
>   ~level3() {};
>   ClassDef (level3,1)
> };
> class level2 : public TObject {
>  public:
>   level3 det1;
>   level3 det2;
>   Float_t energy;
>   Float_t time;
>   level2() {};
>   ~level2() {};
>   ClassDef (level2,1)
> };
> class level1 : public TObject {
>  public:
>   level2 det1;
>   level2 det2;
>   Float_t energy;
>   Float_t time;
>   level1() {};
>   ~level1() {};
>   ClassDef (level1,1)
> };



This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:08 MET