Hi Emily,
Your code is working fine with ROOT 3.03/09 on Linux RH7.3.
The fit is converging and the result (see below) is the same if I compile
with the line
chi->Fit("pol2","","",xmin,xmax);
or with
chi->Fit("pol2");
Note also that the result is the same even if I comment out the line
chi->Draw("*A");
Try with the new ROOT release.
Cheers,
Silvio
PS: this is the output of your code:
**********
** 10 **MIGRAD 5000 5e-06
**********
MIGRAD MINIMIZATION HAS CONVERGED.
FCN=0.180571 FROM MIGRAD STATUS=CONVERGED 36 CALLS 37
TOTAL
EDM=1.8319e-24 STRATEGY= 1 ERROR MATRIX
UNCERTAINTY 100.0 per cent
EXT PARAMETER STEP FIRST
NO. NAME VALUE ERROR SIZE DERIVATIVE
1 p0 1.08400e+01 9.90137e-01 -3.47836e-14 0.00000e+00
2 p1 -2.47143e+00 2.20067e-01 2.68732e-14 -1.87176e-13
3 p2 4.28571e-01 2.83666e-02 -4.16690e-15 9.00302e-12
FCN=0.180571 FROM MIGRAD STATUS=CONVERGED 36 CALLS 37
TOTAL
EDM=1.8319e-24 STRATEGY= 1 ERROR MATRIX
UNCERTAINTY 100.0 per cent
EXT PARAMETER STEP FIRST
NO. NAME VALUE ERROR SIZE DERIVATIVE
1 p0 1.08400e+01 9.90137e-01 -3.47836e-14 0.00000e+00
2 p1 -2.47143e+00 2.20067e-01 2.68732e-14 -1.87176e-13
3 p2 4.28571e-01 2.83666e-02 -4.16690e-15 9.00302e-12
On Wed, 9 Oct 2002, nurse wrote:
> Hi,
> I am trying to draw a TGraph and then fit it to a pol2.
> I get a segmentation violation when I try and run this code:
>
> {
>
> const Int_t n=5;
> Double_t x[n]={1.0, 2.0, 3.0, 4.0, 5.0}, y[n]={8.8,7.7,7.0,8.1,9.1};
> TGraph *chi=new TGraph(n,x,y);
>
> chi->Draw("*A");
>
> Axis_t xmin=x[0];
> Axis_t xmax=x[5];
> chi->Fit("pol2","","",xmin,xmax);
> //chi->Fit("pol2");
> }
>
>
> I notice that if I fit with the line that is commented out on version
> 3.02/07 it works fine so I assume it is to do with the changes made to Fit
> in the new root version.
> Please also note that if I run this code without the chi->Draw("*A"); line
> it compiles but gives a very bad fit.
> Thanks for your help,
> Emily Nurse.
>
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:13 MET