Re: formula with multiple TFormula

Rene Brun (Rene.Brun@cern.ch)
Mon, 07 Dec 1998 16:34:29 +0100


"T Auger
>
> Hi ROOTers,
> I would like to draw formula using user defined basic
> formula (defined with TFormula).
>
> e.g :
>
> pomeron = new TFormula("pomeron","[0]*pow((x-0.939*0.939)/1.878,[1])");
> f = new TFormula("f","([2]*pow((x-0.939*0.939)/1.878,[3]))");
>
> total = new TF1("total","pomeron+f",1,20);
> or
> total = new TFormula("total","pomeron+f");
>
> but I cannot combine "pomeron" and "f" ( the call above misfortunely
> don't add up to give me the sum). I could do it by writing them
> down as a whole but I figure it would be nice if one could combine
> TFormula to obtain new ones. Is this possible?
>

Hi Thierry,
I have no problems executing your macro. I have made slight changes
to show two functions on the same graph.
A similar example is given in tutorials/fillrandom.C
I assume you run with 2.00/13 or 2.20.

Rene Brun

{
gROOT->Reset();
TFormula *pomeron = new
TFormula("pomeron","[0]*pow((x-0.939*0.939)/1.878,[1])");
TFormula *f = new
TFormula("f","([2]*pow((x-0.939*0.939)/1.878,[3]))");
TF1 *total = new TF1("total","pomeron + f",1,20);
total->SetParameters(1,2,1.5,2.4);
total->Draw();
TF1 *one = new TF1("one","pomeron",1,20);
one->SetParameters(1,2,1.5);
one->Draw("same");
}