Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TMinuitMinimizer.cxx
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// Implementation file for class TMinuitMinimizer
12
13#include "TMinuitMinimizer.h"
14#include "Math/IFunction.h"
16
17#include "TMinuit.h"
18#include "TROOT.h"
19#include "TList.h"
20
21#include "TGraph.h" // needed for scan
22#include "TError.h"
23
24#include "TMatrixDSym.h" // needed for inverting the matrix
25
26#include "ThreadLocalStorage.h"
27
28#include <cassert>
29#include <algorithm>
30#include <functional>
31#include <cmath>
32
33////////////////////////////////////////////////////////////////////////////////
34/// \class TMinuitMinimizer
35/// \see Minuit2 for a newer version of this class
36/// TMinuitMinimizer class implementing the ROOT::Math::Minimizer interface
37/// using TMinuit. This class is normally instantiated using the plug-in manager
38/// (plug-in with name Minuit or TMinuit).
39/// In addition the user can choose the minimizer algorithm:
40/// Migrad (the default one), Simplex, or Minimize (combined Migrad + Simplex)
41////////////////////////////////////////////////////////////////////////////////
42
43// initialize the static instances
44
45// Implement a thread local static member
47 TTHREAD_TLS(ROOT::Math::IMultiGenFunction *) fgFunc = nullptr;
48 return fgFunc;
49}
51bool TMinuitMinimizer::fgUsed = false;
52bool TMinuitMinimizer::fgUseStaticMinuit = true; // default case use static Minuit instance
53
55
56
58 fUsed(false),
59 fMinosRun(false),
60 fDim(ndim),
61 fType(type),
62 fMinuit(nullptr)
63{
64 // Constructor for TMinuitMinimier class via an enumeration specifying the minimization
65 // algorithm type. Supported types are : kMigrad, kSimplex, kCombined (a combined
66 // Migrad + Simplex minimization) and kMigradImproved (a Migrad mininimization folloed by an
67 // improved search for global minima). The default type is Migrad (kMigrad).
68
69 // initialize if npar is given
70 if (fDim > 0) InitTMinuit(fDim);
71}
72
73TMinuitMinimizer::TMinuitMinimizer(const char * type, unsigned int ndim ) :
74 fUsed(false),
75 fMinosRun(false),
76 fDim(ndim),
77 fMinuit(nullptr)
78{
79 // constructor from a char * for the algorithm type, used by the plug-in manager
80 // The names supported (case unsensitive) are:
81 // Migrad (default), Simplex, Minimize (for the combined Migrad+ Simplex) and Migrad_imp
82
83 // select type from the string
84 std::string algoname(type);
85 std::transform(algoname.begin(), algoname.end(), algoname.begin(), (int(*)(int)) tolower );
86
88 if (algoname == "simplex") algoType = ROOT::Minuit::kSimplex;
89 if (algoname == "minimize" ) algoType = ROOT::Minuit::kCombined;
90 if (algoname == "migradimproved" ) algoType = ROOT::Minuit::kMigradImproved;
91 if (algoname == "scan" ) algoType = ROOT::Minuit::kScan;
92 if (algoname == "seek" ) algoType = ROOT::Minuit::kSeek;
93
94 fType = algoType;
95
96 // initialize if npar is given
97 if (fDim > 0) InitTMinuit(fDim);
98
99}
100
102{
103 // Destructor implementation.
104 if (fMinuit && !fgUseStaticMinuit) {
105 delete fMinuit;
106 fgMinuit = nullptr;
107 }
108}
109
111 Minimizer()
112{
113 // Implementation of copy constructor (it is private).
114}
115
117{
118 // Implementation of assignment operator (private)
119 if (this == &rhs) return *this; // time saving self-test
120 return *this;
121}
122
124 // static method to control usage of global TMinuit instance
125 bool prev = fgUseStaticMinuit;
127 return prev;
128}
129
131
132 // when called a second time check dimension - create only if needed
133 // initialize the minuit instance - recreating a new one if needed
134 if (fMinuit ==nullptr || dim > fMinuit->fMaxpar) {
135
136 // case not using the global instance - recreate it all the time
137 if (fgUseStaticMinuit) {
138
139 // re-use gMinuit as static instance of TMinuit
140 // which can be accessed by the user after minimization
141 // check if fgMinuit is different than gMinuit
142 // case 1: fgMinuit not zero but fgMinuit has been deleted (not in gROOT): set to zero
143 // case 2: fgMinuit not zero and exists in global list : set fgMinuit to gMinuit
144 // case 3: fgMinuit zero - and gMinuit not zero: create a new instance locally to avoid conflict
145 if (fgMinuit != gMinuit) {
146 // if object exists in gROOT remove it to avoid a memory leak
147 if (fgMinuit ) {
148 if (gROOT->GetListOfSpecials()->FindObject(fgMinuit) == nullptr) {
149 // case 1: object does not exists in gROOT - means it has been deleted
150 fgMinuit = nullptr;
151 }
152 else {
153 // case 2: object exists - but gMinuit points to something else
154 // restore gMinuit to the one used before by TMinuitMinimizer
156 }
157 }
158 else {
159 // case 3: avoid reusing existing one - maintain fgMinuit to zero
160 // otherwise we will get a double delete if user deletes externally gMinuit
161 // in this case we will loose gMinuit instance
162// fgMinuit = gMinuit;
163// fgUsed = true; // need to reset in case other gMinuit instance is later used
164 }
165 }
166
167 // check if need to create a new TMinuit instance
168 if (fgMinuit == nullptr) {
169 fgUsed = false;
170 fgMinuit = new TMinuit(dim);
171 }
172 else if (fgMinuit->GetNumPars() != int(dim) ) {
173 delete fgMinuit;
174 fgUsed = false;
175 fgMinuit = new TMinuit(dim);
176 }
177
179 }
180
181 else {
182 // re- create all the time a new instance of TMinuit (fgUseStaticMinuit is false)
183 if (fMinuit) delete fMinuit;
184 fMinuit = new TMinuit(dim);
186 fgUsed = false;
187 }
188
189 } // endif fMinuit ==0 || dim > fMaxpar
190
191 fDim = dim;
192
194
195 // set print level in TMinuit
196 double arglist[1];
197 int ierr= 0;
198 // TMinuit level is shift by 1 -1 means 0;
199 arglist[0] = PrintLevel() - 1;
200 fMinuit->mnexcm("SET PRINT",arglist,1,ierr);
202}
203
204
206 // Set the objective function to be minimized, by passing a function object implement the
207 // basic multi-dim Function interface. In this case the derivatives will be
208 // calculated by Minuit
209 // Here a TMinuit instance is created since only at this point we know the number of parameters
210
211 const bool hasGrad = func.HasGradient();
212
213 fDim = func.NDim();
214
215 // create TMinuit if needed
217
218 // assign to the static pointer (NO Thread safety here)
219 GetGlobalFuncPtr() = const_cast<ROOT::Math::IMultiGenFunction *>(&func);
221
222 double arglist[1];
223 int ierr = 0;
224
225 if(hasGrad) {
226 // set gradient
227 // by default do not check gradient calculation
228 // it cannot be done here, check can be done only after having defined the parameters
229 arglist[0] = 1;
230 fMinuit->mnexcm("SET GRAD",arglist,1,ierr);
231 } else {
232 // switch off gradient calculations
233 fMinuit->mnexcm("SET NOGrad",arglist,0,ierr);
234 }
235}
236
237void TMinuitMinimizer::Fcn( int &, double * , double & f, double * x , int /* iflag */) {
238 // implementation of FCN static function used internally by TMinuit.
239 // Adapt IMultiGenFunction interface to TMinuit FCN static function
240 f = GetGlobalFuncPtr()->operator()(x);
241}
242
243void TMinuitMinimizer::FcnGrad( int &, double * g, double & f, double * x , int iflag ) {
244 // implementation of FCN static function used internally by TMinuit.
245 // Adapt IMultiGradFunction interface to TMinuit FCN static function in the case of user
246 // provided gradient.
248
249 assert(gFunc != nullptr);
250 f = gFunc->operator()(x);
251
252 // calculates also derivatives
253 if (iflag == 2) gFunc->Gradient(x,g);
254}
255
256bool TMinuitMinimizer::SetVariable(unsigned int ivar, const std::string & name, double val, double step) {
257 // set a free variable.
258 if (!CheckMinuitInstance()) return false;
259
261
262 // clear after minimization when setting params
263 if (fUsed) DoClear();
264
265 // check if parameter was defined and in case it was fixed, release it
267
268 int iret = fMinuit->DefineParameter(ivar , name.c_str(), val, step, 0., 0. );
269 return (iret == 0);
270}
271
272bool TMinuitMinimizer::SetLimitedVariable(unsigned int ivar, const std::string & name, double val, double step, double lower, double upper) {
273 // set a limited variable.
274 if (!CheckMinuitInstance()) return false;
275
277
278 // clear after minimization when setting params
279 if (fUsed) DoClear();
280
281 // check if parameter was defined and in case it was fixed, release it
283
284 int iret = fMinuit->DefineParameter(ivar, name.c_str(), val, step, lower, upper );
285 return (iret == 0);
286}
287
288bool TMinuitMinimizer::SetLowerLimitedVariable(unsigned int ivar , const std::string & name , double val , double step , double lower ) {
289 // set a lower limited variable
290 // since is not supported in TMinuit , just use a artificial large value
291 Warning("TMinuitMinimizer::SetLowerLimitedVariable","not implemented - use as upper limit 1.E7 instead of +inf");
292 return SetLimitedVariable(ivar, name, val , step, lower, lower+ 1.E7); // use 1.E7 which will make TMinuit happy
293}
294
295bool TMinuitMinimizer::SetUpperLimitedVariable(unsigned int ivar , const std::string & name , double val , double step , double upper ) {
296 // set a upper limited variable
297 // since is not supported in TMinuit , just use a artificial large negative value
298 Warning("TMinuitMinimizer::SetUpperLimitedVariable","not implemented - use as lower limit -1.E7 instead of -inf");
299 return SetLimitedVariable(ivar, name, val , step, upper -1.E7, upper);
300}
301
302
304 // check instance of fMinuit
305 if (fMinuit == nullptr) {
306 Error("TMinuitMinimizer::CheckMinuitInstance","Invalid TMinuit pointer. Need to call first SetFunction");
307 return false;
308 }
309 return true;
310}
311
312bool TMinuitMinimizer::CheckVarIndex(unsigned int ivar) const {
313 // check index of Variable (assume fMinuit exists)
314 if ((int) ivar >= fMinuit->fNu ) {
315 Error("TMinuitMinimizer::CheckVarIndex","Invalid parameter index");
316 return false;
317 }
318 return true;
319}
320
321
322bool TMinuitMinimizer::SetFixedVariable(unsigned int ivar, const std::string & name, double val) {
323 // set a fixed variable.
324 if (!CheckMinuitInstance()) return false;
325
326 // clear after minimization when setting params
328
329 // clear after minimization when setting params
330 if (fUsed) DoClear();
331
332 // put an arbitrary step (0.1*abs(value) otherwise TMinuit consider the parameter as constant
333 // constant parameters are treated differently (they are ignored inside TMinuit and not considered in the
334 // total list of parameters)
335 double step = ( val != 0) ? 0.1 * std::abs(val) : 0.1;
336 int iret = fMinuit->DefineParameter(ivar, name.c_str(), val, step, 0., 0. );
337 if (iret == 0) iret = fMinuit->FixParameter(ivar);
338 return (iret == 0);
339}
340
341bool TMinuitMinimizer::SetVariableValue(unsigned int ivar, double val) {
342 // set the value of an existing variable
343 // parameter must exist or return false
344 if (!CheckMinuitInstance()) return false;
345
346 double arglist[2];
347 int ierr = 0;
348
349 arglist[0] = ivar+1; // TMinuit starts from 1
350 arglist[1] = val;
351 fMinuit->mnexcm("SET PAR",arglist,2,ierr);
352 return (ierr==0);
353}
354
355bool TMinuitMinimizer::SetVariableStepSize(unsigned int ivar, double step) {
356 // set the step-size of an existing variable
357 // parameter must exist or return false
358 if (!CheckMinuitInstance()) return false;
359 // need to re-implement re-calling mnparm
360 // get first current parameter values and limits
361 double curval,err, lowlim, uplim;
362 int iuint; // internal index
364 fMinuit->mnpout(ivar, name, curval, err, lowlim, uplim,iuint);
365 if (iuint == -1) return false;
366 int iret = fMinuit->DefineParameter(ivar, name, curval, step, lowlim, uplim );
367 return (iret == 0);
368
369}
370
371bool TMinuitMinimizer::SetVariableLowerLimit(unsigned int ivar, double lower ) {
372 // set the limits of an existing variable
373 // parameter must exist or return false
374 Warning("TMinuitMinimizer::SetVariableLowerLimit","not implemented - use as upper limit 1.E30 instead of +inf");
375 return SetVariableLimits(ivar, lower, 1.E30);
376}
377bool TMinuitMinimizer::SetVariableUpperLimit(unsigned int ivar, double upper ) {
378 // set the limits of an existing variable
379 // parameter must exist or return false
380 Warning("TMinuitMinimizer::SetVariableUpperLimit","not implemented - - use as lower limit -1.E30 instead of +inf");
381 return SetVariableLimits(ivar, -1.E30, upper);
382}
383
384bool TMinuitMinimizer::SetVariableLimits(unsigned int ivar, double lower, double upper) {
385 // set the limits of an existing variable
386 // parameter must exist or return false
387
388 if (!CheckMinuitInstance()) return false;
389 // need to re-implement re-calling mnparm
390 // get first current parameter values and limits
391 double curval,err, lowlim, uplim;
392 int iuint; // internal index
394 fMinuit->mnpout(ivar, name, curval, err, lowlim, uplim,iuint);
395 if (iuint == -1) return false;
396 int iret = fMinuit->DefineParameter(ivar, name, curval, err, lower, upper );
397 return (iret == 0);
398
399}
400
401bool TMinuitMinimizer::FixVariable(unsigned int ivar) {
402 // Fix an existing variable
403 if (!CheckMinuitInstance()) return false;
404 if (!CheckVarIndex(ivar)) return false;
405 int iret = fMinuit->FixParameter(ivar);
406 return (iret == 0);
407}
408
409bool TMinuitMinimizer::ReleaseVariable(unsigned int ivar) {
410 // Fix an existing variable
411 if (!CheckMinuitInstance()) return false;
412 if (!CheckVarIndex(ivar)) return false;
413 int iret = fMinuit->Release(ivar);
414 return (iret == 0);
415}
416
417bool TMinuitMinimizer::IsFixedVariable(unsigned int ivar) const {
418 // query if variable is fixed
419 if (!CheckMinuitInstance()) return false;
420 if (!CheckVarIndex(ivar)) return false;
421 return (fMinuit->fNiofex[ivar] == 0 );
422}
423
425 // retrieve variable settings (all set info on the variable)
426 if (!CheckMinuitInstance()) return false;
427 if (!CheckVarIndex(ivar)) return false;
428 double curval,err, lowlim, uplim;
429 int iuint; // internal index
431 fMinuit->mnpout(ivar, name, curval, err, lowlim, uplim,iuint);
432 if (iuint == -1) return false;
433 var.Set(name.Data(), curval, err, lowlim, uplim);
434 if (IsFixedVariable(ivar)) var.Fix();
435 return true;
436}
437
438
439
440std::string TMinuitMinimizer::VariableName(unsigned int ivar) const {
441 // return the variable name
442 if (!CheckMinuitInstance()) return std::string();
443 if (!CheckVarIndex(ivar)) return std::string();
444 return fMinuit->fCpnam[ivar].Data();
445}
446
447int TMinuitMinimizer::VariableIndex(const std::string & ) const {
448 // return variable index
449 Error("TMinuitMinimizer::VariableIndex"," find index of a variable from its name is not implemented in TMinuit");
450 return -1;
451}
452
454 // perform the minimization using the algorithm chosen previously by the user
455 // By default Migrad is used.
456 // Return true if the found minimum is valid and update internal cached values of
457 // minimum values, errors and covariance matrix.
458 // Status of minimizer is set to:
459 // migradResult + 10*minosResult + 100*hesseResult + 1000*improveResult
460
461
462 if (fMinuit == nullptr) {
463 Error("TMinuitMinimizer::Minimize","invalid TMinuit pointer. Need to call first SetFunction and SetVariable");
464 return false;
465 }
466
467
468 // total number of parameter defined in Minuit is fNu
469 if (fMinuit->fNu < static_cast<int>(fDim) ) {
470 Error("TMinuitMinimizer::Minimize","The total number of defined parameters is different than the function dimension, npar = %d, dim = %d",fMinuit->fNu, fDim);
471 return false;
472 }
473
474 int printlevel = PrintLevel();
475
476 // total number of free parameter is 0
477 if (fMinuit->fNpar <= 0) {
478 // retrieve parameters values from TMinuit
480 fMinuit->fAmin = (*GetGlobalFuncPtr())(&fParams.front());
481 if (printlevel > 0) Info("TMinuitMinimizer::Minimize","There are no free parameter - just compute the function value");
482 return true;
483 }
484
485
486 double arglist[10];
487 int ierr = 0;
488
489
490 // set error and print level
491 arglist[0] = ErrorDef();
492 fMinuit->mnexcm("SET Err",arglist,1,ierr);
493
494 arglist[0] = printlevel - 1;
495 fMinuit->mnexcm("SET PRINT",arglist,1,ierr);
496
497 // suppress warning in case Printlevel() == 0
498 if (printlevel == 0) fMinuit->mnexcm("SET NOW",arglist,0,ierr);
499
500 // set precision if needed
501 if (Precision() > 0) {
502 arglist[0] = Precision();
503 fMinuit->mnexcm("SET EPS",arglist,1,ierr);
504 }
505
506 // set strategy
507 int strategy = Strategy();
508 if (strategy >=0 && strategy <=2 ) {
509 arglist[0] = strategy;
510 fMinuit->mnexcm("SET STR",arglist,1,ierr);
511 }
512
513 arglist[0] = MaxFunctionCalls();
514 arglist[1] = Tolerance();
515
516 int nargs = 2;
517
518 switch (fType){
520 // case of Migrad
521 fMinuit->mnexcm("MIGRAD",arglist,nargs,ierr);
522 break;
524 // case of combined (Migrad+ simplex)
525 fMinuit->mnexcm("MINIMIZE",arglist,nargs,ierr);
526 break;
528 // case of Simlex
529 fMinuit->mnexcm("SIMPLEX",arglist,nargs,ierr);
530 break;
532 // case of Scan (scan all parameters with default values)
533 nargs = 0;
534 fMinuit->mnexcm("SCAN",arglist,nargs,ierr);
535 break;
537 // case of Seek (random find minimum in a hypercube around current parameter values
538 // use Tolerance as measures for standard deviation (if < 1) used default value in Minuit ( supposed to be 3)
539 nargs = 1;
540 if (arglist[1] >= 1.) nargs = 2;
541 fMinuit->mnexcm("SEEK",arglist,nargs,ierr);
542 break;
543 default:
544 // default: use Migrad
545 fMinuit->mnexcm("MIGRAD",arglist,nargs,ierr);
546
547 }
548
549 fgUsed = true;
550 fUsed = true;
551
552 fStatus = ierr;
553 int minErrStatus = ierr;
554
555 if (printlevel>2) Info("TMinuitMinimizer::Minimize","Finished to run MIGRAD - status %d",ierr);
556
557 // run improved if needed
558 if (ierr == 0 && fType == ROOT::Minuit::kMigradImproved) {
559 fMinuit->mnexcm("IMPROVE",arglist,1,ierr);
560 fStatus += 1000*ierr;
561 if (printlevel>2) Info("TMinuitMinimizer::Minimize","Finished to run IMPROVE - status %d",ierr);
562 }
563
564
565 // check if Hesse needs to be run
566 // Migrad runs inside it automatically for strategy >=1. Do also
567 // in case improve or other minimizers are used
568 // run Hesse also in case cov matrix has not been computed or has been made pos-def
569 // or a valid error analysis is requested (when IsValidError() == true)
570 if (minErrStatus == 0 && (IsValidError() || ( strategy >=1 && CovMatrixStatus() < 3) ) ) {
571 fMinuit->mnexcm("HESSE",arglist,1,ierr);
572 fStatus += 100*ierr;
573 // here ierr is zero when Hesse fails CovMatrixStatus = 0 or 1 (2 is when was made posdef)
574 if (ierr == 0 && CovMatrixStatus() < 2){
575 fStatus += 100*(CovMatrixStatus()+1);
576 }
577 // should check here cov matrix status??? (if <3 flag error ?)
578 if (printlevel>2) Info("TMinuitMinimizer::Minimize","Finished to run HESSE - status %d",ierr);
579 }
580
581 // retrieve parameters and errors from TMinuit
583
584 if (minErrStatus == 0) {
585
586 // store global min results (only if minimization is OK)
587 // ignore cases when Hesse or IMprove return error different than zero
589
590 // need to re-run Minos again if requested
591 fMinosRun = false;
592
593 return true;
594
595 }
596 return false;
597
598}
599
601 // retrieve from TMinuit minimum parameter values
602 // and errors
603
604 assert(fMinuit != nullptr);
605
606 // get parameter values
607 if (fParams.size() != fDim) fParams.resize( fDim);
608 if (fErrors.size() != fDim) fErrors.resize( fDim);
609 for (unsigned int i = 0; i < fDim; ++i) {
610 fMinuit->GetParameter( i, fParams[i], fErrors[i]);
611 }
612}
613
615 // get covariance error matrix from TMinuit
616 // when some parameters are fixed filled the corresponding rows and column with zero's
617
618 assert(fMinuit != nullptr);
619
620 unsigned int nfree = NFree();
621
622 unsigned int ndim2 = fDim*fDim;
623 if (fCovar.size() != ndim2 ) fCovar.resize(fDim*fDim);
624 if (nfree >= fDim) { // no fixed parameters
625 fMinuit->mnemat(&fCovar.front(), fDim);
626 }
627 else {
628 // case of fixed params need to take care
629 std::vector<double> tmpMat(nfree*nfree);
630 fMinuit->mnemat(&tmpMat.front(), nfree);
631
632 unsigned int l = 0;
633 for (unsigned int i = 0; i < fDim; ++i) {
634
635 if ( fMinuit->fNiofex[i] > 0 ) { // not fixed ?
636 unsigned int m = 0;
637 for (unsigned int j = 0; j <= i; ++j) {
638 if ( fMinuit->fNiofex[j] > 0 ) { //not fixed
639 fCovar[i*fDim + j] = tmpMat[l*nfree + m];
640 fCovar[j*fDim + i] = fCovar[i*fDim + j];
641 m++;
642 }
643 }
644 l++;
645 }
646 }
647
648 }
649}
650
651unsigned int TMinuitMinimizer::NCalls() const {
652 // return total number of function calls
653 if (fMinuit == nullptr) return 0;
654 return fMinuit->fNfcn;
655}
656
658 // return minimum function value
659
660 // use part of code from mnstat
661 if (!fMinuit) return 0;
662 double minval = fMinuit->fAmin;
663 if (minval == fMinuit->fUndefi) return 0;
664 return minval;
665}
666
667double TMinuitMinimizer::Edm() const {
668 // return expected distance from the minimum
669
670 // use part of code from mnstat
671 if (!fMinuit) return -1;
672 if (fMinuit->fAmin == fMinuit->fUndefi || fMinuit->fEDM == fMinuit->fBigedm) return fMinuit->fUp;
673 return fMinuit->fEDM;
674}
675
676unsigned int TMinuitMinimizer::NFree() const {
677 // return number of free parameters
678 if (!fMinuit) return 0;
679 if (fMinuit->fNpar < 0) return 0;
680 return fMinuit->fNpar;
681}
682
683bool TMinuitMinimizer::GetCovMatrix(double * cov) const {
684 // get covariance matrix
685 int covStatus = CovMatrixStatus();
686 if ( fCovar.size() != fDim*fDim || covStatus < 2) {
687 Error("TMinuitMinimizer::GetHessianMatrix","Hessian matrix has not been computed - status %d",covStatus);
688 return false;
689 }
690 std::copy(fCovar.begin(), fCovar.end(), cov);
691 TMatrixDSym cmat(fDim,cov);
692 return true;
693}
694
695bool TMinuitMinimizer::GetHessianMatrix(double * hes) const {
696 // get Hessian - inverse of covariance matrix
697 // just invert it
698 // but need to get the compact form to avoid the zero for the fixed parameters
699 int covStatus = CovMatrixStatus();
700 if ( fCovar.size() != fDim*fDim || covStatus < 2) {
701 Error("TMinuitMinimizer::GetHessianMatrix","Hessian matrix has not been computed - status %d",covStatus);
702 return false;
703 }
704 // case of fixed params need to take care
705 unsigned int nfree = NFree();
706 TMatrixDSym mat(nfree);
707 fMinuit->mnemat(mat.GetMatrixArray(), nfree);
708 // invert the matrix
709 // probably need to check if failed. In that case inverse is equal to original
710 mat.Invert();
711
712 unsigned int l = 0;
713 for (unsigned int i = 0; i < fDim; ++i) {
714 if ( fMinuit->fNiofex[i] > 0 ) { // not fixed ?
715 unsigned int m = 0;
716 for (unsigned int j = 0; j <= i; ++j) {
717 if ( fMinuit->fNiofex[j] > 0 ) { //not fixed
718 hes[i*fDim + j] = mat(l,m);
719 hes[j*fDim + i] = hes[i*fDim + j];
720 m++;
721 }
722 }
723 l++;
724 }
725 }
726 return true;
727}
728// if ( fCovar.size() != fDim*fDim ) return false;
729// TMatrixDSym mat(fDim, &fCovar.front() );
730// std::copy(mat.GetMatrixArray(), mat.GetMatrixArray()+ mat.GetNoElements(), hes);
731// return true;
732// }
733
735 // return status of covariance matrix
736 // status: 0= not calculated at all
737 // 1= approximation only, not accurate
738 // 2= full matrix, but forced positive-definite
739 // 3= full accurate covariance matrix
740
741 // use part of code from mnstat
742 if (!fMinuit) return 0;
743 if (fMinuit->fAmin == fMinuit->fUndefi) return 0;
744 return fMinuit->fISW[1];
745}
746
747double TMinuitMinimizer::GlobalCC(unsigned int i) const {
748 // global correlation coefficient for parameter i
749 if (!fMinuit) return 0;
750 if (!fMinuit->fGlobcc) return 0;
751 if (int(i) >= fMinuit->fNu) return 0;
752 // get internal number in Minuit
753 int iin = fMinuit->fNiofex[i];
754 // index in TMinuit starts from 1
755 if (iin < 1) return 0;
756 return fMinuit->fGlobcc[iin-1];
757}
758
759bool TMinuitMinimizer::GetMinosError(unsigned int i, double & errLow, double & errUp, int ) {
760 // Perform Minos analysis for the given parameter i
761
762 if (fMinuit == nullptr) {
763 Error("TMinuitMinimizer::GetMinosError","invalid TMinuit pointer. Need to call first SetFunction and SetVariable");
764 return false;
765 }
766
767 // check if parameter is fixed
768 if (fMinuit->fNiofex[i] == 0 ) {
769 if (PrintLevel() > 0) Info("TMinuitMinimizer::GetMinosError","Parameter %s is fixed. There are no Minos error to calculate. Ignored.",VariableName(i).c_str());
770 errLow = 0; errUp = 0;
771 return true;
772 }
773
774 double arglist[2];
775 int ierr = 0;
776
777
778 // set error, print level, precision and strategy if they have changed
779 if (fMinuit->fUp != ErrorDef() ) {
780 arglist[0] = ErrorDef();
781 fMinuit->mnexcm("SET Err",arglist,1,ierr);
782 }
783
784 if (fMinuit->fISW[4] != (PrintLevel()-1) ) {
785 arglist[0] = PrintLevel()-1;
786 fMinuit->mnexcm("SET PRINT",arglist,1,ierr);
787 // suppress warning in case Printlevel() == 0
788 if (PrintLevel() == 0) fMinuit->mnexcm("SET NOW",arglist,0,ierr);
789 }
790 if (fMinuit->fIstrat != Strategy() ) {
791 arglist[0] = Strategy();
792 fMinuit->mnexcm("SET STR",arglist,1,ierr);
793 }
794
795 if (Precision() > 0 && fMinuit->fEpsma2 != Precision() ) {
796 arglist[0] = Precision();
797 fMinuit->mnexcm("SET EPS",arglist,1,ierr);
798 }
799
800
801 // syntax of MINOS command is: MINOS [maxcalls] [parno]
802 // if parno = 0 all parameters are done
803 arglist[0] = MaxFunctionCalls();
804 arglist[1] = i+1; // par number starts from 1 in TMInuit
805
806 int nargs = 2;
807 fMinuit->mnexcm("MINOS",arglist,nargs,ierr);
808 bool isValid = (ierr == 0);
809 // check also the status from fCstatu
810 if (isValid && fMinuit->fCstatu != "SUCCESSFUL") {
811 if (fMinuit->fCstatu == "FAILURE" ) {
812 // in this case MINOS failed on all parameters, so it is not valid !
813 ierr = 5;
814 isValid = false;
815 }
816 if (fMinuit->fCstatu == "PROBLEMS") ierr = 6;
817 ierr = 7; // this should be the case UNCHANGED
818 }
819
820 fStatus += 10*ierr;
821 fMinosStatus = ierr;
822
823 fMinosRun = true;
824
825 // retrieve parameters in case a new minimum has been found
826 if (fMinuit->fCstatu == "SUCCESSFUL")
828
829 double errParab = 0;
830 double gcor = 0;
831 // what returns if parameter fixed or constant or at limit ?
832 fMinuit->mnerrs(i,errUp,errLow, errParab, gcor);
833
834 // do not flag errors case of PROBLEMS or UNCHANGED (
835 return isValid;
836
837}
838
840 // reset TMinuit
841
842 fMinuit->mncler();
843
844 //reset the internal Minuit random generator to its initial state
845 double val = 3;
846 int inseed = 12345;
847 fMinuit->mnrn15(val,inseed);
848
849 fUsed = false;
850 fgUsed = false;
851
852}
853
855 // check if a parameter is defined and in case it was fixed released
856 // TMinuit is not able to release free parameters by redefining them
857 // so we need to force the release
858 if (fMinuit == nullptr) return;
859 if (fMinuit->GetNumFixedPars() == 0) return;
860 // check if parameter has already been defined
861 if (int(ivar) >= fMinuit->GetNumPars() ) return;
862
863 // check if parameter is fixed
864 for (int i = 0; i < fMinuit->fNpfix; ++i) {
865 if (fMinuit->fIpfix[i] == ivar+1 ) {
866 // parameter is fixed
867 fMinuit->Release(ivar);
868 return;
869 }
870 }
871
872}
873
874
876 // print-out results using classic Minuit format (mnprin)
877 if (fMinuit == nullptr) return;
878
879 // print minimizer result
880 if (PrintLevel() > 2)
882 else
884}
885
887 // suppress Minuit2 warnings
888 double arglist = 0;
889 int ierr = 0;
890 if (nowarn)
891 fMinuit->mnexcm("SET NOW",&arglist,0,ierr);
892 else
893 fMinuit->mnexcm("SET WAR",&arglist,0,ierr);
894}
895
896
897bool TMinuitMinimizer::Contour(unsigned int ipar, unsigned int jpar, unsigned int &npoints, double * x, double * y) {
898 // contour plot for parameter i and j
899 // need a valid FunctionMinimum otherwise exits
900 if (fMinuit == nullptr) {
901 Error("TMinuitMinimizer::Contour"," invalid TMinuit instance");
902 return false;
903 }
904
905 // set error and print level
906 double arglist[1];
907 int ierr = 0;
908 arglist[0] = ErrorDef();
909 fMinuit->mnexcm("SET Err",arglist,1,ierr);
910
911 arglist[0] = PrintLevel()-1;
912 fMinuit->mnexcm("SET PRINT",arglist,1,ierr);
913
914 // suppress warning in case Printlevel() == 0
915 if (PrintLevel() == 0) fMinuit->mnexcm("SET NOW",arglist,0,ierr);
916
917 // set precision if needed
918 if (Precision() > 0) {
919 arglist[0] = Precision();
920 fMinuit->mnexcm("SET EPS",arglist,1,ierr);
921 }
922
923
924 if (npoints < 4) {
925 Error("TMinuitMinimizer::Contour","Cannot make contour with so few points");
926 return false;
927 }
928 int npfound = 0;
929 // parameter numbers in mncont start from zero
930 fMinuit->mncont( ipar,jpar,npoints, x, y,npfound);
931 if (npfound<4) {
932 // mncont did go wrong
933 Error("TMinuitMinimizer::Contour","Cannot find more than 4 points");
934 return false;
935 }
936 if (npfound!=(int)npoints) {
937 // mncont did go wrong
938 Warning("TMinuitMinimizer::Contour","Returning only %d points ",npfound);
939 npoints = npfound;
940 }
941 return true;
942
943}
944
945bool TMinuitMinimizer::Scan(unsigned int ipar, unsigned int & nstep, double * x, double * y, double xmin, double xmax) {
946 // scan a parameter (variable) around the minimum value
947 // the parameters must have been set before
948 // if xmin=0 && xmax == 0 by default scan around 2 sigma of the error
949 // if the errors are also zero then scan from min and max of parameter range
950 // (if parameters are limited Minuit scan from min and max instead of 2 sigma by default)
951 // (force in that case to use errors)
952
953 // scan is not implemented for TMinuit, the way to return the array is only via the graph
954 if (fMinuit == nullptr) {
955 Error("TMinuitMinimizer::Scan"," invalid TMinuit instance");
956 return false;
957 }
958
959 // case of default xmin and xmax
960 if (xmin >= xmax && (int) ipar < fMinuit->GetNumPars() ) {
961 double val = 0; double err = 0;
963 double xlow = 0; double xup = 0 ;
964 int iuint = 0;
965 // in mnpout index starts from ze
966 fMinuit->mnpout( ipar, name, val, err, xlow, xup, iuint);
967 // redefine 2 sigma for all parameters by default (TMinuit does 1 sigma and range if limited)
968 if (iuint > 0 && err > 0) {
969 xmin = val - 2.*err;
970 xmax = val + 2 * err;
971 }
972 }
973
974 double arglist[4];
975 int ierr = 0;
976
977 arglist[0] = PrintLevel()-1;
978 fMinuit->mnexcm("SET PRINT",arglist,1,ierr);
979 // suppress warning in case Printlevel() == 0
980 if (PrintLevel() == 0) fMinuit->mnexcm("SET NOW",arglist,0,ierr);
981
982 // set precision if needed
983 if (Precision() > 0) {
984 arglist[0] = Precision();
985 fMinuit->mnexcm("SET EPS",arglist,1,ierr);
986 }
987
988 if (nstep == 0) return false;
989 arglist[0] = ipar+1; // TMinuit starts from 1
990 arglist[1] = nstep; //+2; // TMinuit deletes two points
991 int nargs = 2;
992 if (xmax > xmin ) {
993 arglist[2] = xmin;
994 arglist[3] = xmax;
995 nargs = 4;
996 }
997 fMinuit->mnexcm("SCAN",arglist,nargs,ierr);
998 if (ierr) {
999 Error("TMinuitMinimizer::Scan"," Error executing command SCAN");
1000 return false;
1001 }
1002 // get TGraph object
1003 TGraph * gr = dynamic_cast<TGraph *>(fMinuit->GetPlot() );
1004 if (!gr) {
1005 Error("TMinuitMinimizer::Scan"," Error in returned graph object");
1006 return false;
1007 }
1008 nstep = std::min(gr->GetN(), (int) nstep);
1009
1010
1011 std::copy(gr->GetX(), gr->GetX()+nstep, x);
1012 std::copy(gr->GetY(), gr->GetY()+nstep, y);
1013 nstep = gr->GetN();
1014 return true;
1015}
1016
1018 // perform calculation of Hessian
1019
1020 if (fMinuit == nullptr) {
1021 Error("TMinuitMinimizer::Hesse","invalid TMinuit pointer. Need to call first SetFunction and SetVariable");
1022 return false;
1023 }
1024
1025
1026 double arglist[10];
1027 int ierr = 0;
1028
1029 // set error and print level
1030 arglist[0] = ErrorDef();
1031 fMinuit->mnexcm("SET ERR",arglist,1,ierr);
1032
1033 int printlevel = PrintLevel();
1034 arglist[0] = printlevel - 1;
1035 fMinuit->mnexcm("SET PRINT",arglist,1,ierr);
1036
1037 // suppress warning in case Printlevel() == 0
1038 if (printlevel == 0) fMinuit->mnexcm("SET NOW",arglist,0,ierr);
1039
1040 // set precision if needed
1041 if (Precision() > 0) {
1042 arglist[0] = Precision();
1043 fMinuit->mnexcm("SET EPS",arglist,1,ierr);
1044 }
1045
1046 arglist[0] = MaxFunctionCalls();
1047
1048 fMinuit->mnexcm("HESSE",arglist,1,ierr);
1049 fStatus += 100*ierr;
1050
1051 if (ierr != 0) return false;
1052
1053 // retrieve results (parameter and error matrix)
1054 // only if result is OK
1055
1058
1059 return true;
1060}
1061
1063 // set debug mode
1064
1065 if (fMinuit == nullptr) {
1066 Error("TMinuitMinimizer::SetDebug","invalid TMinuit pointer. Need to call first SetFunction and SetVariable");
1067 return false;
1068 }
1069 int ierr = 0;
1070 double arglist[1];
1071 arglist[0] = 1;
1072 if (on)
1073 fMinuit->mnexcm("SET DEBUG",arglist,1,ierr);
1074 else
1075 fMinuit->mnexcm("SET NODEBUG",arglist,1,ierr);
1076
1077 return (ierr == 0);
1078}
1079// } // end namespace Fit
1080
1081// } // end namespace ROOT
#define f(i)
Definition RSha256.hxx:104
#define g(i)
Definition RSha256.hxx:105
#define ClassImp(name)
Definition Rtypes.h:377
#define R__ASSERT(e)
Definition TError.h:118
void Info(const char *location, const char *msgfmt,...)
Use this function for informational messages.
Definition TError.cxx:218
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
Definition TError.cxx:185
void Warning(const char *location, const char *msgfmt,...)
Use this function in warning situations.
Definition TError.cxx:229
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void on
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
char name[80]
Definition TGX11.cxx:110
float xmin
float xmax
static ROOT::Math::IMultiGenFunction *& GetGlobalFuncPtr()
R__EXTERN TMinuit * gMinuit
Definition TMinuit.h:271
#define gROOT
Definition TROOT.h:406
Class, describing value, limits and step size of the parameters Provides functionality also to set/re...
void Set(const std::string &name, double value, double step)
set value and name (unlimited parameter)
void Fix()
fix the parameter
Documentation for the abstract class IBaseFunctionMultiDim.
Definition IFunction.h:61
virtual unsigned int NDim() const =0
Retrieve the dimension of the function.
Interface (abstract class) for multi-dimensional functions providing a gradient calculation.
Definition IFunction.h:168
virtual void Gradient(const T *x, T *grad) const
Evaluate all the vector of function derivatives (gradient) at a point x.
Definition IFunction.h:177
double Tolerance() const
absolute tolerance
Definition Minimizer.h:315
unsigned int MaxFunctionCalls() const
max number of function calls
Definition Minimizer.h:309
double Precision() const
precision of minimizer in the evaluation of the objective function ( a value <=0 corresponds to the l...
Definition Minimizer.h:319
int fStatus
status of minimizer
Definition Minimizer.h:391
int Strategy() const
strategy
Definition Minimizer.h:322
double ErrorDef() const
return the statistical scale used for calculate the error is typically 1 for Chi2 and 0....
Definition Minimizer.h:332
bool IsValidError() const
return true if Minimizer has performed a detailed error validation (e.g. run Hesse for Minuit)
Definition Minimizer.h:335
int PrintLevel() const
minimizer configuration parameters
Definition Minimizer.h:306
A TGraph is an object made of two arrays X and Y with npoints each.
Definition TGraph.h:41
Double_t * GetY() const
Definition TGraph.h:139
Int_t GetN() const
Definition TGraph.h:131
Double_t * GetX() const
Definition TGraph.h:138
TMatrixTSym< Element > & Invert(Double_t *det=nullptr)
Invert the matrix and calculate its determinant Notice that the LU decomposition is used instead of B...
const Element * GetMatrixArray() const override
TMinuitMinimizer class: ROOT::Math::Minimizer implementation based on TMinuit.
bool FixVariable(unsigned int) override
fix an existing variable
TMinuitMinimizer(ROOT::Minuit::EMinimizerType type=ROOT::Minuit::kMigrad, unsigned int ndim=0)
Default constructor.
void RetrieveErrorMatrix()
retrieve error matrix from TMinuit
bool SetFixedVariable(unsigned int, const std::string &, double) override
set fixed variable (override if minimizer supports them )
static TMinuit * fgMinuit
bool SetVariableLimits(unsigned int ivar, double lower, double upper) override
set the limits of an existing variable
static void Fcn(int &, double *, double &f, double *, int)
implementation of FCN for Minuit
bool SetVariable(unsigned int ivar, const std::string &name, double val, double step) override
set free variable
bool ReleaseVariable(unsigned int) override
release an existing variable
static void FcnGrad(int &, double *g, double &f, double *, int)
implementation of FCN for Minuit when user provided gradient is used
ROOT::Minuit::EMinimizerType fType
bool SetVariableLowerLimit(unsigned int, double) override
set the lower-limit of an existing variable
int VariableIndex(const std::string &name) const override
get index of variable given a variable given a name return always -1 .
double MinValue() const override
return minimum function value
bool SetVariableStepSize(unsigned int, double) override
set the step size of an existing variable
void RetrieveParams()
retrieve minimum parameters and errors from TMinuit
~TMinuitMinimizer() override
Destructor (no operations)
std::vector< double > fErrors
void SetFunction(const ROOT::Math::IMultiGenFunction &func) override
set the function to minimize
bool CheckMinuitInstance() const
check TMinuit instance
static bool fgUseStaticMinuit
std::vector< double > fCovar
bool Hesse() override
perform a full calculation of the Hessian matrix for error calculation
bool CheckVarIndex(unsigned int ivar) const
check parameter
bool Minimize() override
method to perform the minimization
bool SetVariableValue(unsigned int, double) override
set the value of an existing variable
int CovMatrixStatus() const override
return status of covariance matrix
void SuppressMinuitWarnings(bool nowarn=true)
suppress the minuit warnings (if called with false will enable them) By default they are suppressed o...
bool SetVariableUpperLimit(unsigned int, double) override
set the upper-limit of an existing variable
double Edm() const override
return expected distance reached from the minimum
static bool UseStaticMinuit(bool on=true)
static function to switch on/off usage of static global TMinuit instance (gMinuit) By default it is u...
void PrintResults() override
return reference to the objective function virtual const ROOT::Math::IGenFunction & Function() const ...
unsigned int NCalls() const override
number of function calls to reach the minimum
TMinuitMinimizer & operator=(const TMinuitMinimizer &rhs)
Assignment operator.
void DoReleaseFixParameter(int ivar)
release a parameter that is fixed when it is redefined
bool SetLimitedVariable(unsigned int ivar, const std::string &name, double val, double step, double, double) override
set upper/lower limited variable (override if minimizer supports them )
bool GetMinosError(unsigned int i, double &errLow, double &errUp, int=0) override
minos error for variable i, return false if Minos failed
bool GetVariableSettings(unsigned int, ROOT::Fit::ParameterSettings &) const override
get variable settings in a variable object (like ROOT::Fit::ParamsSettings)
double GlobalCC(unsigned int) const override
global correlation coefficient for variable i
bool IsFixedVariable(unsigned int) const override
query if an existing variable is fixed (i.e.
std::string VariableName(unsigned int ivar) const override
return reference to the objective function virtual const ROOT::Math::IGenFunction & Function() const;
bool SetUpperLimitedVariable(unsigned int ivar, const std::string &name, double val, double step, double upper) override
set upper limit variable (override if minimizer supports them )
bool SetLowerLimitedVariable(unsigned int ivar, const std::string &name, double val, double step, double lower) override
set lower limit variable (override if minimizer supports them )
unsigned int NFree() const override
number of free variables (real dimension of the problem) this is <= Function().NDim() which is the to...
std::vector< double > fParams
void InitTMinuit(int ndim)
initialize the TMinuit instance
bool GetHessianMatrix(double *h) const override
Fill the passed array with the Hessian matrix elements The Hessian matrix is the matrix of the second...
bool Scan(unsigned int i, unsigned int &nstep, double *x, double *y, double xmin=0, double xmax=0) override
scan a parameter i around the minimum.
bool SetDebug(bool on=true)
set debug mode. Return true if setting was successful
bool GetCovMatrix(double *cov) const override
Fill the passed array with the covariance matrix elements if the variable is fixed or const the value...
bool Contour(unsigned int i, unsigned int j, unsigned int &npoints, double *xi, double *xj) override
find the contour points (xi,xj) of the function for parameter i and j around the minimum The contour ...
virtual Int_t GetParameter(Int_t parNo, Double_t &currentValue, Double_t &currentError) const
return parameter value and error
Definition TMinuit.cxx:841
virtual Int_t FixParameter(Int_t parNo)
fix a parameter
Definition TMinuit.cxx:827
virtual Int_t GetNumPars() const
returns the total number of parameters that have been defined as fixed or free.
Definition TMinuit.cxx:872
virtual Int_t GetNumFixedPars() const
returns the number of currently fixed parameters
Definition TMinuit.cxx:855
virtual Int_t Release(Int_t parNo)
release a parameter
Definition TMinuit.cxx:894
Double_t fUndefi
Definition TMinuit.h:60
Int_t fNu
Definition TMinuit.h:130
Double_t * fGlobcc
Definition TMinuit.h:74
virtual void mncler()
Resets the parameter list to UNDEFINED.
Definition TMinuit.cxx:1103
Double_t fUp
Definition TMinuit.h:50
TString * fCpnam
Character to be plotted at the X,Y contour positions.
Definition TMinuit.h:165
Int_t fNfcn
Definition TMinuit.h:145
Double_t fBigedm
Definition TMinuit.h:61
TString fCstatu
Definition TMinuit.h:167
virtual TObject * GetPlot() const
Definition TMinuit.h:200
Int_t fNpfix
Definition TMinuit.h:37
Int_t fISW[7]
Definition TMinuit.h:141
Int_t * fIpfix
Definition TMinuit.h:129
virtual void SetFCN(void(*fcn)(Int_t &, Double_t *, Double_t &f, Double_t *, Int_t))
To set the address of the minimization function.
Definition TMinuit.cxx:920
virtual void mncont(Int_t ke1, Int_t ke2, Int_t nptu, Double_t *xptu, Double_t *yptu, Int_t &ierrf)
Find points along a contour where FCN is minimum.
Definition TMinuit.cxx:1395
Double_t fEpsma2
Definition TMinuit.h:57
virtual void mnpout(Int_t iuext, TString &chnam, Double_t &val, Double_t &err, Double_t &xlolim, Double_t &xuplim, Int_t &iuint) const
Provides the user with information concerning the current status.
Definition TMinuit.cxx:6247
Int_t fIstrat
Definition TMinuit.h:150
virtual void mnemat(Double_t *emat, Int_t ndim)
Calculates the external error matrix from the internal matrix.
Definition TMinuit.cxx:2501
virtual void mnrn15(Double_t &val, Int_t &inseed)
This is a super-portable random number generator.
Definition TMinuit.cxx:6619
virtual void mnerrs(Int_t number, Double_t &eplus, Double_t &eminus, Double_t &eparab, Double_t &gcc)
Utility routine to get MINOS errors.
Definition TMinuit.cxx:2578
Int_t fNpar
Definition TMinuit.h:41
virtual void mnexcm(const char *comand, Double_t *plist, Int_t llist, Int_t &ierflg)
Interprets a command and takes appropriate action.
Definition TMinuit.cxx:2664
Int_t fMaxpar
Definition TMinuit.h:39
Int_t * fNiofex
Definition TMinuit.h:127
virtual Int_t DefineParameter(Int_t parNo, const char *name, Double_t initVal, Double_t initErr, Double_t lowerLimit, Double_t upperLimit)
Define a parameter.
Definition TMinuit.cxx:695
virtual void mnprin(Int_t inkode, Double_t fval)
Prints the values of the parameters at the time of the call.
Definition TMinuit.cxx:6304
Double_t fAmin
Definition TMinuit.h:49
Double_t fEDM
Definition TMinuit.h:51
Basic string class.
Definition TString.h:139
const char * Data() const
Definition TString.h:376
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17
TGraphErrors * gr
Definition legend1.C:25
TMarker m
Definition textangle.C:8
TLine l
Definition textangle.C:4