Re: [ROOT] TGraph functions?

From: Rene Brun (Rene.Brun@cern.ch)
Date: Wed Feb 28 2001 - 19:10:42 MET


Hi Greg,
Your macro works correctly for me. What is your problem?

Rene Brun

Gregory Novak wrote:
> 
> I want to do a fit to a function and then pluck the function from the
> TGraph object.  I have the following macro, which shows that "func"
> doesn't point to anything.
> 
> I managed to get a hold of the object through GetListOfFunctions, and
> found that the function does in fact think it's name is "pol2".  So what's
> wrong with this code?
> 
> {
>   Float_t x[] = {1,2,3};
>   Float_t y[] = {1,4,9};
>   TGraph *tg=new TGraph(3,x,y);
>   tg->Fit("pol2");
>   tg->Draw("AL*");
>   TF1 *func;
>   func=tg->GetFunction("pol2");
>   cout << func << endl;
> }
> 
> Thanks,
> Greg



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:38 MET