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

From: Rene Brun (Rene.Brun@cern.ch)
Date: Sat Dec 13 2003 - 11:30:52 MET


Hi,

I cannot reproduce the problem with just the 3 lines of your example.
Could you provide a running script showing the problem?

Rene BrunOn 
Fri, 12 Dec 2003, payman hosseini wrote:

> 
> hi
> 
> there is a new problem:
> 
> if i do:
>   int jk=(n_units*(n_units+1)/2);
>   cout<<"jk "<<jk<<endl;
>   float C_jk_arr[jk][161];
> 
> i get this error:
> 
> Error: Non-static-const variable in array dimension
> FILE:c:\root\macros\ncc_ver2
> .c LINE:13
>  (cint allows this only in interactive command and special form macro
> which
>   is special extension. It is not allowed in source code. Please ignore
>   subsequent errors.)
> *** Interpreter error recovered ***
> 
> if i do:
> 
>   static const int jk=(n_units*(n_units+1)/2);
>   cout<<"jk "<<jk<<endl;
>   float C_jk_arr[jk][161];
> 
> then jk will be zero.
> 
> how can i do this?
> 
> thanks
> 
> i am using:
> WindowsXP/NT/w2000 with VC++ 7.0, version 3.10/01 (good old tarfile) **WIN32GDK**
> 
> 
> Paymon Hosseini
> 
> On Tue, 9 Dec 2003, Rene Brun wrote:
> 
> > 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