Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TLinearMinimizer.h
Go to the documentation of this file.
1// @(#)root/minuit:$Id$
2// Author: L. Moneta Wed Oct 25 16:28:55 2006
3
4/**********************************************************************
5 * *
6 * Copyright (c) 2006 LCG ROOT Math Team, CERN/PH-SFT *
7 * *
8 * *
9 **********************************************************************/
10
11// Header file for class TLinearMinimizer
12
13#ifndef ROOT_TLinearMinimizer
14#define ROOT_TLinearMinimizer
15
16#include "Math/Minimizer.h"
17
18#include "Rtypes.h"
19
20#include <vector>
21#include <string>
22
23class TLinearFitter;
24
25
26
27
28/**
29 TLinearMinimizer class: minimizer implementation based on TMinuit.
30*/
32
33public:
34
35 /**
36 Default constructor
37 */
38 TLinearMinimizer (int type = 0);
39
40 /**
41 Constructor from a char * (used by PM)
42 */
43 TLinearMinimizer ( const char * type );
44
45 /**
46 Destructor (no operations)
47 */
48 ~TLinearMinimizer () override;
49
50 /// set the fit model function
51 void SetFunction(const ROOT::Math::IMultiGenFunction & func) override;
52
53 /// set free variable (dummy impl. since there is no need to set variables in the Linear Fitter)
54 bool SetVariable(unsigned int , const std::string & , double , double ) override { return true; }
55
56 /// set fixed variable (override if minimizer supports them )
57 bool SetFixedVariable(unsigned int /* ivar */, const std::string & /* name */, double /* val */) override;
58
59 /// method to perform the minimization
60 bool Minimize() override;
61
62 /// return minimum function value
63 double MinValue() const override { return fMinVal; }
64
65 /// return expected distance reached from the minimum
66 double Edm() const override { return 0; }
67
68 /// return pointer to X values at the minimum
69 const double * X() const override { return &fParams.front(); }
70
71 /// return pointer to gradient values at the minimum
72 const double * MinGradient() const override { return nullptr; } // not available in Minuit2
73
74 /// number of function calls to reach the minimum
75 unsigned int NCalls() const override { return 0; }
76
77 /// this is <= Function().NDim() which is the total
78 /// number of variables (free+ constrained ones)
79 unsigned int NDim() const override { return fDim; }
80
81 /// number of free variables (real dimension of the problem)
82 /// this is <= Function().NDim() which is the total
83 unsigned int NFree() const override { return fNFree; }
84
85 /// minimizer provides error and error matrix
86 bool ProvidesError() const override { return true; }
87
88 /// return errors at the minimum
89 const double * Errors() const override { return fErrors.empty() ? nullptr : &fErrors.front(); }
90
91 /** return covariance matrices elements
92 if the variable is fixed the matrix is zero
93 The ordering of the variables is the same as in errors
94 */
95 double CovMatrix(unsigned int i, unsigned int j) const override {
96 return (fCovar.empty()) ? 0 : fCovar[i + fDim* j];
97 }
98
99 /// return covariance matrix status
100 int CovMatrixStatus() const override {
101 if (fCovar.empty()) return 0;
102 return (fStatus ==0) ? 3 : 1;
103 }
104
105 /// return reference to the objective function
106 ///virtual const ROOT::Math::IGenFunction & Function() const;
107
108
109
110
111protected:
112
113private:
114
116 unsigned int fDim;
117 unsigned int fNFree;
118 double fMinVal;
119 std::vector<double> fParams;
120 std::vector<double> fErrors;
121 std::vector<double> fCovar;
122
125
126 ClassDef(TLinearMinimizer,1) //Implementation of the Minimizer interface using TLinearFitter
127
128};
129
130
131
132#endif /* ROOT_TLinearMinimizer */
#define ClassDef(name, id)
Definition Rtypes.h:342
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
Documentation for the abstract class IBaseFunctionMultiDim.
Definition IFunction.h:61
Interface (abstract class) for multi-dimensional functions providing a gradient calculation.
Definition IFunction.h:168
Abstract Minimizer class, defining the interface for the various minimizer (like Minuit2,...
Definition Minimizer.h:119
int fStatus
status of minimizer
Definition Minimizer.h:371
TLinearMinimizer class: minimizer implementation based on TMinuit.
double CovMatrix(unsigned int i, unsigned int j) const override
return covariance matrices elements if the variable is fixed the matrix is zero The ordering of the v...
bool ProvidesError() const override
minimizer provides error and error matrix
void SetFunction(const ROOT::Math::IMultiGenFunction &func) override
set the fit model function
double MinValue() const override
return minimum function value
TLinearFitter * fFitter
~TLinearMinimizer() override
Destructor (no operations)
bool fRobust
return reference to the objective function virtual const ROOT::Math::IGenFunction & Function() const;
const double * X() const override
return pointer to X values at the minimum
unsigned int NDim() const override
this is <= Function().NDim() which is the total number of variables (free+ constrained ones)
bool SetVariable(unsigned int, const std::string &, double, double) override
set free variable (dummy impl. since there is no need to set variables in the Linear Fitter)
int CovMatrixStatus() const override
return covariance matrix status
const double * Errors() const override
return errors at the minimum
const ROOT::Math::IMultiGradFunction * fObjFunc
bool Minimize() override
method to perform the minimization
double Edm() const override
return expected distance reached from the minimum
std::vector< double > fParams
std::vector< double > fCovar
std::vector< double > fErrors
unsigned int NFree() const override
number of free variables (real dimension of the problem) this is <= Function().NDim() which is the to...
const double * MinGradient() const override
return pointer to gradient values at the minimum
unsigned int NCalls() const override
number of function calls to reach the minimum
bool SetFixedVariable(unsigned int, const std::string &, double) override
set fixed variable (override if minimizer supports them )