Re: [ROOT] adding arrays to trees

From: Rene Brun (Rene.Brun@cern.ch)
Date: Thu Sep 26 2002 - 09:01:12 MEST


Hi Jodi,

do:
   event->Branch("eps",&eps,"eps/I");
   event->Branch("epoch",epoch,"epoch[eps]/D");
   event->Branch("mag",mag,"mag[eps]/D");

We do not support multiple variable length arrays in the same branch.
It is more efficient (storage-wise and time-wise) to have one branch
for each dynamic array.
Note that if your dynamic arrays are members of a class (see
$ROOTSYS/test/Event.h for example), with one single call to TTree::Branch,
you create automatically multiple sub-branches.

Rene Brun

On Wed, 25 Sep 2002, Jodi I Lamoureux wrote:

> Hi Rene,
> 
>      I need to make some branches that look a little like a
> column-wise ntuple.  As a simple test, I added two arrays to a
> tree... see the example below.  When I brows the leafs in root,
> they are identical.  Both "epoch" and "mag" have identical
> values even though buff is 2*eps long and contains the epoch
> array followed by the mag array.
> 
>   // variable-length arrays:
>   event->Branch("eps",&eps,"eps/I");
>   event->Branch("lightCurve",buff,"epoch[eps]/D:mag[eps]/D");
> 
>     Can you send me an example of something like this that works?
> I would for example like to see  the 2nd example in the user manual,
> "A Tree with a C Structure" that records all the structure elements
> in one branch.
> 
>            Thanks,
> 
>               Jodi Lamoureux
> 



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