ROOT logo
// @(#)root/minuit:$Id: TLinearMinimizer.h 34753 2010-08-10 10:02:27Z moneta $
// Author: L. Moneta Wed Oct 25 16:28:55 2006

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

// Header file for class TLinearMinimizer

#ifndef ROOT_TLinearMinimizer
#define ROOT_TLinearMinimizer

#ifndef ROOT_Math_Minimizer
#include "Math/Minimizer.h"
#endif

#ifndef ROOT_Rtypes
#include "Rtypes.h"
#endif

#include <vector>

class TLinearFitter; 


 

/** 
   TLinearMinimizer class: minimizer implementation based on TMinuit.
*/ 
class TLinearMinimizer  : public ROOT::Math::Minimizer {

public: 

   /** 
      Default constructor
   */ 
   TLinearMinimizer (int type = 0); 

   /** 
      Constructor from a char * (used by PM)
   */ 
   TLinearMinimizer ( const char * type ); 

   /** 
      Destructor (no operations)
   */ 
   virtual ~TLinearMinimizer (); 

private:
   // usually copying is non trivial, so we make this unaccessible

   /** 
      Copy constructor
   */ 
   TLinearMinimizer(const TLinearMinimizer &); 

   /** 
      Assignment operator
   */ 
   TLinearMinimizer & operator = (const TLinearMinimizer & rhs); 

public: 

   /// set the fit model function
   virtual void SetFunction(const ROOT::Math::IMultiGenFunction & func); 

   /// set the function to minimize
   virtual void SetFunction(const ROOT::Math::IMultiGradFunction & func); 

   /// set free variable (dummy impl. )
   virtual bool SetVariable(unsigned int , const std::string & , double , double ) { return false; } 

   /// set fixed variable (override if minimizer supports them )
   virtual bool SetFixedVariable(unsigned int /* ivar */, const std::string & /* name */, double /* val */);  

   /// method to perform the minimization
   virtual  bool Minimize(); 

   /// return minimum function value
   virtual double MinValue() const { return fMinVal; } 

   /// return expected distance reached from the minimum
   virtual double Edm() const { return 0; }

   /// return  pointer to X values at the minimum 
   virtual const double *  X() const { return &fParams.front(); }

   /// return pointer to gradient values at the minimum 
   virtual const double *  MinGradient() const { return 0; } // not available in Minuit2 

   /// number of function calls to reach the minimum 
   virtual unsigned int NCalls() const { return 0; } 

   /// this is <= Function().NDim() which is the total 
   /// number of variables (free+ constrained ones) 
   virtual unsigned int NDim() const { return fDim; }   

   /// number of free variables (real dimension of the problem) 
   /// this is <= Function().NDim() which is the total 
   virtual unsigned int NFree() const { return fNFree; }  

   /// minimizer provides error and error matrix
   virtual bool ProvidesError() const { return true; } 

   /// return errors at the minimum 
   virtual const double * Errors() const { return  (fErrors.empty()) ? 0 : &fErrors.front(); }

   /** return covariance matrices elements 
       if the variable is fixed the matrix is zero
       The ordering of the variables is the same as in errors
   */ 
   virtual double CovMatrix(unsigned int i, unsigned int j) const { 
      return (fCovar.empty()) ? 0 : fCovar[i + fDim* j]; 
   }

   /// return covariance matrix status
   virtual int CovMatrixStatus() const { 
      if (fCovar.size() == 0) return 0; 
      return (fStatus ==0) ? 3 : 1; 
   }

   /// return reference to the objective function
   ///virtual const ROOT::Math::IGenFunction & Function() const; 


   

protected: 

private: 

   bool fRobust; 
   unsigned int fDim; 
   unsigned int fNFree;
   double fMinVal;
   std::vector<double> fParams;
   std::vector<double> fErrors;
   std::vector<double> fCovar; 

   const ROOT::Math::IMultiGradFunction * fObjFunc;
   TLinearFitter * fFitter; 

   ClassDef(TLinearMinimizer,1)  //Implementation of the Minimizer interface using TLinearFitter 

}; 



