Dear all,
I am fitting a rather complicated function using the TFitterMinuit interface. I know that it is deprecated, but currently it is deeply embedded into the framework I have to use, so that I would like to try to use it before rewriting large parts.
My goal is to scan the likelihood function and from the documentation and forum threads I found the following function at the end of the relevant code:
TFitterMinuit* minuit = new TFitterMinuit();
minuit->SetMinuitFCN(fcn); // fcn is of class FCNBase
minuit->SetParameter(0, "theta0", the0 , 0.5*degree, 0, 0); //Setting paramaters
// more parameters
minuit->CreateMinimizer(TFitterMinuit::kCombined);
minuit->Minimize();
// Now the scan
minuit->ExecuteCommand("SCAN", 0, 0);
Everything runs smoothly, but I just can’t find a way to retrieve the scan. I’m sorry for my ignorance, but where and in which format is this saved?
If necessary I will try to update the code to use a ROOT::Math::Minimizer.
The SCAN command finds just the best value of the function scanning the likelihood varying each parameter at a time.
The only result saved is the new function minimum value.
If you use the new Minimiser interface (i…e the Minuit2Minimizer class) there is a method call Minimiser::Scan. This method scan a parameter requested by the user and fills a vector of likelihood function values
See
Hi Lorenzo,
thank you for your answer, I assumed something like that.
Regarding the transition to the new interface, I learned from the tutorials that ROOT::Math::Minimizer::SetFunction wants a ROOT::Math::IMultiGenFunction which I can get via the ROOT::Math::Functor method.
Currently I am stuck with a class derived from FCNBase
class MyFcn : public ROOT::Minuit2::FCNBase
{
...
double operator()( const std::vector<double>& par ) const;
...
};
I’d like to make sure that I don’t miss a handy function to help me out here. Do I have to rewrite this class to be a plain c++ function that takes a const double *xx array of variables in order to pass it to the minimizer?
Thank you again and cheers
In order to use with the ROOT::Minimiser interface, just add this simple method to your MyFCN class
(I assume you know the number of parameter and it is the represented by the integer NPAR)