2d fit question

Hey, everybody, I have a question about a two-dimensional fit.

There is a histogram with an empty bin in the centre (see figures. 1: signal+fit, 2: signal) that I process in this way:

TH2F *hDiff = new TH2F("hDiff", "hDiff", module_binsX, -52.5, 52.5, module_binsY, -52.5, 52.5);

<...>

Double_t fun2(Double_t *x, Double_t *par) //fit function for signal
{
  Double_t z2 = x[0] * x[0] / par[0] / par[0] + x[1] * x[1] / par[1] / par[1];
  z2 *= par[2] * par[2];
  return -sqrt(z2) + par[3];
}

<...>

TF2 *f6 = new TF2("f6", fun2, -52.5, 52.5, -52.5, 52.5, npar);

<...>

//weights for signal
for (int iBin = 1; iBin <= hDiff->GetNbinsX() * hDiff->GetNbinsY(); iBin++)
{
	if (hDiff->GetBinContent(iBin) > 0)
		hDiff->SetBinError(iBin, 1. / sqrt(hDiff->GetBinContent(iBin)));
	else
		hDiff->SetBinError(iBin, numeric_limits<double>::max());
}

<...>

Double_t f6params[npar] = {200, 200, 1, 1};
f6->SetParameters(f6params);
hDiff->Fit("f6", "QR M");

<...>

TCanvas *canv_surface_diff = new TCanvas("Surface diff", "Surface diff");
hDiff->Draw("lego2z");

It seems that the fit should be much higher than it is drawn. What could be the problem?

I guess @moneta can help you.

Hi,

What is the log of the fit, if it is converged this is probably the best result. Are you sure the bin error = 1./sqrt(content), is correct ?
Note that if a bin is empty is normally excluded by default from the fit

Lorenzo

Thank you for your response! It looks like during all the iterations fit is converged. Nevertheless, I expected quite a different thing and I don’t quite understand why the fit is so low. Errors are set correctly.

The figure shows the last iteration from the log file.

log_2.txt (37.3 KB)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.