1
0
mirror of https://github.com/aportelli/LatAnalyze.git synced 2024-11-10 08:55:37 +00:00

compatible with Minuit2 in ROOT

This commit is contained in:
Antonin Portelli 2021-11-16 21:34:25 +00:00
parent d4704267d6
commit b4b6bd22fa
3 changed files with 37 additions and 10 deletions

View File

@ -1,6 +1,5 @@
#!/usr/bin/env bash
NAME='Minuit2-5.34.14'
if (( $# != 1 )); then
echo "usage: `basename $0` <prefix>" 1>&2
@ -14,11 +13,11 @@ mkdir -p ${PREFIX}
cd ${PREFIX}
PREFIX=$(pwd -P)
cd ${INITDIR}/local/build
wget http://www.cern.ch/mathlibs/sw/5_34_14/Minuit2/${NAME}.tar.gz
tar -xzvf ${NAME}.tar.gz
mkdir -p ${NAME}/build
cd ${NAME}/build
../configure --prefix=${PREFIX} --disable-openmp
rm -rf root
git clone https://github.com/root-project/root.git
cd root/math/minuit2/
mkdir build; cd build
cmake .. -Dminuit2_standalone=ON -DCMAKE_INSTALL_PREFIX=${PREFIX}
make -j4
make install
cd ${INITDIR}/local

View File

@ -36,7 +36,7 @@ AC_ARG_WITH([gsl],
AC_ARG_WITH([minuit],
[AS_HELP_STRING([--with-minuit=prefix],
[try this for a non-standard install prefix of the Minuit2 library])],
[AM_CXXFLAGS="$AM_CXXFLAGS -I$with_minuit/include"]
[AM_CXXFLAGS="$AM_CXXFLAGS -I$with_minuit/include -I$with_minuit/include/Minuit2 -I$with_minuit/include/Fit"]
[AM_LDFLAGS="$AM_LDFLAGS -L$with_minuit/lib"])
AC_ARG_WITH([nlopt],
[AS_HELP_STRING([--with-nlopt=prefix],
@ -90,10 +90,10 @@ AC_CHECK_LIB([hdf5_cpp],[H5Fopen],
[AC_MSG_ERROR([HDF5 library not found])], [-lhdf5])
SAVED_LDFLAGS=$LDFLAGS
LDFLAGS="$LDFLAGS -lMinuit2"
AC_MSG_CHECKING([for ROOT::Minuit2::BasicMinimumError in -lMinuit2]);
AC_MSG_CHECKING([for ROOT::Minuit2::VariableMetricMinimizer in -lMinuit2]);
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([#include <Minuit2/BasicMinimumError.h>],
[ROOT::Minuit2::BasicMinimumError dummy(0)])],
[AC_LANG_PROGRAM([#include <Minuit2/VariableMetricMinimizer.h>],
[ROOT::Minuit2::VariableMetricMinimizer dummy()])],
[LIBS="$LIBS -lMinuit2"]
[AC_DEFINE([HAVE_MINUIT2],
[1],
@ -103,6 +103,20 @@ AC_LINK_IFELSE(
[have_minuit=false]
[AC_MSG_RESULT([no])])
AM_CONDITIONAL([HAVE_MINUIT], [test x$have_minuit = xtrue])
LDFLAGS="$LDFLAGS -lMinuit2Math"
AC_MSG_CHECKING([for ROOT::Math::MinimizerOptions in -lMinuit2Math]);
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([#include <Minuit2/Math/MinimizerOptions.h>],
[ROOT::Math::MinimizerOptions dummy()])],
[LIBS="$LIBS -lMinuit2Math"]
[AC_DEFINE([HAVE_MINUIT2MATH],
[1],
[Define to 1 if you have the `Minuit2Math' library (-lMinuit2Math).])]
[have_minuitmath=true]
[AC_MSG_RESULT([yes])],
[have_minuitmath=false]
[AC_MSG_RESULT([no])])
AM_CONDITIONAL([HAVE_MINUITMATH], [test x$have_minuit = xtrue])
LDFLAGS=$SAVED_LDFLAGS
CXXFLAGS=$CXXFLAGS_CPY
LDFLAGS=$LDFLAGS_CPY

View File

@ -19,6 +19,20 @@
#include <LatAnalyze/Numerical/MinuitMinimizer.hpp>
#include <LatAnalyze/includes.hpp>
// forward declaration necessary in the ROOT-based version of Minuit2
namespace ROOT
{
namespace Fit
{
class ParameterSettings;
};
};
// macros necessary in the ROOT-based version of Minuit2
#define ROOT_Math_VecTypes
#define MATHCORE_STANDALONE
#include <Minuit2/Minuit2Minimizer.h>
#include <Math/Functor.h>