Re: ?: how to use TTreeFormula

From: Rene Brun (Rene.Brun@cern.ch)
Date: Wed Sep 09 1998 - 00:15:56 MEST


Dirk,
Last week, I answered your email a bit too quickly.
References to an existing function are not supported
by TTreeFormula. I agree, however, that it would be nice to call
a function in particular in the selection expression.
The implementation is non-trivial, but I will look into it.

Rene Brun

Dirk Meier wrote:
> 
> Hello,
> 
> I want to draw a function TF1 which gets its arguments from a TTree.
> 
> s.th like this:
> 
> {
> TFile *f = new TFile("test.root");  // open file test.root
> 
> TTree *t = (TTree*)f->Get("T");     // get the tree,
> 
> TH1F *h1_1 = new TH1F("H1_1","H1_1",80,-0.1,1.1);  // declare histogramm
> 
> T->Draw("x>>H1_1","y<1 && y>0","",30000); // Draw values from
>                         // tree into H1, x, y are floats in tree
> 
> TF1 *fun1 = new TF1("Fun1","pol7",0,1);   // decleare a function
> 
> H1_1->Fit("Fun1","","",0,1);            // do a fit to the distribution of x
> 
> // now I want to draw Fun1 as a function of y which is float in the tree
> 
> // s.th like T->Draw("Fun1(y):y","y<1 && y>0","",30000);
> 
> }
> 
> I believe TTreeFormula could help?
> Does anybody has an example on how to use TTreeFormula
> 
> merci
> 
> Dirk



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:34:37 MET