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?