Chi-squared surface?

Dear all,

I’m fairly new to ROOT and neither a very skilled programmer. For my thesis, I would like to be able to plot the chi-squared surface of fits. The function I fit to my data looks like

where the variable in brackets are fit parameters. I would like to plot the chi^2 surface for two of those parameters, namely A and B in this case, whilst the other are fixed.

I obtain the fit, its parameters and chi-squared with the following (incomplete) code snippet

TGraph* g = new TGraphErrors("data.dat","%lg %lg %lg"); TF1 *func = new TF1("fitf",fitf,xmin,xmax,12); g->Fit("fitf","0Qr"); vfit[j]= fit->GetParameter(j); func->SetParameters(vfit); Chisq/ndf = func->GetChisquare()/func->GetNDF();
where data.dat contains x, y, y-error.

Is there a built-in possibilty of plotting a (2D) histogram of the chi-squared surface and, if so, how would I have to implement it?

Thanks very much for your help,
Annika

Hi,

You need to retrieve the chi2 function from the fitter class in order to plot a 2D scan of the chi2 function. We have a method for the 1D scan, but not yet for 2D. I would need to implement it.
So, to do it now, you can do as in the attached example (note you need to compile the macro with ACLIC).

Best Regards

Lorenzo
Scan2D.C (1.3 KB)