Re: How to get a polyline from a TGraph?

From: Nico De Simone <nicola.desimone_at_roma2.infn.it>
Date: Fri, 16 Feb 2007 18:19:34 +0100


Hello Rene,
the problem is that I need a TF1 to use a TH1::Divide(TF1*).

Rene Brun wrote:
> Hi Nico,
>
> I suggest TGraph::Eval to compute a linear interpolation between
> points or a spline interpolation.
> If you have a TGraph *g, you can make a spline with
> TSpline3 *s = new TSpline3("s",g);
> g-> Draw("alp");

This is what I want: a straight line between points. But I need a TF1 for that TH1::Divide() and, possibly, usable as a class member.

> s-> Draw("same");

But I see a curve. I'm just doing:

{
Double_t x[3] = {0., 1., 2.}
Double_t y[3] = {0., .5, 5.}

TGraph *gr = new TGraph(3, x, y);
gr->Draw("alp");

TSpline3 *sp = new TSpline3("sp",gr);
sp->Draw("same");
}

Thanks.
Nico Received on Fri Feb 16 2007 - 18:19:04 CET

This archive was generated by hypermail 2.2.0 : Sat Feb 17 2007 - 11:50:01 CET