Hi!

I’ve the problem that ROOT sometimes get’s stuck when fitting with my user defined function which contains a numeric integration and looks like this:

[code]Double_t resonance(Double_t *y,Double_t *par)
{
Double_t crosss = 0, lambda;
Double_t vf = 0;
if (par[0] != 0)
{
lambda = (y[0] - 2*par[0]) / par[1]; //y[0]=sqrt(s)

vf = sqrt(par[0] * par[1]); //par[0]=mr,par[1]=gamma

```
static TF1 *f = new TF1("f","sqrt(([2] - 2 * [0]) / [1] - x) / ( x * x + 1)");
f->SetParameters(par[0],par[1],y[0]);
crosss = f->Integral(-1000,lambda);
crosss = par[2]*crosss * vf / TMath::Pi()+par[3];
//cout <<lambda<<endl;
}
```

return crosss;

}[/code]

Is there a way to tell ROOT to interrupt the fit procedure after a particular number of iterations or something like that?

I know this might not be the smartest way to implement the function… does somebody have a better idea instead of using a TF1 for integration? In principle it even gets worse, cause I need this function convoluted with a Gaussian in addition. That would add another integration… and then fitting really gets slow!

Can somebody help me on this?

Regards and thanks,

Klaus