Re: Using Minuit in ROOT without global variables

From: Hermann Fuchs <hermann.fuchs_at_meduniwien.ac.at>
Date: Wed, 13 Jul 2011 08:54:42 +0200


Thank you for your answer. I will start to use it, however there is a problem with ROOT.

I was trying to use the NumericalMinimization.C example, but it does not compile on my installation. I get the following error:

Error in <TUnixSystem::DynamicPathName>: Minuit2[.so | .dll | .dylib | .sl | .dl | .a] does not exist
in /home/main/Gate/root/lib:/home/main/Gate/root/lib:/home/main/Gate/CLHEP/lib:/home/main/Gate/gate/tmp//Gate:/home/main/Gate/root/lib:/home/main/Gate/CLHEP/lib:/usr/local/lib:/home/main/Gate/gate/tmp/Linux-g++/Gate:.:/home/main/Gate/root/lib::/home/main/Gate/root/cint/cint/stl

It seems a library is missing.
I am using the most current version of ROOT(self compiled from source), being 5.30/00, on Ubuntu 11.04.
Did I miss something at compile time?

Cheers,
Hermann

On Tue, 2011-07-12 at 10:46 +0000, Lorenzo Moneta wrote:
> Hi,
>
> If you are using TMInuit you need to pass the function to be minimized as a free global function, so all the extra data needed in the function must be global.
> You can however use the new C++ version of Minuit, Minuit2 which has an OO interface, where your function to be minimized can be an object implementing a well defined interface.
> The best way to use Minuit2 (and also TMinuit) is by using the ROOT::Math::Minimizer interface. In this case the library will be loaded automatically via the plug-in manager, you can use the same code for both algorithms and in the case of TMinuit the problems with the global is also hided from the user (it is done internally and you can pass an object a s a function).
>
> An example to use this interface for Minuit and Minuit2 is the tutorial NumericalMinimization.C, see
>
> http://root.cern.ch/root/html/tutorials/fit/NumericalMinimization.C.html
>
>
> and see also
> http://root.cern.ch/drupal/content/numerical-minimization#multidim_minim
>
> and
> http://root.cern.ch/drupal/content/how-implement-mathematical-function-inside-framework
>
> to see how to pass a function object.
> Also these post could be useful:
>
> http://root.cern.ch/phpBB3//viewtopic.php?f=15&t=12972&p=55781&hilit=NUmericalMinimization#p55915
> http://root.cern.ch/phpBB3//viewtopic.php?f=15&t=12649&p=54581&hilit=NUmericalMinimization#p54581
>
> Best Regards
>
> Lorenzo
> On Jul 12, 2011, at 11:26 AM, Hermann Fuchs wrote:
>
> > Hello
> >
> > I am trying to use TMinuit in order to optimize some functions.
> > It seems there is no real tutorial using TMinuit (I found plenty of code
> > for the old standalone Minuit,though).
> >
> > It seems to me, in order to calculate chisquare or simply a difference
> > between the optimized function and a reference function, the reference
> > data has to be in a global variable.
> > Is there a way around that?
> >
> > The Minuit optimization is only a very small part of my program so I
> > would like to avoid having a lot of data in global variables.
> > I have attached my current source file to provide a basis for the
> > discussion.
> >
> > Cheers,
> > Hermann
> >
> > --
> > -------------
> > DI Hermann Fuchs
> > Div. Medical Radiation Physics
> > Department of Radiotherapy
> > Med. Univ. Vienna / AKH Vienna
> > Währinger Gürtel 18-20
> > A-1090 Wien
> >
> > Tel. + 43 / 1 / 40 400 7271
> > Mail. hermann.fuchs_at_meduniwien.ac.at
> > <tosend.cpp>
>
>

-- 
-------------
DI Hermann Fuchs
Div. Medical Radiation Physics
Department of Radiotherapy
Med. Univ. Vienna / AKH Vienna
Währinger Gürtel 18-20
A-1090 Wien

Tel.  + 43 / 1 / 40 400 7271
Mail. hermann.fuchs_at_meduniwien.ac.at
Received on Wed Jul 13 2011 - 08:54:53 CEST

This archive was generated by hypermail 2.2.0 : Fri Jul 15 2011 - 23:50:01 CEST