Re: [ROOT] TFormula parameter name parsing

From: Roland Kuhn (rkuhn@e18.physik.tu-muenchen.de)
Date: Thu Oct 14 2004 - 19:24:47 MEST


Hi Rene!

On Oct 13, 2004, at 8:54 AM, Rene Brun wrote:

> Hi Roland,
>
> I agree with your comments about TTreeFormula.
> This class is a key element of TTree::Draw, but it can also be used
> independently.
> It requires a much better documentation.
>
I tried to understand what's going on, and I must admit that I didn't 
really have enough brain memory to get a complete picture (at least not 
in a reasonable timeframe). From what I've seen TTreeFormula is always 
managed by a TTreeFormulaManager. I have already found out that the 
main use of this class is to manage the (up to four) expressions in the 
varexp of TTree::Draw plus the selection criterion, but from the code 
it is not immediately clear to me what the semantics are. What do I 
need to get it working reliably with a TChain?

I'm currently looping with a custom MakeClass-generated class, filling 
my own arbirarily dimensioned histograms. Now I want to include a cut 
criterion, which should be parsed like a selection to TTree::Draw. I 
figure I need something a la

in constructor:
manager=new TTreeFormulaManager;

in Loop():
cut=new TTreeFormula("some_name",cut,tree);
manager->Add(cut);
manager->Sync();
for(;;) {
   ii=LoadTree(i);
   fChain->GetEntry(ii);
   Double_t cut_result=cut->EvalInstance();
   ...
}
manager->Remove(cut);
manager->Sync();

I suppose I should also add manager->UpdateFormulaLeaves() to my 
::Notify(), right? Is there something else which is needed?

Thanks very much for your help!

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:09 MET