Re: Minuit2

From: Lorenzo Moneta <Lorenzo.Moneta_at_cern.ch>
Date: Mon, 15 Sep 2008 09:56:11 +0200


Hello Patrick,

  the ModularFunctionMinimizer is an abstract class, you need to instantiate a derived class, depending on the algorithm you want to use. FOr example for Migrad (a variable metric minimizer) you need to instantiate the VarableMetricMinimizer class. You can do as following:

VaraibleMetricMinimizer minimizer;
FunctionMinimum min = minimizer.Minimize(*fFCN, par, stra, 0, 0.1);

One examples is in SVN in $ROOTSYS/math/minuit2/test/MnSim/ DemoGaussSim.cxx
available also online at

   http://root.cern.ch/viewvc/trunk/math/minuit2/test/MnSim/DemoGaussSim.cxx?view=markup

Best Regards

   Lorenzo

On Sep 14, 2008, at 8:16 PM, Patrick Dupre wrote:

> Hello,
>
> I used the Minuit2 package by derivating a class from FCNBase and by
> overloading the operator () as it is suggested in the manual:
> mnusersguide.pdf
> I works, but to improve the control on the fit I wanted to use:
> ModularFunctionMinimizer
> So I tried to instantiate the class by:
> ModularFunctionMinimizer minimizer (*fFCN, par, stra, 0, 0.1) ;
> where:
> RR_Chi2 *fFCN ;
> and where RR_Chi2 is a class derivated from FCNBase (the one that I
> used before) previously instanciated (fFCN = new RR_Chi2 (x, y))
>
>
> I get the following compilation error:
>
> Fitter.cpp: In member function 'std::vector<std::vector<double,
> std::allocator<double> >, std::allocator<std::vector<double,
> std::allocator<double> > > > ROOT::Minuit2::Fit_RR::Fit()':
> Fitter.cpp:418: error: no matching function for call to
> 'ROOT
> ::Minuit2
> ::ModularFunctionMinimizer
> ::ModularFunctionMinimizer(ROOT::Minuit2::RR_Chi2&,
> ROOT::Minuit2::MnUserParameters&, ROOT::Minuit2::MnStrategy&, int,
> double)'
> /usr/local/include/Minuit2/ModularFunctionMinimizer.h:47: note:
> candidates are:
> ROOT::Minuit2::ModularFunctionMinimizer::ModularFunctionMinimizer()
> /usr/local/include/Minuit2/ModularFunctionMinimizer.h:47: note:
> ROOT
> ::Minuit2::ModularFunctionMinimizer::ModularFunctionMinimizer(const
> ROOT::Minuit2::ModularFunctionMinimizer&)
> Fitter.cpp:418: error: cannot declare variable 'minimizer' to be of
> abstract type 'ROOT::Minuit2::ModularFunctionMinimizer'
> /usr/local/include/Minuit2/ModularFunctionMinimizer.h:47: note:
> because the following virtual functions are pure within
> 'ROOT::Minuit2::ModularFunctionMinimizer':
> /usr/local/include/Minuit2/ModularFunctionMinimizer.h:86: note:
> virtual const ROOT::Minuit2::MinimumSeedGenerator&
> ROOT::Minuit2::ModularFunctionMinimizer::SeedGenerator() const
> /usr/local/include/Minuit2/ModularFunctionMinimizer.h:87: note:
> virtual const ROOT::Minuit2::MinimumBuilder&
> ROOT::Minuit2::ModularFunctionMinimizer::Builder() const
>
> So, it looks like that I cannot instanciate a class
> ModularFunctionMinimizer that way.
> Question 1) how can I do it by keeping my previous code
> 2) If I have to rewrite my previous code, can I get an example ?
>
> Thank.
>
>
> --
> ---
> =
> =
> =
> =
> ======================================================================
> Patrick DUPRÉ | |
> Department of Chemistry | | Phone: (44)-
> (0)-1904-434384
> The University of York | | Fax: (44)-
> (0)-1904-432516
> Heslington | |
> York YO10 5DD United Kingdom | | email: pd520_at_york.ac.uk
> =
> =
> =
> =
> ======================================================================
Received on Mon Sep 15 2008 - 09:56:23 CEST

This archive was generated by hypermail 2.2.0 : Mon Sep 15 2008 - 23:50:02 CEST