Re: [ROOT] TFormula parameter name parsing

From: Roland Kuhn (rkuhn@e18.physik.tu-muenchen.de)
Date: Thu Oct 14 2004 - 22:34:17 MEST


Hi!

On Oct 14, 2004, at 9:21 PM, Philippe Canal wrote:

> Hi,
>
> TTreeFormulaManager is in charge of 'synchronizing' the array indices 
> of
> several TTreeFormula object.
> If you have only one TTreeFormula, you do not need to worry about the
> TTreeFormulaManager (a default one is provided).
>
> So you current code could be simplified with
>
> cut=new TTreeFormula("some_name",cut,tree);
> for(;;) {
>    ii=LoadTree(i);
>    fChain->GetEntry(ii);
>    Double_t cut_result=cut->EvalInstance();
>    ...
> }
> delete cut;
>
Okay. Right now I only use TTreeFormulaManager::Notify() for the 
purpose shown below. Since I have many TTreeFormula's in there, I would 
also like to have a bit more of a container interface (with array-like 
access to the formulas and a Clear() to delete them). But it's not 
urgent.

>> I suppose I should also add manager->UpdateFormulaLeaves() to my
> ::Notify(), right? Is there something else which is
>> needed?
>
> Yes (or cut->UpdateFormulaLeaves()).  The TTreeFormula object need to 
> be
> poked any time the branch objects are changes (i.e. when the chain 
> opens a
> new file).
>
> Also note that if your cut has arrays in it (or any other collection 
> that
> has more than one value per entry), you might have to use something 
> like:
>
>    int ndata = cut->GetNdata();
>    for(int i = 0; i<ndata; ++i) {
>       cut_result = cut->EvalInstance(i);
>    }
>
Thanks for the clarification! I was constantly wondering what all the 
fuzz is about.

> Cheers,
> Philippe.
>

Ciao,
					Roland

--
TU Muenchen, Physik-Department E18, James-Franck-Str. 85747 Garching
Telefon 089/289-12592; Telefax 089/289-12570
--
A mouse is a device used to point at
the xterm you want to type in.
Kim Alm on a.s.r.





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