Parameters of pre-defined function

Hi all,

I’m fitting a pol4 function to a TGraphErrors. The fit appears to work fine and outputs the parameters to screen and the statsbox.
However, I’d like to access the parameters so I can use them later.
Does anybody know how I can do this?

I’d preferably like to avoid fitting on a user defined function such as TF1(“myfunc”, "[0] + [1]*x + [2]xx + … etc)

This is my first post so I’d be really grateful for your help! :wink:

Many thanks in advance
Sarah

TGraphErrors *g; ... g->Fit("pol4"); TF1 *fpol4 = g->GetFunction("pol4");
Rene

[code]{
c1=new TCanvas();
Double_t x[]={0,1,2,3,4,5};
Double_t y[]={0,1,4,9,16,25};

gr = new TGraph(sizeof(x)/sizeof(x[0]),x,y);
gr->Fit(“pol2”);
gr->Draw(“apl”);

TF1 *fpol2 = gr->GetFunction(“pol2”);
Double_t mypars = fpol2->GetParameters();

printf(“All my pars\n”);
for(Int_t i=0;i<3;i++)
printf("%d => %6.1f\n",i,mypars[i]);

printf(“Normal termination…\n\n”);

}[/code]

Check the definition of all the available functions in the next link
root.cern.ch/root/html/TFormula.html

Kris

Rene, Kris - thanks your replies were really helpful.