// @(#)root/minuit2:$Id$ // Author: L. Moneta 10/2005 /********************************************************************** * * * Copyright (c) 2005 ROOT Foundation, CERN/PH-SFT * * * **********************************************************************/ #include "TROOT.h" #include "TFitterFumili.h" #include "TF1.h" #include "TH1.h" #include "TGraph.h" #include "TFumiliFCN.h" #include "Minuit2/FumiliMinimizer.h" #include "Minuit2/FunctionMinimum.h" #include "Minuit2/MnStrategy.h" #include "Minuit2/MnPrint.h" //______________________________________________________________________________ /** Implementation of the TVirtualFitter interface using the FUMILI algorithm present in Minuit2. The FUMILI algorithm is a specialized minimization algorithm in the case of a least square or likelihood functions. With this technique the Hessian matrix of the objective function is approximated using only first derivatives. BEGIN_HTML For more information on this method see page 31 of the Tutorial on Function Minimization.
The new Fumili (Fumili2) can be set as the default fitter to be used in method like TH1::Fit, by doing
TVirtualFitter::SetDefaultFitter("Fumili2");To be used directly, Fumili2 requires that the user implements the ROOT::Minuit2::FumiliFCNBase interface and passes its pointer via the SetMinuitFCN method. END_HTML */ using namespace ROOT::Minuit2; //#define DEBUG 1 ClassImp(TFitterFumili); TFitterFumili* gFumili2 = 0; TFitterFumili::TFitterFumili() { // Constructor. Set Name and global pointer. SetName("Fumili2"); gFumili2 = this; gROOT->GetListOfSpecials()->Add(gFumili2); } TFitterFumili::TFitterFumili(Int_t /* maxpar */) { // Constructor as default. Needed this for TVirtualFitter interface SetName("Fumili2"); gFumili2 = this; gROOT->GetListOfSpecials()->Add(gFumili2); } TFitterFumili::~TFitterFumili() { // destructor - deletes the minimizer // delete pointer from TROOT gROOT->GetListOfSpecials()->Remove(this); if (gFumili2 == this) gFumili2 = 0; } void TFitterFumili::CreateMinimizer(EMinimizerType ) { // Create the minimizer engine and register the plugin in ROOT // what ever we specify only Fumili is created if (PrintLevel() >=1 ) std::cout<<"TFitterFumili: Minimize using new Fumili algorithm "<