MathCore
MathCore contains now the classes in the math directory, TMath, TComplex and the TRandom classes. This implies that all other ROOT library using one of these classes, such as libHist, have a direct dependency on the Mathcore library.
Linking with libMathCore is therefore required for running any major ROOT application. It has been added to the list of libraries obtained when doing root-config --libs.
N.B. users building ROOT applications and not using root-config MUST add libMathCore to their list of linking libraries.
Together with the libraries merge, many changes have been applied to both TMath and the other mathcore classes.
TMath
A major clean-up and re-structuring has been performed for the TMath functions. In particular some functions have been implemented using STL algorithms which have shown for these case better berformances in term of CPU time. The file TMathImp.h contains the implementations for the template functions.
Some of the basic special functions of TMath, like the error function or the gamma and beta functions use now the Cephes implementation from Stephen L. Moshier, which is used by the ROOT::Math functions and it has been found to be more accurate and in some cases even faster.
- use template functions instead of having the same function for all the various basic types, for functions like TMath::Mean,TMath::GeomMean, TMath::Median, TMath::KOrdStat
- re-implement TMath::LocMin and TMath::LocMax using the STL algorithms std::min_element and std::max_element
- re-implement TMath::Sort using std::sort.
- TMath::Erf and TMath::Erfc call ROOT::Math::erf and ROOT::math::erfc which are implemented using the Cephes algorithms
- TMath::Gamma(z) is implemented with ROOT::Math::tgamma and the incomplete gamma function, TMath::Gamma(a,x) it is implemented using ROOT::Math::inc_gamma. This affects also other functions which use the gamma or incomplete gamma functions, like TMath::Prob (the upper chi2 probability)
- TMath::LnGamma(z) is also implemented using ROOT::Math::lgamma. This affects also TMath::Beta which is implemented using the log of the gamma function.
- TMath::BetaIncomplete is implemented using ROOT::Math::beta_inc.
More detailed information on the new mathematical functions can be found in this presentation from M. Slawinska.
GenVector
The new physics vector classes have been moved out from the MathCore library in a new library, libGenVector. The library contains as well the CINT dictionary including main instantiations for the template classes.
Fit
Mathcore include now new classes for performing fits and minimization of multi-dimensional functions. These aim of these classes is to extend and improve the fitting functionality provided in ROOT via the TVirtualFitter classes and the Fit method present in many data analysis object, such as TH1.
The fit data are decoupled from the fitter class and described by the ROOT::Fit::BinData for bin data containing coordinate values of any dimensions, bin content values and optionally errors in coordinate and bin content, and ROOT::Fit::UnBinData classes for any dimension un-bin data.
The fitter class provides the support for fitting those data with any model function implementing the parametric function interface, ROOT::Math::IParamMultiFunction. Fit methods such as least square, bin and un-bin likelihood are supported. The fit solution is found by using the ROOT::Math::Minimizer class.
Various implementation can be used automatically using the ROOT plug-in manager mechanism, including the linear fitter for a fast and direct solution, in case of a linear least square model, or by using Minuit, Minuit2 or GSL minimization methods provided by the MathMore library.
Functions for filling the new ROOT::Fit::BinData classes with all the histogram and graph types have been added in the histogram library (libHist) and graph library:
- ROOT::Fit::FillData( BinData & , const TH1 *, TF1 * ) for histograms (in libHist)
- ROOT::Fit::FillData( BinData & , const TGraph2D *, TF1 * ) for 2D graphs (in libHist)
- ROOT::Fit::FillData( BinData & , const TGraph *, TF1 * ) for all 1D graphs (in libGraf)
- ROOT::Fit::FillData( BinData & , const TMultiGraph *, TF1 * ) for multi-graphs (in libGraf)
Additional MathCore changes
- New classes GaussIntegrator and GaussLegendreIntegrator for numerical integration of one-dimensional functions. The first class uses Gaussian 8 and 16 point quadrature approximation, it provides the translation of the CERNLIB algorith
DGAUSS by Sigfried Kolbig, and it is used by the TF1::Integral method. The second one uses the Gauss Legendre quadrature formula. It is used by the TF1::IntegralFast method.
These classes implement both the same virtual interface as the adaptive integration methods provided by the MathMore library. They can all be created and used easly via the entry class ROOT::Math::IntegratorOneDim.
- New class ROOT::Math::RichardsonDerivator implementing numerical derivation using the Richardson's extrapolation formula (use 2 derivative estimates to compute a third, more accurate estimation). This is used by the TD1::Derivative method.
- New class BrentRootFinder for finding the root of one-dimensional function using the Brent algorithm. The class inherits from a virtual interface, which is also implemented by the MathMore root finder methods. The user can therefore by using the ROOT::Math::RootFinder class instantiates the various root finder algorithms
. The BrentRootFinder class is used by the TF1::GetX. A similar clas, BrentMinimizer1D provides the possibility to find the minimum one-dimensional function using the Brent algorithm. This class is used by TF1::GetMinimum or TF1::GetMaximum
More detailed description of the current MathCore release can be found at this location.
MathMore
This new release contains:
- Modify and rename the class ROOT::Math::RootFinder to ROOT::Math::GSLRootFinder to distinguish from the main interface class which has been put in the Mathcore library and it can create the GSLRootFinder using the plug-in manager. Furthermore, the class ROOT::Math::GSLRootFinder is not anymore a template class on the algorithm. They type of root-finder algorithm can now be selected via an enumeration
- Fixed a bug in the ROOT::Math::GSLNLSMutiFi class.
More detailed description of the current MathMore release can be found at this location.
Hist
The hist library now depends on libMathCore which must be linked whenever one needs to use the histogram library.
The major changes have been done in the TF1 class.
-
The code used for implementing methods like TF1::Integration or TF1::Derivation or TF1::GetX has now been moved in MathCore, but it remains the same.
- A new method TF1::operator()(double x, double y=0, double z) which is equivalent to TF1::Eval has been added for using TF1 as a callable object.
Minuit
Two new classes have been added:
- TMinuitMinimizer: implementation of the ROOT::Math::Minimizer interface with TMinuit. This class is used for example by the new Fitter class.
- TLinearMinimizer: implementation of the ROOT::Math::Minimizer interface with the TLinearFitter.
In addition, the method TLinearFitter::SetBasisFunction(TObjArray * f) has been added to set directly the linear terms of the fit function.