[root] / trunk / math / mathcore / inc / Fit / FitConfig.h Repository:
ViewVC logotype

View of /trunk/math/mathcore/inc/Fit/FitConfig.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 25486 - (download) (as text) (annotate)
Mon Sep 22 12:43:03 2008 UTC (6 years, 4 months ago) by moneta
File size: 5241 byte(s)
import changes from math development branches for subdirectory math. List of changes in detail: 

mathcore: 
---------
  MinimizerOptions: 
	new  class for storing Minimizer option, with static default values that can be 
	changed by the user

  FitConfig: 
   	- use default values from MinimizerOption class
   	- rename method to create parameter settings from a function

  FitUtil.cxx:   
    	improve the derivative calculations used in the effective chi2 and in Fumili and 
	fix a bug for evaluation of likelihood or chi2 terms. 
	In  EvaluatePdf() work and return  the log of the pdf. 
      
  FitResult:
	- improve the class by adding extra information like, num. of free parameters, 
	minimizer status, global correlation coefficients, information about fixed 
	and bound parameters. 
   	- add method for getting fit confidence intervals 
  	- improve print method   

  DataRange: 
	add method SetRange to distinguish from AddRange. SetRange deletes the existing 
	ranges. 

  ParamsSettings: make few methods const

  FCN functions (Chi2FCN, LogLikelihoodFCN, etc..) 
	move some common methods and data members in base class (FitMethodFunction)

  RootFinder: add template Solve() for any callable function.  

mathmore:
--------
  minimizer classes: fill status information
  GSLNLSMinimizer: return error and covariance matrix 

minuit2: 
-------
  Minuit2Minimizer: fill  status information 
  DavidonErrorUpdator: check that delgam or gvg are not zero ( can happen when dg = 0)
  FumiliFCNAdapter: work on the log of pdf

minuit:
------- 
  TLinearMinimizer: add support for robust fitting
  TMinuitMinimizer: fill status information and fix a bug in filling the correlation matrix. 
 fumili:
 ------ 
  add TFumiliMinimizer: 
	wrapper class for TFumili using Minimizer interface

// @(#)root/mathcore:$Id$
// Author: L. Moneta Thu Sep 21 16:21:29 2006

/**********************************************************************
 *                                                                    *
 * Copyright (c) 2006  LCG ROOT Math Team, CERN/PH-SFT                *
 *                                                                    *
 *                                                                    *
 **********************************************************************/

// Header file for class FitConfig

#ifndef ROOT_Fit_FitConfig
#define ROOT_Fit_FitConfig


#ifndef ROOT_Fit_ParameterSettings
#include "Fit/ParameterSettings.h"
#endif

#ifndef ROOT_Fit_MinimizerControlParams
#include "Fit/MinimizerControlParams.h"
#endif

#ifndef ROOT_Math_IParamFunctionfwd
#include "Math/IParamFunctionfwd.h"
#endif


#include <vector>

namespace ROOT { 

   namespace Math { 

      class Minimizer;
      class MinimizerOptions; 
   }

   namespace Fit { 

//___________________________________________________________________________________
/** 
   Class describing the configuration of the fit, options and parameter settings
   using the ROOT::Fit::ParameterSettings class 

   @ingroup FitMain
*/ 
class FitConfig {

public: 

   /** 
      Default constructor
   */ 
   FitConfig (unsigned int npar = 0); 

   /** 
      Destructor 
   */ 
   ~FitConfig ();    

   /**
      get the parameter settings for the i-th parameter (const method)
   */
   const ParameterSettings & ParSettings(unsigned int i) const { return fSettings.at(i); }

   /**
      get the parameter settings for the i-th parameter (non-const method)
   */
   ParameterSettings & ParSettings(unsigned int i) { return fSettings.at(i); }

   /**
      get the vector of parameter settings  (const method)
   */
   const std::vector<ROOT::Fit::ParameterSettings> & ParamsSettings() const { return fSettings; }

   /**
      get the vector of parameter settings  (non-const method)
   */
   std::vector<ROOT::Fit::ParameterSettings> & ParamsSettings() { return fSettings; }


   /**
      set the parameter settings from a model function. 
      Create always new parameter setting list from a given model function  
   */
   void CreateParamsSettings(const ROOT::Math::IParamMultiFunction & func); 

   /**
      set the parameter settings from number of parameters and a vector of values and optionally step values. If there are not existing or number of parameters does not match existing one, create a new parameter setting list. 
   */
   void SetParamsSettings(unsigned int npar, const double * params, const double * vstep = 0); 


   /**
      create a new minimizer according to chosen configuration
   */
   ROOT::Math::Minimizer * CreateMinimizer(); 


   /**
      access to the minimizer  control parameter (const method) 
   */
   const MinimizerControlParams & MinimizerOptions() const { return fMinimizerOpts; } 

   /**
      access to the minimizer  control parameter (non const method) 
   */
   MinimizerControlParams & MinimizerOptions()  { return fMinimizerOpts; } 


#ifndef __CINT__   // this method fails on Windows
   /**
      set all the minimizer options using class MinimizerOptions
    */
   void SetMinimizerOptions(const ROOT::Math::MinimizerOptions & minopt); 
#endif

   
   /**
      set minimizer type 
   */
   void SetMinimizer(const std::string & type, std::string algo = "") { 
      fMinimizerType = type; 
      fMinimAlgoType = algo; 
   } 

   /**
      return type of minimizer package
   */
   const std::string & MinimizerType() const { return fMinimizerType; } 

   /**
      return type of minimizer algorithms 
   */
   const std::string & MinimizerAlgoType() const { return fMinimAlgoType; } 


   /**
      flag to check if resulting errors are be normalized according to chi2/ndf 
   */
   bool NormalizeErrors() const { return fNormErrors; } 

   ///do analysis for parabolic errors
   bool ParabErrors() const { return fParabErrors; }

   ///do minos errros analysis on all parameters
   bool MinosErrors() const { return fMinosErrors; }

   /**
      set the option to normalize the error on the result  according to chi2/ndf
   */
   void SetNormErrors(bool on) { fNormErrors= on; }

   ///set parabolic erros
   void SetParabErrors(bool on) { fParabErrors = on; } 

   ///set Minos erros
   void SetMinosErrors(bool on) { fMinosErrors = on; } 



   /**
      static function to control default minimizer type and algorithm
   */
   static void SetDefaultMinimizer(const std::string & type, const std::string & algo = ""); 


protected: 


private: 

   bool fNormErrors;    // flag for error normalization
   bool fParabErrors;   // get correct parabolic errors estimate (call Hesse after minimizing)  
   bool fMinosErrors;   // do full error analysis using Minos


   std::vector<ROOT::Fit::ParameterSettings> fSettings;  // vector with the parameter settings

   std::string fMinimizerType;  // minimizer type (MINUIT, MINUIT2, etc..)
   std::string fMinimAlgoType;  // algorithm type (MIGRAD, SIMPLEX, etc..)
   MinimizerControlParams fMinimizerOpts;   //minimizer control parameters

}; 

   } // end namespace Fit

} // end namespace ROOT


#endif /* ROOT_Fit_FitConfig */

Subversion Admin
ViewVC Help
Powered by ViewVC 1.0.9