TMinuit input variable for fcn?

Hi,

I want to use TMinuit to fit several different data pairs. They use the same fit function. Each time the fcn is called, it will try to fit different data.

I find

void SetFCN(void (*fcn)(Int_t &, Double_t *, Double_t &f, Double_t *, Int_t))

Is the second argument the data to fit? So it can specify what data input. :question:
for example, if I write

void fcn (int &npar, double *gin, double &f, double *par, int iflag) { f = TMath::Power(((par[0]*gin[0]+par[1])-gin[2])/gin[3],2) }
Then can I input data to gin in the main function

Thanks!

Hi,
The FCN is function to be minimized by Minuit (for example a least square sum or a negative log likelihood in case of a fit). This interface reflects exactly the Fortran version API,
see wwwasdoc.web.cern.ch/wwwasdoc/minuit/node14.html

If you prefer a C+±like interface you can use the ROOT::Math::Minimizer class, see
root.cern.ch/drupal/content/nume … idim_minim

and the tutorial

root.cern.ch/root/html/tutorials … ion.C.html

Cheers

Lorenzo

Thank you, Lorenzo!

Best,
Li

[quote=“moneta”]Hi,
The FCN is function to be minimized by Minuit (for example a least square sum or a negative log likelihood in case of a fit). This interface reflects exactly the Fortran version API,
see wwwasdoc.web.cern.ch/wwwasdoc/minuit/node14.html

If you prefer a C+±like interface you can use the ROOT::Math::Minimizer class, see
root.cern.ch/drupal/content/nume … idim_minim

and the tutorial

root.cern.ch/root/html/tutorials … ion.C.html

Cheers

Lorenzo[/quote]