Re: [ROOT] increment a specific element of a tree

From: Rene Brun (Rene.Brun@cern.ch)
Date: Tue Dec 09 2003 - 13:27:19 MET


Hi,

make a 2-d or 3-d array. Create one single branch with this array.
Fill the array in your nested loop, then fill the tree.

Rene Brun

 payman hosseini wrote:
> 
> hi
> say i have a tree with these branches:
>   TTree * t2 = new TTree("t2","raw correlations go here");
>   t2->Branch("reference",&j,"reference/I");
>   t2->Branch("target",&k,"target/I");
>   t2->Branch("bin",&s,"bin/I");
>   t2->Branch("value",&sum,"value/I");
> 
> and i fill it up like this:
>   for (i=0;i<ntrials;i++)
>     {
>         ......
>           for(k=j;k<n_units;k++)
>             {
>                 .......
>               for(s=-80;s<81;s++)
>                 {
>                 .........
>                 do calculations to find "sum"
>                   t2->Fill();
>                 }
>             }
>         }
>     }
> 
> the reference(j), the target(k), and the bin(s) repeat periodically. "sum"
> is always different.
> after the first repetition of the reference, the target, and the bin, i do
> not want to put them in the tree again. i only want to
> increment the original value of "sum" in the tree. can this be done?
> 
> thank you very much,
> 
> paymon
> 
> i am using:
> WindowsXP/NT/w2000 with VC++ 7.0, version 3.10/01 (good old tar
> file) **WIN32GDK**
> 
> thanks



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:17 MET