Re: [ROOT] TGraph functions?

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


Hi Greg,
In version 2.23/12, the function result of a fit was not stored in
a TGraph object. Move to a more recent version.

Rene Brun

Gregory Novak wrote:
> 
> When I run the macro, I see the output from Minuit, and then just below
> that the output of the "cout" list is "(nil)".  If I try to use the
> pointer func, I get segmentation violations.  This is using root 2.23.12.
> 
> Thanks,
> Greg
> 
> On Wed, 28 Feb 2001, Rene Brun wrote:
> 
> > 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