#endif /* ROOT_TLinearMinimizer */
 TLinearMinimizer.h:1
 TLinearMinimizer.h:2
 TLinearMinimizer.h:3
 TLinearMinimizer.h:4
 TLinearMinimizer.h:5
 TLinearMinimizer.h:6
 TLinearMinimizer.h:7
 TLinearMinimizer.h:8
 TLinearMinimizer.h:9
 TLinearMinimizer.h:10
 TLinearMinimizer.h:11
 TLinearMinimizer.h:12
 TLinearMinimizer.h:13
 TLinearMinimizer.h:14
 TLinearMinimizer.h:15
 TLinearMinimizer.h:16
 TLinearMinimizer.h:17
 TLinearMinimizer.h:18
 TLinearMinimizer.h:19
 TLinearMinimizer.h:20
 TLinearMinimizer.h:21
 TLinearMinimizer.h:22
 TLinearMinimizer.h:23
 TLinearMinimizer.h:24
 TLinearMinimizer.h:25
 TLinearMinimizer.h:26
 TLinearMinimizer.h:27
 TLinearMinimizer.h:28
 TLinearMinimizer.h:29
 TLinearMinimizer.h:30
 TLinearMinimizer.h:31
 TLinearMinimizer.h:32
 TLinearMinimizer.h:33
 TLinearMinimizer.h:34
 TLinearMinimizer.h:35
 TLinearMinimizer.h:36
 TLinearMinimizer.h:37
 TLinearMinimizer.h:38
 TLinearMinimizer.h:39
 TLinearMinimizer.h:40
 TLinearMinimizer.h:41
 TLinearMinimizer.h:42
 TLinearMinimizer.h:43
 TLinearMinimizer.h:44
 TLinearMinimizer.h:45
 TLinearMinimizer.h:46
 TLinearMinimizer.h:47
 TLinearMinimizer.h:48
 TLinearMinimizer.h:49
 TLinearMinimizer.h:50
 TLinearMinimizer.h:51
 TLinearMinimizer.h:52
 TLinearMinimizer.h:53
 TLinearMinimizer.h:54
 TLinearMinimizer.h:55
 TLinearMinimizer.h:56
 TLinearMinimizer.h:57
 TLinearMinimizer.h:58
 TLinearMinimizer.h:59
 TLinearMinimizer.h:60
 TLinearMinimizer.h:61
 TLinearMinimizer.h:62
 TLinearMinimizer.h:63
 TLinearMinimizer.h:64
 TLinearMinimizer.h:65
 TLinearMinimizer.h:66
 TLinearMinimizer.h:67
 TLinearMinimizer.h:68
 TLinearMinimizer.h:69
 TLinearMinimizer.h:70
 TLinearMinimizer.h:71
 TLinearMinimizer.h:72
 TLinearMinimizer.h:73
 TLinearMinimizer.h:74
 TLinearMinimizer.h:75
 TLinearMinimizer.h:76
 TLinearMinimizer.h:77
 TLinearMinimizer.h:78
 TLinearMinimizer.h:79
 TLinearMinimizer.h:80
 TLinearMinimizer.h:81
 TLinearMinimizer.h:82
 TLinearMinimizer.h:83
 TLinearMinimizer.h:84
 TLinearMinimizer.h:85
 TLinearMinimizer.h:86
 TLinearMinimizer.h:87
 TLinearMinimizer.h:88
 TLinearMinimizer.h:89
 TLinearMinimizer.h:90
 TLinearMinimizer.h:91
 TLinearMinimizer.h:92
 TLinearMinimizer.h:93
 TLinearMinimizer.h:94
 TLinearMinimizer.h:95
 TLinearMinimizer.h:96
 TLinearMinimizer.h:97
 TLinearMinimizer.h:98
 TLinearMinimizer.h:99
 TLinearMinimizer.h:100
 TLinearMinimizer.h:101
 TLinearMinimizer.h:102
 TLinearMinimizer.h:103
 TLinearMinimizer.h:104
 TLinearMinimizer.h:105
 TLinearMinimizer.h:106
 TLinearMinimizer.h:107
 TLinearMinimizer.h:108
 TLinearMinimizer.h:109
 TLinearMinimizer.h:110
 TLinearMinimizer.h:111
 TLinearMinimizer.h:112
 TLinearMinimizer.h:113
 TLinearMinimizer.h:114
 TLinearMinimizer.h:115
 TLinearMinimizer.h:116
 TLinearMinimizer.h:117
 TLinearMinimizer.h:118
 TLinearMinimizer.h:119
 TLinearMinimizer.h:120
 TLinearMinimizer.h:121
 TLinearMinimizer.h:122
 TLinearMinimizer.h:123
 TLinearMinimizer.h:124
 TLinearMinimizer.h:125
 TLinearMinimizer.h:126
 TLinearMinimizer.h:127
 TLinearMinimizer.h:128
 TLinearMinimizer.h:129
 TLinearMinimizer.h:130
 TLinearMinimizer.h:131
 TLinearMinimizer.h:132
 TLinearMinimizer.h:133
 TLinearMinimizer.h:134
 TLinearMinimizer.h:135
 TLinearMinimizer.h:136
 TLinearMinimizer.h:137
 TLinearMinimizer.h:138
 TLinearMinimizer.h:139
 TLinearMinimizer.h:140
 TLinearMinimizer.h:141
 TLinearMinimizer.h:142
 TLinearMinimizer.h:143
 TLinearMinimizer.h:144
 TLinearMinimizer.h:145
 TLinearMinimizer.h:146
 TLinearMinimizer.h:147
 TLinearMinimizer.h:148
 TLinearMinimizer.h:149
 TLinearMinimizer.h:150
 TLinearMinimizer.h:151
 TLinearMinimizer.h:152
 TLinearMinimizer.h:153