Torsten Henkel wrote: > > Hi, > > I want to fit an user function to a profile histogram: > > [first part of the macro is sniped] > > h1->Draw("sm2:p>>smprof","side==1","profs"); > TF1 *fun2 = new TF1("fun2","[0]+[1]*pow(x,2)",3,10,2); > fun2->SetParName(0,"const"); > fun2->SetParName(1,"sigma_b"); > fun2->SetParameter(0,0.03); > fun2->SetParameter(1,0.003); > smprof->Fit("fun2"); > > [the rest also] > > I'm doing this in a macro, but all I get is a 'segmentation violation'. > If i comment out the fit part it is working and making the histogram, > but with it I get the error every time. I tried different names and > functions but it's still the same. I'm running root version 1.01/07 on a > Sparc 20. > I hope anyone can help. The TF1 class has several constructors. In your case, you are calling a constructor with the wrong number of parameters. If you do: TF1 *fun2 = new TF1("fun2","[0]+[1]*pow(x,2)",3,10); Your macro will be OK. Rene Brun
This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:26:20 MET