Closed egpbos closed 6 years ago
Note that the gauss-normalization term (1/sqrt(something pi sigma^something)) contains sigma, so it doesn't drop out in the derivative to sigma.
Re-added migrad functionality in RooGaussMinimizer together with print statements in RooGaussMinimizerFcn. Only DoEval()
is called and never DoDerivative()
The RooGaussMinimizer just calls the Minuit function which should be overloaded to take a gradient function. Is this recast back to an IMultiGenFunction somewhere?
So, when you initialize the Fitter with a IMultiGradFunction
, it should set the fUseGradient
flag to kTRUE
.
As you say, RooGaussMinimizer::migrad
calls Fitter::fitFcn
, which calls Fitter::DoMinimization
. I don't know if this makes use of fUseGradient
. I don't think it will, since it in turn calls Minuit2 things. Minuit2 is an implementation of the Minimizer interface class and the Minimizer class does provide for IMultiGradFunction
overloads. However, the question is whether these will be called from the current RooGaussMinimizer
If all of this doesn't work out, we could try to write some custom fitting routine. We can take some inspiration from Fitter::DoBinnedLikelihoodFit
and Fitter::DoLeastSquareFit
, where fUseGradient
is used.
Todo:
fUseGradient
is kTRUE after initialization of the Fitter in the RooGaussMinimizer
.IMultiGradFunction
Minuit2 functions are called, not the IMultiGenFunction
ones.
I think we just need testing now and therefore this can be closed...
Mainly fill out the DoEval with an explicit Gaussian NLL, i.e. something like 0.5*pow((x-mu)/sigma,2) + log(gauss-normalization) and DoDerivative with the derivatives of this to mu and sigma, depending on the index argument.