Re: [ROOT] multiple branches with different lengths (a FAQ?)

From: Rene Brun (Rene.Brun@cern.ch)
Date: Tue Nov 26 2002 - 22:22:40 MET


Hi Piotr,

What you do will work. The compression algorithm will take care
of eliminating identical entries.
An alternative is to create a Run Tree with one entry per run.

Rene Brun

On Tue, 26 Nov 2002, Piotr Zolnierczuk wrote:

> Hi,
> 	it is probably a FAQ but I could not find any answer by browsing
> HOWTO's nor roottalk digest.
> 
> Here is my problem:
> I want to create a tree with two branches:
> 1) a "regular" branch with my data (a class)
> 
> 2) a single entry branch that would describe configuration say 
> date/time/comment
> 
> 
> my (meta) code looks as follows
> 
> {
>    file  = new TFile("mini.root","RECREATE");
>    tree  = new TTree("myEvents","A tree with vents");
>    eve   = new RawEvent();
>    des   = new RunDescr();
> 
>    eveBr = tree->Branch("RawData"       ,"RawEvent",&eve,100,99);
>    desBr = tree->Branch("RunDescription","RunDescr",&des,100,99); // not 
> sure about split param
> 
> 
>    des->clear();
>    des->setTime(time(0));
>    des->setComment("comment");
> 
>    tree->Fill();
> 
>    for(int i=0; i<MAX_DATA; i++) {
>      eve->clear();
>      eve->setData(data);
>      tree->Fill();
>    }
> 
>    file->Write();
>    delete file;
>    return;
> }
> 
> 
> 
> The question is how to avoid multiple filling of the desBr branch
> cause it the mini.root file seems to have MAX_DATA entries in desBr
> 
> Piotr
> 
> 
> 
> -- 
>   ________________________________________________________________
>   Piotr Adam Zolnierczuk                                          	
>   Indiana University                        phone:  (812) 855-3613	
>   Cyclotron Facility                        fax:    (812) 855-6645	
>   2401 Milo B Sampson Ln       e-mail:     zolnie@iucf.indiana.edu	
>   Bloomington,IN 47408, USA    http://www.iucf.indiana.edu/~zolnie	
>   ________________________________________________________________	
>                     written on recycled electrons			
> 
> 



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