Hello.

I am using root v4.00.06.

I have 600 data points which I would like to fit to a section of a sphere to obtain the radius of curvature and the the center of the sphere.

I read in the data points into an ntuple, and then create a 3D histo.

nt100->Draw(“z:y:x>>h3(600,-0.3,0.3,600,-0.3,0.4,600,2.6,2.71”,"",“h3”);

I use the macro below to do the fit, but it takes a long time and Root

is terminated automatically because it is consuming too much CPU time.

What could be done?

Thanks

Fabio.

//______________*macrofit.C*

#include “TF3.h”

#include “TH3.h”

Double_t func3(Double_t *x, Double_t *par) {

Double_t r2 = x[0]*x[0] + x[1]*x[1] +x[2]*x[2];
Double_t arg = (TMath::Sqrt(r2) - par[1])/par[2];
Double_t val = par[0]*arg);

*TMath::Exp(-0.5*arg

return val;

}

void fitorig() {

TF3 *f3 = new TF3(“f3”,func3,-0.25,0.25,-0.3,0.35,2.6,2.71,3);

f3->SetParameters(1,2.5,1);

TH3F *h3a = (TH3F*)f->Get(“h3”);

```
h3a->Draw("");
h3a->Fit(f3);
```

}