// this is the fit function
[color=red]Double_t fit_5( Double_t *x,Double_t *y ,Double_t *par)
{
Double_t fitval=(par[0]*TMath::Exp(par[1]*x[0])+par[2]*TMath::Exp(par[3]*x[0]))*ROOT::Math::assoc_legendre(5,0,cos(y[0]*TMath::Pi()/180));
return fitval;
}
[color=black]// fitf is the combined function function. Function fit_1,fit_2,fit_3,fit_4 is
// like fit_5[/color]
[color=red]Double_t fitf( Double_t *x,Double_t *y, Double_t *par)
{
Double_t fitval=fit_5(x,y,&par[24])+fit_4(x,y,&par[20])+fit_3(x,y,&par[16])+fit_2(x,y,&par[12])+ fit_1(x,y,&par[8])+fit_0(x,y,par);
;
return fitval;
}[/color]
…
[color=red]TGraph2DErrors *f=new TGraph2DErrors(counter,en,angle,cs,ex,ey,cserror);
f->Draw(“surf1”);[/color]
[color=black]// the graph is drawn correctly
//fit
[/color]
[color=red] TF2 *f2=new TF2(“fit”,fit_0,4,150,0,180,28);
f->Fit("fit");[/color]
but when i fit it ,i got error, said:
[color=blue]Error: G_CallFunc::SetArgArry() must be initialized with ‘G_CallFunc::SetFunc(G_ClassInfo* cls,char fname,char args,long*poffset)’ first [/color]