Re: ?: how to use TTreeFormula

Rene Brun (brun@hpbrun.cern.ch)
Tue, 1 Sep 1998 01:35:55 +0200 (METDST)


Dirk,
In principle, what you want to do should work.
TTreeFormula should be able to access user defined
functions.
For a few days, I only have access to a slow system
and only for a few minutes. I will look into your
question again in the middle of next week.

Rene Brun

On Mon, 31 Aug 1998, 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
>
>
>
>