I am trying to utilize my own FCN function. However, the function does not seem to be able to get proper TF2::RejectedPoint value. When I fit using standard FCN, the RejectPoint() seems to be respected. In my FCN case it always returns true. Here is my FCN:
void myFcn(Int_t & /*nPar*/, Double_t * /*grad*/ , Double_t &fval, Double_t *p, Int_t /*iflag */ )
{
double chi2 = 0;
double tmp, x[2];
for(int i=-nbxo2; i<=nbxo2; ++i)
{
for(int j=-nbyo2; j<=nbyo2; ++j)
{
x[0] = (Double_t)i;
x[1] = (Double_t)j;
fval = multifun(x, p);
if(TF2::RejectedPoint()) continue;
cout << "in" << endl;
tmp = (img_histo->GetBinContent(i+nbxo2+1,j+nbyo2+1)-fval)/img_histo->GetBinError(i+nbxo2+1,j+nbyo2+1);
cout << img_histo->GetBinContent(i+nbxo2+1,j+nbyo2+1) << " " << multifun(x, p) << " " << img_histo->GetBinError(i+nbxo2+1,j+nbyo2+1) << endl;
chi2 += tmp*tmp;
}
}
fval = chi2;
}
and a beginnin of multifun(), which is the body of my function:
double multifun(double *x, double *par)
{
// Reject points chosen for rejection
if(x[0]>(scale_fit_range+glob_posx) || x[0]<(-scale_fit_range+glob_posx) || x[1]>(scale_fit_range+glob_posy) || x[1]<(-scale_fit_range+glob_posy))
{ TF2::RejectPoint(); return 0;}
Am I doing something wrong? I am using a quite late ROOT from svn.