Logo ROOT  
Reference Guide
Minuit2Minimizer.cxx
Go to the documentation of this file.
1 // @(#)root/minuit2:$Id$
2 // Author: L. Moneta Wed Oct 18 11:48:00 2006
3 
4 /**********************************************************************
5  * *
6  * Copyright (c) 2006 LCG ROOT Math Team, CERN/PH-SFT *
7  * *
8  * *
9  **********************************************************************/
10 
11 // Implementation file for class Minuit2Minimizer
12 
14 
15 #include "Math/IFunction.h"
16 #include "Math/IOptions.h"
17 
18 #include "Fit/ParameterSettings.h"
19 
20 #include "Minuit2/FCNAdapter.h"
22 #include "Minuit2/FCNGradAdapter.h"
24 #include "Minuit2/MnMigrad.h"
25 #include "Minuit2/MnMinos.h"
26 #include "Minuit2/MinosError.h"
27 #include "Minuit2/MnHesse.h"
29 #include "Minuit2/MnUserFcn.h"
30 #include "Minuit2/MnPrint.h"
34 #include "Minuit2/ScanMinimizer.h"
37 #include "Minuit2/MnContours.h"
38 #include "Minuit2/MnTraceObject.h"
39 #include "Minuit2/MinimumBuilder.h"
40 
41 #include <cassert>
42 #include <iostream>
43 #include <algorithm>
44 #include <functional>
45 
46 #ifdef USE_ROOT_ERROR
47 #include "TROOT.h"
48 #include "TMinuit2TraceObject.h"
49 #endif
50 
51 namespace ROOT {
52 
53 namespace Minuit2 {
54 
55 
56  // functions needed to control siwthc off of Minuit2 printing level
57 #ifdef USE_ROOT_ERROR
58  int TurnOffPrintInfoLevel() {
59  // switch off Minuit2 printing of INFO message (cut off is 1001)
60  int prevErrorIgnoreLevel = gErrorIgnoreLevel;
61  if (prevErrorIgnoreLevel < 1001) {
62  gErrorIgnoreLevel = 1001;
63  return prevErrorIgnoreLevel;
64  }
65  return -2; // no op in this case
66 }
67 
68 void RestoreGlobalPrintLevel(int value) {
69  gErrorIgnoreLevel = value;
70 }
71 #else
72  // dummy functions
73  int TurnOffPrintInfoLevel() { return -1; }
74  int ControlPrintLevel( ) { return -1;}
75  void RestoreGlobalPrintLevel(int ) {}
76 #endif
77 
78 
79 
80 
82  Minimizer(),
83  fDim(0),
84  fMinimizer(0),
85  fMinuitFCN(0),
86  fMinimum(0)
87 {
88  // Default constructor implementation depending on minimizer type
89  SetMinimizerType(type);
90 }
91 
93  Minimizer(),
94  fDim(0),
95  fMinimizer(0),
96  fMinuitFCN(0),
97  fMinimum(0)
98 {
99  // constructor from a string
100 
101  std::string algoname(type);
102  // tolower() is not an std function (Windows)
103  std::transform(algoname.begin(), algoname.end(), algoname.begin(), (int(*)(int)) tolower );
104 
105  EMinimizerType algoType = kMigrad;
106  if (algoname == "simplex") algoType = kSimplex;
107  if (algoname == "minimize" ) algoType = kCombined;
108  if (algoname == "scan" ) algoType = kScan;
109  if (algoname == "fumili" ) algoType = kFumili;
110  if (algoname == "bfgs" ) algoType = kMigradBFGS;
111 
112  SetMinimizerType(algoType);
113 }
114 
116  // Set minimizer algorithm type
117  fUseFumili = false;
118  switch (type) {
120  //std::cout << "Minuit2Minimizer: minimize using MIGRAD " << std::endl;
122  return;
124  //std::cout << "Minuit2Minimizer: minimize using MIGRAD " << std::endl;
126  return;
128  //std::cout << "Minuit2Minimizer: minimize using SIMPLEX " << std::endl;
130  return;
133  return;
136  return;
139  fUseFumili = true;
140  return;
141  default:
142  //migrad minimizer
144 
145  }
146 }
147 
148 
150 {
151  // Destructor implementation.
152  if (fMinimizer) delete fMinimizer;
153  if (fMinuitFCN) delete fMinuitFCN;
154  if (fMinimum) delete fMinimum;
155 }
156 
157 Minuit2Minimizer::Minuit2Minimizer(const Minuit2Minimizer &) :
158  ROOT::Math::Minimizer()
159 {
160  // Implementation of copy constructor.
161 }
162 
164 {
165  // Implementation of assignment operator.
166  if (this == &rhs) return *this; // time saving self-test
167  return *this;
168 }
169 
170 
172  // delete the state in case of consecutive minimizations
174  // clear also the function minimum
175  if (fMinimum) delete fMinimum;
176  fMinimum = 0;
177 }
178 
179 
180 // set variables
181 
182 bool Minuit2Minimizer::SetVariable(unsigned int ivar, const std::string & name, double val, double step) {
183  // set a free variable.
184  // Add the variable if not existing otherwise set value if exists already
185  // this is implemented in MnUserParameterState::Add
186  // if index is wrong (i.e. variable already exists but with a different index return false) but
187  // value is set for corresponding variable name
188 
189 // std::cout << " add parameter " << name << " " << val << " step " << step << std::endl;
190 
191  if (step <= 0) {
192  std::string txtmsg = "Parameter " + name + " has zero or invalid step size - consider it as constant ";
193  MN_INFO_MSG2("Minuit2Minimizer::SetVariable",txtmsg);
194  fState.Add(name.c_str(), val);
195  }
196  else
197  fState.Add(name.c_str(), val, step);
198 
199  unsigned int minuit2Index = fState.Index(name.c_str() );
200  if ( minuit2Index != ivar) {
201  std::string txtmsg("Wrong index used for the variable " + name);
202  MN_INFO_MSG2("Minuit2Minimizer::SetVariable",txtmsg);
203  MN_INFO_VAL2("Minuit2Minimizer::SetVariable",minuit2Index);
204  ivar = minuit2Index;
205  return false;
206  }
207  fState.RemoveLimits(ivar);
208 
209  return true;
210 }
211 
212 bool Minuit2Minimizer::SetLowerLimitedVariable(unsigned int ivar , const std::string & name , double val , double step , double lower ) {
213  // add a lower bounded variable
214  if (!SetVariable(ivar, name, val, step) ) return false;
215  fState.SetLowerLimit(ivar, lower);
216  return true;
217 }
218 
219 bool Minuit2Minimizer::SetUpperLimitedVariable(unsigned int ivar , const std::string & name , double val , double step , double upper ) {
220  // add a upper bounded variable
221  if (!SetVariable(ivar, name, val, step) ) return false;
222  fState.SetUpperLimit(ivar, upper);
223  return true;
224 }
225 
226 
227 
228 bool Minuit2Minimizer::SetLimitedVariable(unsigned int ivar , const std::string & name , double val , double step , double lower , double upper) {
229  // add a double bound variable
230  if (!SetVariable(ivar, name, val, step) ) return false;
231  fState.SetLimits(ivar, lower, upper);
232  return true;
233 }
234 
235 bool Minuit2Minimizer::SetFixedVariable(unsigned int ivar , const std::string & name , double val ) {
236  // add a fixed variable
237  // need a step size otherwise treated as a constant
238  // use 10%
239  double step = ( val != 0) ? 0.1 * std::abs(val) : 0.1;
240  if (!SetVariable(ivar, name, val, step ) ) {
241  ivar = fState.Index(name.c_str() );
242  }
243  fState.Fix(ivar);
244  return true;
245 }
246 
247 std::string Minuit2Minimizer::VariableName(unsigned int ivar) const {
248  // return the variable name
249  if (ivar >= fState.MinuitParameters().size() ) return std::string();
250  return fState.GetName(ivar);
251 }
252 
253 
254 int Minuit2Minimizer::VariableIndex(const std::string & name) const {
255  // return the variable index
256  // check if variable exist
258 }
259 
260 
261 bool Minuit2Minimizer::SetVariableValue(unsigned int ivar, double val) {
262  // set value for variable ivar (only for existing parameters)
263  if (ivar >= fState.MinuitParameters().size() ) return false;
264  fState.SetValue(ivar, val);
265  return true;
266 }
267 
268 bool Minuit2Minimizer::SetVariableValues(const double * x) {
269  // set value for variable ivar (only for existing parameters)
270  unsigned int n = fState.MinuitParameters().size();
271  if (n== 0) return false;
272  for (unsigned int ivar = 0; ivar < n; ++ivar)
273  fState.SetValue(ivar, x[ivar]);
274  return true;
275 }
276 
277 bool Minuit2Minimizer::SetVariableStepSize(unsigned int ivar, double step) {
278  // set the step-size of an existing variable
279  // parameter must exist or return false
280  if (ivar >= fState.MinuitParameters().size() ) return false;
281  fState.SetError(ivar, step);
282  return true;
283 }
284 
285 bool Minuit2Minimizer::SetVariableLowerLimit(unsigned int ivar, double lower) {
286  // set the limits of an existing variable
287  // parameter must exist or return false
288  if (ivar >= fState.MinuitParameters().size() ) return false;
289  fState.SetLowerLimit(ivar, lower);
290  return true;
291 }
292 bool Minuit2Minimizer::SetVariableUpperLimit(unsigned int ivar, double upper ) {
293  // set the limits of an existing variable
294  // parameter must exist or return false
295  if (ivar >= fState.MinuitParameters().size() ) return false;
296  fState.SetUpperLimit(ivar, upper);
297  return true;
298 }
299 
300 bool Minuit2Minimizer::SetVariableLimits(unsigned int ivar, double lower, double upper) {
301  // set the limits of an existing variable
302  // parameter must exist or return false
303  if (ivar >= fState.MinuitParameters().size() ) return false;
304  fState.SetLimits(ivar, lower,upper);
305  return true;
306 }
307 
308 bool Minuit2Minimizer::FixVariable(unsigned int ivar) {
309  // Fix an existing variable
310  if (ivar >= fState.MinuitParameters().size() ) return false;
311  fState.Fix(ivar);
312  return true;
313 }
314 
315 bool Minuit2Minimizer::ReleaseVariable(unsigned int ivar) {
316  // Release an existing variable
317  if (ivar >= fState.MinuitParameters().size() ) return false;
319  return true;
320 }
321 
322 bool Minuit2Minimizer::IsFixedVariable(unsigned int ivar) const {
323  // query if variable is fixed
324  if (ivar >= fState.MinuitParameters().size() ) {
325  MN_ERROR_MSG2("Minuit2Minimizer","wrong variable index");
326  return false;
327  }
328  return (fState.Parameter(ivar).IsFixed() || fState.Parameter(ivar).IsConst() );
329 }
330 
331 bool Minuit2Minimizer::GetVariableSettings(unsigned int ivar, ROOT::Fit::ParameterSettings & varObj) const {
332  // retrieve variable settings (all set info on the variable)
333  if (ivar >= fState.MinuitParameters().size() ) {
334  MN_ERROR_MSG2("Minuit2Minimizer","wrong variable index");
335  return false;
336  }
337  const MinuitParameter & par = fState.Parameter(ivar);
338  varObj.Set( par.Name(), par.Value(), par.Error() );
339  if (par.HasLowerLimit() ) {
340  if (par.HasUpperLimit() ) {
341  varObj.SetLimits(par.LowerLimit(), par.UpperLimit() );
342  } else {
343  varObj.SetLowerLimit(par.LowerLimit() );
344  }
345  } else if (par.HasUpperLimit() ) {
346  varObj.SetUpperLimit(par.UpperLimit() );
347  }
348  if (par.IsConst() || par.IsFixed() ) varObj.Fix();
349  return true;
350 }
351 
352 
353 
355  // set function to be minimized
356  if (fMinuitFCN) delete fMinuitFCN;
357  fDim = func.NDim();
358  if (!fUseFumili) {
360  }
361  else {
362  // for Fumili the fit method function interface is required
363  const ROOT::Math::FitMethodFunction * fcnfunc = dynamic_cast<const ROOT::Math::FitMethodFunction *>(&func);
364  if (!fcnfunc) {
365  MN_ERROR_MSG("Minuit2Minimizer: Wrong Fit method function for Fumili");
366  return;
367  }
369  }
370 }
371 
373  // set function to be minimized
374  fDim = func.NDim();
375  if (fMinuitFCN) delete fMinuitFCN;
376  if (!fUseFumili) {
378  }
379  else {
380  // for Fumili the fit method function interface is required
381  const ROOT::Math::FitMethodGradFunction * fcnfunc = dynamic_cast<const ROOT::Math::FitMethodGradFunction*>(&func);
382  if (!fcnfunc) {
383  MN_ERROR_MSG("Minuit2Minimizer: Wrong Fit method function for Fumili");
384  return;
385  }
387  }
388 }
389 
391  // perform the minimization
392  // store a copy of FunctionMinimum
393  if (!fMinuitFCN) {
394  MN_ERROR_MSG2("Minuit2Minimizer::Minimize","FCN function has not been set");
395  return false;
396  }
397 
398  assert(GetMinimizer() != 0 );
399 
400  // delete result of previous minimization
401  if (fMinimum) delete fMinimum;
402  fMinimum = 0;
403 
404 
405  int maxfcn = MaxFunctionCalls();
406  double tol = Tolerance();
407  int strategyLevel = Strategy();
409 
410  int printLevel = PrintLevel();
411  if (printLevel >=1) {
412  // print the real number of maxfcn used (defined in ModularFuncitonMinimizer)
413  int maxfcn_used = maxfcn;
414  if (maxfcn_used == 0) {
415  int nvar = fState.VariableParameters();
416  maxfcn_used = 200 + 100*nvar + 5*nvar*nvar;
417  }
418  std::cout << "Minuit2Minimizer: Minimize with max-calls " << maxfcn_used
419  << " convergence for edm < " << tol << " strategy "
420  << strategyLevel << std::endl;
421  }
422 
423  // internal minuit messages
424  MnPrint::SetLevel(printLevel );
425  fMinimizer->Builder().SetPrintLevel(printLevel);
426 
427  // switch off Minuit2 printing
428  int prev_level = (printLevel <= 0 ) ? TurnOffPrintInfoLevel() : -2;
429 
430  // set the precision if needed
431  if (Precision() > 0) fState.SetPrecision(Precision());
432 
433  // set strategy and add extra options if needed
434  ROOT::Minuit2::MnStrategy strategy(strategyLevel);
436  if (minuit2Opt) {
437  // set extra options
438  int nGradCycles = strategy.GradientNCycles();
439  int nHessCycles = strategy.HessianNCycles();
440  int nHessGradCycles = strategy.HessianGradientNCycles();
441 
442  double gradTol = strategy.GradientTolerance();
443  double gradStepTol = strategy.GradientStepTolerance();
444  double hessStepTol = strategy.HessianStepTolerance();
445  double hessG2Tol = strategy.HessianG2Tolerance();
446 
447  minuit2Opt->GetValue("GradientNCycles",nGradCycles);
448  minuit2Opt->GetValue("HessianNCycles",nHessCycles);
449  minuit2Opt->GetValue("HessianGradientNCycles",nHessGradCycles);
450 
451  minuit2Opt->GetValue("GradientTolerance",gradTol);
452  minuit2Opt->GetValue("GradientStepTolerance",gradStepTol);
453  minuit2Opt->GetValue("HessianStepTolerance",hessStepTol);
454  minuit2Opt->GetValue("HessianG2Tolerance",hessG2Tol);
455 
456  strategy.SetGradientNCycles(nGradCycles);
457  strategy.SetHessianNCycles(nHessCycles);
458  strategy.SetHessianGradientNCycles(nHessGradCycles);
459 
460  strategy.SetGradientTolerance(gradTol);
461  strategy.SetGradientStepTolerance(gradStepTol);
462  strategy.SetHessianStepTolerance(hessStepTol);
463  strategy.SetHessianG2Tolerance(hessStepTol);
464 
465  int storageLevel = 1;
466  bool ret = minuit2Opt->GetValue("StorageLevel",storageLevel);
467  if (ret) SetStorageLevel(storageLevel);
468 
469  if (printLevel > 0) {
470  std::cout << "Minuit2Minimizer::Minuit - Changing default options" << std::endl;
471  minuit2Opt->Print();
472  }
473 
474 
475  }
476 
477  // set a minimizer tracer object (default for printlevel=10, from gROOT for printLevel=11)
478  // use some special print levels
479  MnTraceObject * traceObj = 0;
480 #ifdef USE_ROOT_ERROR
481  if (printLevel == 10 && gROOT) {
482  TObject * obj = gROOT->FindObject("Minuit2TraceObject");
483  traceObj = dynamic_cast<ROOT::Minuit2::MnTraceObject*>(obj);
484  if (traceObj) {
485  // need to remove from the list
486  gROOT->Remove(obj);
487  }
488  }
489  if (printLevel == 20 || printLevel == 30 || printLevel == 40 || (printLevel >= 20000 && printLevel < 30000) ) {
490  int parNumber = printLevel-20000;
491  if (printLevel == 20) parNumber = -1;
492  if (printLevel == 30) parNumber = -2;
493  if (printLevel == 40) parNumber = 0;
494  traceObj = new TMinuit2TraceObject(parNumber);
495  }
496 #endif
497  if (printLevel == 100 || (printLevel >= 10000 && printLevel < 20000)) {
498  int parNumber = printLevel-10000;
499  traceObj = new MnTraceObject(parNumber);
500  }
501  if (traceObj) {
502  traceObj->Init(fState);
503  SetTraceObject(*traceObj);
504  }
505 
506  const ROOT::Minuit2::FCNGradientBase * gradFCN = dynamic_cast<const ROOT::Minuit2::FCNGradientBase *>( fMinuitFCN );
507  if ( gradFCN != 0) {
508  // use gradient
509  //SetPrintLevel(3);
510  ROOT::Minuit2::FunctionMinimum min = GetMinimizer()->Minimize(*gradFCN, fState, strategy, maxfcn, tol);
512  }
513  else {
514  ROOT::Minuit2::FunctionMinimum min = GetMinimizer()->Minimize(*GetFCN(), fState, strategy, maxfcn, tol);
516  }
517 
518  // check if Hesse needs to be run
519  if (fMinimum->IsValid() && IsValidError() && fMinimum->State().Error().Dcovar() != 0 ) {
520  // run Hesse (Hesse will add results in the last state of fMinimum
521  ROOT::Minuit2::MnHesse hesse(strategy );
522  hesse( *fMinuitFCN, *fMinimum, maxfcn);
523  }
524 
525  // -2 is the highest low invalid value for gErrorIgnoreLevel
526  if (prev_level > -2) RestoreGlobalPrintLevel(prev_level);
527 
528  // copy minimum state (parameter values and errors)
530  bool ok = ExamineMinimum(*fMinimum);
531  //fMinimum = 0;
532 
533  // delete trace object if it was constructed
534  if (traceObj) { delete traceObj; }
535  return ok;
536 }
537 
539  /// study the function minimum
540 
541  // debug ( print all the states)
542  int debugLevel = PrintLevel();
543  if (debugLevel >= 3) {
544 
545  const std::vector<ROOT::Minuit2::MinimumState>& iterationStates = min.States();
546  std::cout << "Number of iterations " << iterationStates.size() << std::endl;
547  for (unsigned int i = 0; i < iterationStates.size(); ++i) {
548  //std::cout << iterationStates[i] << std::endl;
549  const ROOT::Minuit2::MinimumState & st = iterationStates[i];
550  std::cout << "----------> Iteration " << i << std::endl;
551  int pr = std::cout.precision(12);
552  std::cout << " FVAL = " << st.Fval() << " Edm = " << st.Edm() << " Nfcn = " << st.NFcn() << std::endl;
553  std::cout.precision(pr);
554  if (st.HasCovariance() )
555  std::cout << " Error matrix change = " << st.Error().Dcovar() << std::endl;
556  if (st.HasParameters() ) {
557  std::cout << " Parameters : ";
558  // need to transform from internal to external
559  for (int j = 0; j < st.size() ; ++j) std::cout << " p" << j << " = " << fState.Int2ext( j, st.Vec()(j) );
560  std::cout << std::endl;
561  }
562  }
563  }
564 
565  fStatus = 0;
566  std::string txt;
567  if (!min.HasPosDefCovar() ) {
568  // this happens normally when Hesse failed
569  // it can happen in case MnSeed failed (see ROOT-9522)
570  txt = "Covar is not pos def";
571  fStatus = 5;
572  }
573  if (min.HasMadePosDefCovar() ) {
574  txt = "Covar was made pos def";
575  fStatus = 1;
576  }
577  if (min.HesseFailed() ) {
578  txt = "Hesse is not valid";
579  fStatus = 2;
580  }
581  if (min.IsAboveMaxEdm() ) {
582  txt = "Edm is above max";
583  fStatus = 3;
584  }
585  if (min.HasReachedCallLimit() ) {
586  txt = "Reached call limit";
587  fStatus = 4;
588  }
589 
590 
591  bool validMinimum = min.IsValid();
592  if (validMinimum) {
593  // print a warning message in case something is not ok
594  if (fStatus != 0 && debugLevel > 0) MN_INFO_MSG2("Minuit2Minimizer::Minimize",txt);
595  }
596  else {
597  // minimum is not valid when state is not valid and edm is over max or has passed call limits
598  if (fStatus == 0) {
599  // this should not happen
600  txt = "unknown failure";
601  fStatus = 6;
602  }
603  std::string msg = "Minimization did NOT converge, " + txt;
604  MN_INFO_MSG2("Minuit2Minimizer::Minimize",msg);
605  }
606 
607  if (debugLevel >= 1) PrintResults();
608  return validMinimum;
609 }
610 
611 
613  // print results of minimization
614  if (!fMinimum) return;
615  if (fMinimum->IsValid() ) {
616  // valid minimum
617  std::cout << "Minuit2Minimizer : Valid minimum - status = " << fStatus << std::endl;
618  int pr = std::cout.precision(18);
619  std::cout << "FVAL = " << fState.Fval() << std::endl;
620  std::cout << "Edm = " << fState.Edm() << std::endl;
621  std::cout.precision(pr);
622  std::cout << "Nfcn = " << fState.NFcn() << std::endl;
623  for (unsigned int i = 0; i < fState.MinuitParameters().size(); ++i) {
624  const MinuitParameter & par = fState.Parameter(i);
625  std::cout << par.Name() << "\t = " << par.Value() << "\t ";
626  if (par.IsFixed() ) std::cout << "(fixed)" << std::endl;
627  else if (par.IsConst() ) std::cout << "(const)" << std::endl;
628  else if (par.HasLimits() )
629  std::cout << "+/- " << par.Error() << "\t(limited)"<< std::endl;
630  else
631  std::cout << "+/- " << par.Error() << std::endl;
632  }
633  }
634  else {
635  std::cout << "Minuit2Minimizer : Invalid Minimum - status = " << fStatus << std::endl;
636  std::cout << "FVAL = " << fState.Fval() << std::endl;
637  std::cout << "Edm = " << fState.Edm() << std::endl;
638  std::cout << "Nfcn = " << fState.NFcn() << std::endl;
639  }
640 }
641 
642 const double * Minuit2Minimizer::X() const {
643  // return values at minimum
644  const std::vector<MinuitParameter> & paramsObj = fState.MinuitParameters();
645  if (paramsObj.size() == 0) return 0;
646  assert(fDim == paramsObj.size());
647  // be careful for multiple calls of this function. I will redo an allocation here
648  // only when size of vectors has changed (e.g. after a new minimization)
649  if (fValues.size() != fDim) fValues.resize(fDim);
650  for (unsigned int i = 0; i < fDim; ++i) {
651  fValues[i] = paramsObj[i].Value();
652  }
653 
654  return &fValues.front();
655 }
656 
657 
658 const double * Minuit2Minimizer::Errors() const {
659  // return error at minimum (set to zero for fixed and constant params)
660  const std::vector<MinuitParameter> & paramsObj = fState.MinuitParameters();
661  if (paramsObj.size() == 0) return 0;
662  assert(fDim == paramsObj.size());
663  // be careful for multiple calls of this function. I will redo an allocation here
664  // only when size of vectors has changed (e.g. after a new minimization)
665  if (fErrors.size() != fDim) fErrors.resize( fDim );
666  for (unsigned int i = 0; i < fDim; ++i) {
667  const MinuitParameter & par = paramsObj[i];
668  if (par.IsFixed() || par.IsConst() )
669  fErrors[i] = 0;
670  else
671  fErrors[i] = par.Error();
672  }
673 
674  return &fErrors.front();
675 }
676 
677 
678 double Minuit2Minimizer::CovMatrix(unsigned int i, unsigned int j) const {
679  // get value of covariance matrices (transform from external to internal indices)
680  if ( i >= fDim || j >= fDim) return 0;
681  if ( !fState.HasCovariance() ) return 0; // no info available when minimization has failed
682  if (fState.Parameter(i).IsFixed() || fState.Parameter(i).IsConst() ) return 0;
683  if (fState.Parameter(j).IsFixed() || fState.Parameter(j).IsConst() ) return 0;
684  unsigned int k = fState.IntOfExt(i);
685  unsigned int l = fState.IntOfExt(j);
686  return fState.Covariance()(k,l);
687 }
688 
689 bool Minuit2Minimizer::GetCovMatrix(double * cov) const {
690  // get value of covariance matrices
691  if ( !fState.HasCovariance() ) return false; // no info available when minimization has failed
692  for (unsigned int i = 0; i < fDim; ++i) {
693  if (fState.Parameter(i).IsFixed() || fState.Parameter(i).IsConst() ) {
694  for (unsigned int j = 0; j < fDim; ++j) { cov[i*fDim + j] = 0; }
695  }
696  else
697  {
698  unsigned int l = fState.IntOfExt(i);
699  for (unsigned int j = 0; j < fDim; ++j) {
700  // could probably speed up this loop (if needed)
701  int k = i*fDim + j;
702  if (fState.Parameter(j).IsFixed() || fState.Parameter(j).IsConst() )
703  cov[k] = 0;
704  else {
705  // need to transform from external to internal indices)
706  // for taking care of the removed fixed row/columns in the Minuit2 representation
707  unsigned int m = fState.IntOfExt(j);
708  cov[k] = fState.Covariance()(l,m);
709  }
710  }
711  }
712  }
713  return true;
714 }
715 
716 bool Minuit2Minimizer::GetHessianMatrix(double * hess) const {
717  // get value of Hessian matrix
718  // this is the second derivative matrices
719  if ( !fState.HasCovariance() ) return false; // no info available when minimization has failed
720  for (unsigned int i = 0; i < fDim; ++i) {
721  if (fState.Parameter(i).IsFixed() || fState.Parameter(i).IsConst() ) {
722  for (unsigned int j = 0; j < fDim; ++j) { hess[i*fDim + j] = 0; }
723  }
724  else {
725  unsigned int l = fState.IntOfExt(i);
726  for (unsigned int j = 0; j < fDim; ++j) {
727  // could probably speed up this loop (if needed)
728  int k = i*fDim + j;
729  if (fState.Parameter(j).IsFixed() || fState.Parameter(j).IsConst() )
730  hess[k] = 0;
731  else {
732  // need to transform from external to internal indices)
733  // for taking care of the removed fixed row/columns in the Minuit2 representation
734  unsigned int m = fState.IntOfExt(j);
735  hess[k] = fState.Hessian()(l,m);
736  }
737  }
738  }
739  }
740 
741  return true;
742 }
743 
744 
745 double Minuit2Minimizer::Correlation(unsigned int i, unsigned int j) const {
746  // get correlation between parameter i and j
747  if ( i >= fDim || j >= fDim) return 0;
748  if ( !fState.HasCovariance() ) return 0; // no info available when minimization has failed
749  if (fState.Parameter(i).IsFixed() || fState.Parameter(i).IsConst() ) return 0;
750  if (fState.Parameter(j).IsFixed() || fState.Parameter(j).IsConst() ) return 0;
751  unsigned int k = fState.IntOfExt(i);
752  unsigned int l = fState.IntOfExt(j);
753  double cij = fState.IntCovariance()(k,l);
754  double tmp = std::sqrt( std::abs ( fState.IntCovariance()(k,k) * fState.IntCovariance()(l,l) ) );
755  if (tmp > 0 ) return cij/tmp;
756  return 0;
757 }
758 
759 double Minuit2Minimizer::GlobalCC(unsigned int i) const {
760  // get global correlation coefficient for the parameter i. This is a number between zero and one which gives
761  // the correlation between the i-th parameter and that linear combination of all other parameters which
762  // is most strongly correlated with i.
763 
764  if ( i >= fDim ) return 0;
765  // no info available when minimization has failed or has some problems
766  if ( !fState.HasGlobalCC() ) return 0;
767  if (fState.Parameter(i).IsFixed() || fState.Parameter(i).IsConst() ) return 0;
768  unsigned int k = fState.IntOfExt(i);
769  return fState.GlobalCC().GlobalCC()[k];
770 }
771 
772 
773 bool Minuit2Minimizer::GetMinosError(unsigned int i, double & errLow, double & errUp, int runopt) {
774  // return the minos error for parameter i
775  // if a minimum does not exist an error is returned
776  // runopt is a flag which specifies if only lower or upper error needs to be run
777  // if runopt = 0 both, = 1 only lower, + 2 only upper errors
778  errLow = 0; errUp = 0;
779  bool runLower = runopt != 2;
780  bool runUpper = runopt != 1;
781 
782  assert( fMinuitFCN );
783 
784  // need to know if parameter is const or fixed
785  if ( fState.Parameter(i).IsConst() || fState.Parameter(i).IsFixed() ) {
786  return false;
787  }
788 
789  int debugLevel = PrintLevel();
790  // internal minuit messages
791  MnPrint::SetLevel( debugLevel );
792 
793  // to run minos I need function minimum class
794  // redo minimization from current state
795 // ROOT::Minuit2::FunctionMinimum min =
796 // GetMinimizer()->Minimize(*GetFCN(),fState, ROOT::Minuit2::MnStrategy(strategy), MaxFunctionCalls(), Tolerance());
797 // fState = min.UserState();
798  if (fMinimum == 0) {
799  MN_ERROR_MSG("Minuit2Minimizer::GetMinosErrors: failed - no function minimum existing");
800  return false;
801  }
802 
803  if (!fMinimum->IsValid() ) {
804  MN_ERROR_MSG("Minuit2Minimizer::MINOS failed due to invalid function minimum");
805  return false;
806  }
807 
809  // if error def has been changed update it in FunctionMinimum
810  if (ErrorDef() != fMinimum->Up() )
812 
813  // switch off Minuit2 printing
814  int prev_level = (PrintLevel() <= 0 ) ? TurnOffPrintInfoLevel() : -2;
815 
816  // set the precision if needed
817  if (Precision() > 0) fState.SetPrecision(Precision());
818 
819 
821 
822  // run MnCross
823  MnCross low;
824  MnCross up;
825  int maxfcn = MaxFunctionCalls();
826  double tol = Tolerance();
827 
828  const char * par_name = fState.Name(i);
829 
830  // now input tolerance for migrad calls inside Minos (MnFunctionCross)
831  // before it was fixed to 0.05
832  // cut off too small tolerance (they are not needed)
833  tol = std::max(tol, 0.01);
834 
835  if (PrintLevel() >=1) {
836  // print the real number of maxfcn used (defined in MnMinos)
837  int maxfcn_used = maxfcn;
838  if (maxfcn_used == 0) {
839  int nvar = fState.VariableParameters();
840  maxfcn_used = 2*(nvar+1)*(200 + 100*nvar + 5*nvar*nvar);
841  }
842  // print an empty line above
843  std::cout << "******************************************************************************************************\n";
844  std::string txt = (runLower) ? "lower" : "upper";
845  if (runLower && runUpper) txt = "lower and upper";
846  std::cout << "Minuit2Minimizer::GetMinosError - Run MINOS " << txt << " error for parameter #" << i << " : " << par_name
847  << " using max-calls " << maxfcn_used << ", tolerance " << tol << std::endl;
848  }
849 
850 
851  if (runLower) low = minos.Loval(i,maxfcn,tol);
852  if (runUpper) up = minos.Upval(i,maxfcn,tol);
853 
854  ROOT::Minuit2::MinosError me(i, fMinimum->UserState().Value(i),low, up);
855 
856  if (prev_level > -2) RestoreGlobalPrintLevel(prev_level);
857 
858  // debug result of Minos
859  // print error message in Minos
860  // Note that the only invalid condition can happen when the (npar-1) minimization fails
861  // The error is also invalid when the maximum number of calls is reached or a new function minimum is found
862  // in case of the parameter at the limit the error is not ivalid.
863  // When the error is invalid the returned error is the Hessian error.
864 
865  if (debugLevel >= 1) {
866  if (runLower) {
867  if (!me.LowerValid() )
868  std::cout << "Minos: Invalid lower error for parameter " << par_name << std::endl;
869  if(me.AtLowerLimit())
870  std::cout << "Minos: Parameter : " << par_name << " is at Lower limit."<<std::endl;
871  if(me.AtLowerMaxFcn())
872  std::cout << "Minos: Maximum number of function calls exceeded when running for lower error for parameter " << par_name << std::endl;
873  if(me.LowerNewMin() )
874  std::cout << "Minos: New Minimum found while running Minos for lower error for parameter " << par_name << std::endl;
875 
876  if (debugLevel > 1 && me.LowerValid())
877  std::cout << "Minos: Lower error for parameter " << par_name << " : " << me.Lower() << std::endl;
878  }
879  if (runUpper) {
880  if (!me.UpperValid() )
881  std::cout << "Minos: Invalid upper error for parameter " << par_name << std::endl;
882  if(me.AtUpperLimit())
883  std::cout << "Minos: Parameter " << par_name << " is at Upper limit."<<std::endl;
884  if(me.AtUpperMaxFcn())
885  std::cout << "Minos: Maximum number of function calls exceeded when running for upper error for parameter " << par_name << std::endl;
886  if(me.UpperNewMin() )
887  std::cout << "Minos: New Minimum found while running Minos for upper error for parameter " << par_name << std::endl;
888 
889  if (debugLevel > 1 && me.UpperValid())
890  std::cout << "Minos: Upper error for parameter " << par_name << " : " << me.Upper() << std::endl;
891  }
892 
893  }
894 
895  bool lowerInvalid = (runLower && !me.LowerValid() );
896  bool upperInvalid = (runUpper && !me.UpperValid() );
897  int mstatus = 0;
898  if (lowerInvalid || upperInvalid ) {
899  // set status accroding to bit
900  // bit 1: lower invalid Minos errors
901  // bit 2: uper invalid Minos error
902  // bit 3: invalid because max FCN
903  // bit 4 : invalid because a new minimum has been found
904  if (lowerInvalid) {
905  mstatus |= 1;
906  if (me.AtLowerMaxFcn() ) mstatus |= 4;
907  if (me.LowerNewMin() ) mstatus |= 8;
908  }
909  if(upperInvalid) {
910  mstatus |= 3;
911  if (me.AtUpperMaxFcn() ) mstatus |= 4;
912  if (me.UpperNewMin() ) mstatus |= 8;
913  }
914  //std::cout << "Error running Minos for parameter " << i << std::endl;
915  fStatus += 10*mstatus;
916  }
917 
918  if (runLower) errLow = me.Lower();
919  if (runUpper) errUp = me.Upper();
920 
921  // in case of new minimum update minimum state
922  int iflagNewMinimum = 0;
923  if ( ( runLower && me.LowerNewMin()) && (runUpper && me.UpperNewMin() ) ) {
924  iflagNewMinimum = 3;
925  // take state with lower function value
926  fState = (low.State().Fval() < up.State().Fval()) ? low.State() : up.State();
927  } else if ( runLower && me.LowerNewMin() ) {
928  iflagNewMinimum = 1;
929  fState = low.State();
930  } else if ( runUpper && me.UpperNewMin() ) {
931  iflagNewMinimum = 2;
932  fState = up.State();
933  }
934 
935  // run gain the Minimization
936  if (iflagNewMinimum > 0) {
937  MN_INFO_MSG2("Minuit2Minimizer::GetMinosError",
938  "Found a new minimum: run again the Minimization starting from the new point ");
939  if (debugLevel > 1) {
940  std::cout << "New minimum point found by Minos : " << std::endl;
941  std::cout << "FVAL = " << fState.Fval() << std::endl;
942  for (auto & par : fState.MinuitParameters() ) {
943  std::cout << par.Name() << "\t = " << par.Value() << std::endl;
944  }
945  }
946  // release parameter that was fixed in the returned state from Minos
947  ReleaseVariable(i);
948  bool ok = Minimize();
949  if (!ok) return false;
950  // run again Minos from new Minimum (also lower error needs to be re-computed)
951  MN_INFO_MSG2("Minuit2Minimizer::GetMinosError", "Run now again Minos from the new found Minimum");
952  GetMinosError(i, errLow, errUp, runopt);
953  }
954 
955  bool isValid = (runLower && me.LowerValid() ) || (runUpper && me.UpperValid() );
956  return isValid;
957 }
958 
959 bool Minuit2Minimizer::Scan(unsigned int ipar, unsigned int & nstep, double * x, double * y, double xmin, double xmax) {
960  // scan a parameter (variable) around the minimum value
961  // the parameters must have been set before
962  // if xmin=0 && xmax == 0 by default scan around 2 sigma of the error
963  // if the errors are also zero then scan from min and max of parameter range
964 
965  if (!fMinuitFCN) {
966  MN_ERROR_MSG2("Minuit2Minimizer::Scan"," Function must be set before using Scan");
967  return false;
968  }
969 
970  if ( ipar > fState.MinuitParameters().size() ) {
971  MN_ERROR_MSG2("Minuit2Minimizer::Scan"," Invalid number. Minimizer variables must be set before using Scan");
972  return false;
973  }
974 
975  // switch off Minuit2 printing
976  int prev_level = (PrintLevel() <= 0 ) ? TurnOffPrintInfoLevel() : -2;
977 
979 
980 
981  // set the precision if needed
982  if (Precision() > 0) fState.SetPrecision(Precision());
983 
985  double amin = scan.Fval(); // fcn value of the function before scan
986 
987  // first value is param value
988  std::vector<std::pair<double, double> > result = scan(ipar, nstep-1, xmin, xmax);
989 
990  if (prev_level > -2) RestoreGlobalPrintLevel(prev_level);
991 
992  if (result.size() != nstep) {
993  MN_ERROR_MSG2("Minuit2Minimizer::Scan"," Invalid result from MnParameterScan");
994  return false;
995  }
996  // sort also the returned points in x
997  std::sort(result.begin(), result.end() );
998 
999 
1000  for (unsigned int i = 0; i < nstep; ++i ) {
1001  x[i] = result[i].first;
1002  y[i] = result[i].second;
1003  }
1004 
1005  // what to do if a new minimum has been found ?
1006  // use that as new minimum
1007  if (scan.Fval() < amin ) {
1008  MN_INFO_MSG2("Minuit2Minimizer::Scan","A new minimum has been found");
1009  fState.SetValue(ipar, scan.Parameters().Value(ipar) );
1010 
1011  }
1012 
1013 
1014  return true;
1015 }
1016 
1017 bool Minuit2Minimizer::Contour(unsigned int ipar, unsigned int jpar, unsigned int & npoints, double * x, double * y) {
1018  // contour plot for parameter i and j
1019  // need a valid FunctionMinimum otherwise exits
1020  if (fMinimum == 0) {
1021  MN_ERROR_MSG2("Minuit2Minimizer::Contour"," no function minimum existing. Must minimize function before");
1022  return false;
1023  }
1024 
1025  if (!fMinimum->IsValid() ) {
1026  MN_ERROR_MSG2("Minuit2Minimizer::Contour","Invalid function minimum");
1027  return false;
1028  }
1029  assert(fMinuitFCN);
1030 
1032  // if error def has been changed update it in FunctionMinimum
1033  if (ErrorDef() != fMinimum->Up() ) {
1035  }
1036 
1037  if ( PrintLevel() >= 1 )
1038  MN_INFO_VAL2("Minuit2Minimizer::Contour - computing contours - ",ErrorDef());
1039 
1040  // switch off Minuit2 printing (for level of 0,1)
1041  int prev_level = (PrintLevel() <= 1 ) ? TurnOffPrintInfoLevel() : -2;
1042 
1043  // decrease print-level to have too many messages
1044  MnPrint::SetLevel( PrintLevel() -1 );
1045 
1046  // set the precision if needed
1047  if (Precision() > 0) fState.SetPrecision(Precision());
1048 
1049  // eventually one should specify tolerance in contours
1050  MnContours contour(*fMinuitFCN, *fMinimum, Strategy() );
1051 
1052  if (prev_level > -2) RestoreGlobalPrintLevel(prev_level);
1053 
1054  // compute the contour
1055  std::vector<std::pair<double,double> > result = contour(ipar,jpar, npoints);
1056  if (result.size() != npoints) {
1057  MN_ERROR_MSG2("Minuit2Minimizer::Contour"," Invalid result from MnContours");
1058  return false;
1059  }
1060  for (unsigned int i = 0; i < npoints; ++i ) {
1061  x[i] = result[i].first;
1062  y[i] = result[i].second;
1063  }
1064 
1065  // restore print level
1067 
1068 
1069  return true;
1070 
1071 
1072 }
1073 
1074 bool Minuit2Minimizer::Hesse( ) {
1075  // find Hessian (full second derivative calculations)
1076  // the contained state will be updated with the Hessian result
1077  // in case a function minimum exists and is valid the result will be
1078  // appended in the function minimum
1079 
1080  if (!fMinuitFCN) {
1081  MN_ERROR_MSG2("Minuit2Minimizer::Hesse","FCN function has not been set");
1082  return false;
1083  }
1085  int strategy = Strategy();
1086  int maxfcn = MaxFunctionCalls();
1087 
1088  // switch off Minuit2 printing
1089  int prev_level = (PrintLevel() <= 0 ) ? TurnOffPrintInfoLevel() : -2;
1090 
1092 
1093  // set the precision if needed
1094  if (Precision() > 0) fState.SetPrecision(Precision());
1095 
1096  ROOT::Minuit2::MnHesse hesse( strategy );
1097 
1098  if (PrintLevel() >= 1)
1099  std::cout << "Minuit2Minimizer::Hesse using max-calls " << maxfcn << std::endl;
1100 
1101  // case when function minimum exists
1102  if (fMinimum) {
1103 
1104  // if (PrintLevel() >= 3) {
1105  // std::cout << "Minuit2Minimizer::Hesse - State before running Hesse " << std::endl;
1106  // std::cout << fState << std::endl;
1107  // }
1108 
1109  // run hesse and function minimum will be updated with Hesse result
1110  hesse( *fMinuitFCN, *fMinimum, maxfcn );
1111  // update user state
1112  fState = fMinimum->UserState();
1113  }
1114 
1115  else {
1116  // run Hesse on point stored in current state (independent of function minimum validity)
1117  // (x == 0)
1118  fState = hesse( *fMinuitFCN, fState, maxfcn);
1119  }
1120 
1121  if (prev_level > -2) RestoreGlobalPrintLevel(prev_level);
1122 
1123  if (PrintLevel() >= 3) {
1124  std::cout << "Minuit2Minimizer::Hesse - State returned from Hesse " << std::endl;
1125  std::cout << fState << std::endl;
1126  }
1127 
1128  int covStatus = fState.CovarianceStatus();
1129  std::string covStatusType = "not valid";
1130  if (covStatus == 1) covStatusType = "approximate";
1131  if (covStatus == 2) covStatusType = "full but made positive defined";
1132  if (covStatus == 3) covStatusType = "accurate";
1133 
1134  if (!fState.HasCovariance() ) {
1135  // if false means error is not valid and this is due to a failure in Hesse
1136  // update minimizer error status
1137  int hstatus = 4;
1138  // information on error state can be retrieved only if fMinimum is available
1139  if (fMinimum) {
1140  if (fMinimum->Error().HesseFailed() ) hstatus = 1;
1141  if (fMinimum->Error().InvertFailed() ) hstatus = 2;
1142  else if (!(fMinimum->Error().IsPosDef()) ) hstatus = 3;
1143  }
1144  if (PrintLevel() > 0) {
1145  std::string msg = "Hesse failed - matrix is " + covStatusType;
1146  MN_INFO_MSG2("Minuit2Minimizer::Hesse",msg);
1147  MN_INFO_VAL2("MInuit2Minimizer::Hesse",hstatus);
1148  }
1149  fStatus += 100*hstatus;
1150  return false;
1151  }
1152  if (PrintLevel() > 0) {
1153  std::string msg = "Hesse is valid - matrix is " + covStatusType;
1154  MN_INFO_MSG2("Minuit2Minimizer::Hesse",msg);
1155  }
1156 
1157  return true;
1158 }
1159 
1161  // return status of covariance matrix
1162  //-1 - not available (inversion failed or Hesse failed)
1163  // 0 - available but not positive defined
1164  // 1 - covariance only approximate
1165  // 2 full matrix but forced pos def
1166  // 3 full accurate matrix
1167 
1168  if (fMinimum) {
1169  // case a function minimum is available
1170  if (fMinimum->HasAccurateCovar() ) return 3;
1171  else if (fMinimum->HasMadePosDefCovar() ) return 2;
1172  else if (fMinimum->HasValidCovariance() ) return 1;
1173  else if (fMinimum->HasCovariance() ) return 0;
1174  return -1;
1175  }
1176  else {
1177  // case fMinimum is not available - use state information
1178  return fState.CovarianceStatus();
1179  }
1180  return 0;
1181 }
1182 
1183 void Minuit2Minimizer::SetTraceObject(MnTraceObject & obj) {
1184  // set trace object
1185  if (!fMinimizer) return;
1187 }
1188 
1189 void Minuit2Minimizer::SetStorageLevel(int level) {
1190  // set storage level
1191  if (!fMinimizer) return;
1193  }
1194 
1195 } // end namespace Minuit2
1196 
1197 } // end namespace ROOT
ROOT::Minuit2::Minuit2Minimizer::fMinimum
ROOT::Minuit2::FunctionMinimum * fMinimum
Definition: Minuit2Minimizer.h:324
ROOT::Minuit2::MinuitParameter
class for the individual Minuit Parameter with Name and number; contains the input numbers for the mi...
Definition: MinuitParameter.h:41
ROOT::Math::IOptions::GetValue
bool GetValue(const char *name, T &t) const
Definition: IOptions.h:89
l
auto * l
Definition: textangle.C:4
FCNAdapter.h
m
auto * m
Definition: textangle.C:8
ROOT::Minuit2::kMigrad
@ kMigrad
Definition: Minuit2Minimizer.h:47
n
const Int_t n
Definition: legend1.C:16
ROOT::Minuit2::MinimumState::Edm
double Edm() const
Definition: MinimumState.h:73
ROOT::Minuit2::MinimumState::HasCovariance
bool HasCovariance() const
Definition: MinimumState.h:79
ROOT::Minuit2::MnUserParameterState::HasCovariance
bool HasCovariance() const
Definition: MnUserParameterState.h:112
ROOT::Minuit2::EMinimizerType
EMinimizerType
Definition: Minuit2Minimizer.h:46
IFunction.h
ROOT::Fit::ParameterSettings::SetLowerLimit
void SetLowerLimit(double low)
set a single lower limit
Definition: ParameterSettings.h:189
MN_INFO_VAL2
#define MN_INFO_VAL2(loc, x)
Definition: MnPrint.h:131
ROOT::Minuit2::MnUserTransformation::FindIndex
int FindIndex(const std::string &) const
Definition: MnUserTransformation.cxx:443
ROOT::Minuit2::FunctionMinimum::Up
double Up() const
Definition: FunctionMinimum.h:105
ROOT::Minuit2::Minuit2Minimizer::SetMinimizer
virtual void SetMinimizer(ROOT::Minuit2::ModularFunctionMinimizer *m)
Definition: Minuit2Minimizer.h:306
MnMinos.h
ROOT::Minuit2::MinimumState
MinimumState keeps the information (position, Gradient, 2nd deriv, etc) after one minimization step (...
Definition: MinimumState.h:37
ROOT::Minuit2::Minuit2Minimizer::SetLimitedVariable
virtual bool SetLimitedVariable(unsigned int ivar, const std::string &name, double val, double step, double, double)
set upper/lower limited variable (override if minimizer supports them )
Definition: Minuit2Minimizer.cxx:238
ROOT::Minuit2::Minuit2Minimizer::SetVariableUpperLimit
virtual bool SetVariableUpperLimit(unsigned int ivar, double upper)
set the upper-limit of an already existing variable
Definition: Minuit2Minimizer.cxx:302
ROOT::Math::Minimizer::Strategy
int Strategy() const
strategy
Definition: Minimizer.h:429
ROOT::Minuit2::FunctionMinimum::HesseFailed
bool HesseFailed() const
Definition: FunctionMinimum.h:112
ROOT::Minuit2::MnUserParameterState::MinuitParameters
const std::vector< ROOT::Minuit2::MinuitParameter > & MinuitParameters() const
facade: forward interface of MnUserParameters and MnUserTransformation
Definition: MnUserParameterState.cxx:193
ROOT::Minuit2::MinuitParameter::UpperLimit
double UpperLimit() const
Definition: MinuitParameter.h:169
ROOT::Math::Minimizer::PrintLevel
int PrintLevel() const
minimizer configuration parameters
Definition: Minimizer.h:413
ROOT::Minuit2::Minuit2Minimizer::SetVariableStepSize
virtual bool SetVariableStepSize(unsigned int ivar, double step)
set the step size of an already existing variable
Definition: Minuit2Minimizer.cxx:287
ROOT::Minuit2::FumiliFCNAdapter
template wrapped class for adapting to FumiliFCNBase signature
Definition: FumiliFCNAdapter.h:50
ROOT::Math::Minimizer::ErrorDef
double ErrorDef() const
return the statistical scale used for calculate the error is typically 1 for Chi2 and 0....
Definition: Minimizer.h:436
ROOT::Minuit2::FunctionMinimum::IsValid
bool IsValid() const
Definition: FunctionMinimum.h:106
ROOT::Minuit2::MnUserParameterState::RemoveLimits
void RemoveLimits(unsigned int)
Definition: MnUserParameterState.cxx:360
ROOT::Minuit2::kCombined
@ kCombined
Definition: Minuit2Minimizer.h:49
FunctionMinimum.h
xmax
float xmax
Definition: THbookFile.cxx:95
ROOT::Minuit2::Minuit2Minimizer::Errors
virtual const double * Errors() const
return errors at the minimum
Definition: Minuit2Minimizer.cxx:668
ROOT::Minuit2::Minuit2Minimizer::Contour
virtual bool Contour(unsigned int i, unsigned int j, unsigned int &npoints, double *xi, double *xj)
find the contour points (xi,xj) of the function for parameter i and j around the minimum The contour ...
Definition: Minuit2Minimizer.cxx:1027
ROOT::Minuit2::Minuit2Minimizer::GlobalCC
virtual double GlobalCC(unsigned int i) const
get global correlation coefficient for the variable i.
Definition: Minuit2Minimizer.cxx:769
ROOT::Minuit2::MinimumBuilder::SetStorageLevel
virtual void SetStorageLevel(int level)
Definition: MinimumBuilder.h:53
ROOT::Minuit2::FunctionMinimum::HasAccurateCovar
bool HasAccurateCovar() const
Definition: FunctionMinimum.h:109
ROOT::Minuit2::FunctionMinimum::HasReachedCallLimit
bool HasReachedCallLimit() const
Definition: FunctionMinimum.h:115
ROOT::Minuit2::MnUserParameterState::SetError
void SetError(unsigned int, double)
Definition: MnUserParameterState.cxx:311
ROOT::Minuit2::FCNAdapter
template wrapped class for adapting to FCNBase signature
Definition: FCNAdapter.h:41
ROOT::Minuit2::MnUserParameterState::NFcn
unsigned int NFcn() const
Definition: MnUserParameterState.h:117
ROOT::Math::IBaseFunctionMultiDimTempl::NDim
virtual unsigned int NDim() const =0
Retrieve the dimension of the function.
MnMigrad.h
ROOT::Minuit2::MnUserParameterState::Fval
double Fval() const
Definition: MnUserParameterState.h:115
x
Double_t x[n]
Definition: legend1.C:17
ROOT::Minuit2::FunctionMinimum::SetErrorDef
void SetErrorDef(double up)
Definition: FunctionMinimum.h:117
ROOT::Math::IGradientFunctionMultiDimTempl
Interface (abstract class) for multi-dimensional functions providing a gradient calculation.
Definition: IFunction.h:326
ROOT::Minuit2::MinuitParameter::HasUpperLimit
bool HasUpperLimit() const
Definition: MinuitParameter.h:167
ROOT::Minuit2::MinimumState::NFcn
int NFcn() const
Definition: MinimumState.h:74
ROOT::Minuit2::MnGlobalCorrelationCoeff::GlobalCC
const std::vector< double > & GlobalCC() const
Definition: MnGlobalCorrelationCoeff.h:49
ROOT::Math::Minimizer::MaxFunctionCalls
unsigned int MaxFunctionCalls() const
max number of function calls
Definition: Minimizer.h:416
ROOT::Minuit2::MnUserParameterState::CovarianceStatus
int CovarianceStatus() const
Definition: MnUserParameterState.h:106
MnContours.h
ROOT::Minuit2::MnParameterScan
Scans the values of FCN as a function of one Parameter and retains the best function and Parameter va...
Definition: MnParameterScan.h:38
ROOT::Minuit2::MnUserParameterState::VariableParameters
unsigned int VariableParameters() const
Definition: MnUserParameterState.cxx:433
ROOT::Minuit2::Minuit2Minimizer::ReleaseVariable
virtual bool ReleaseVariable(unsigned int ivar)
release an existing variable
Definition: Minuit2Minimizer.cxx:325
ROOT::Minuit2::MnUserParameterState::SetPrecision
void SetPrecision(double eps)
Definition: MnUserParameterState.cxx:442
ROOT::Minuit2::MnUserParameterState::SetLimits
void SetLimits(unsigned int, double, double)
Definition: MnUserParameterState.cxx:316
ROOT::Fit::ParameterSettings::Fix
void Fix()
fix the parameter
Definition: ParameterSettings.h:151
ROOT::Minuit2::ControlPrintLevel
int ControlPrintLevel()
Definition: Minuit2Minimizer.cxx:84
ROOT::Minuit2::MnUserParameterState::Edm
double Edm() const
Definition: MnUserParameterState.h:116
ROOT::Minuit2::FunctionMinimum::UserState
const MnUserParameterState & UserState() const
Definition: FunctionMinimum.h:86
ROOT::Minuit2::TurnOffPrintInfoLevel
int TurnOffPrintInfoLevel()
Definition: Minuit2Minimizer.cxx:83
ROOT::Minuit2::FCNGradAdapter
template wrapped class for adapting to FCNBase signature a IGradFunction
Definition: FCNGradAdapter.h:46
ROOT::Minuit2::kMigradBFGS
@ kMigradBFGS
Definition: Minuit2Minimizer.h:52
ROOT::Minuit2::Minuit2Minimizer::VariableName
virtual std::string VariableName(unsigned int ivar) const
get name of variables (override if minimizer support storing of variable names)
Definition: Minuit2Minimizer.cxx:257
ROOT::Minuit2::MinuitParameter::IsConst
bool IsConst() const
Definition: MinuitParameter.h:162
TROOT.h
ROOT::Minuit2::MnTraceObject
Definition: MnTraceObject.h:28
ROOT::Minuit2::FunctionMinimum::Error
const MinimumError & Error() const
Definition: FunctionMinimum.h:99
MN_ERROR_MSG
#define MN_ERROR_MSG(str)
Definition: MnPrint.h:114
ROOT::Minuit2::MnUserParameterState::GetName
const std::string & GetName(unsigned int) const
Definition: MnUserParameterState.cxx:410
ROOT::Minuit2::Minuit2Minimizer::SetLowerLimitedVariable
virtual bool SetLowerLimitedVariable(unsigned int ivar, const std::string &name, double val, double step, double lower)
set lower limit variable (override if minimizer supports them )
Definition: Minuit2Minimizer.cxx:222
Minuit2Minimizer.h
ROOT::Minuit2::MinimumError::HesseFailed
bool HesseFailed() const
Definition: MinimumError.h:81
ROOT::Minuit2::VariableMetricMinimizer::BFGSType
Definition: VariableMetricMinimizer.h:48
TMinuit2TraceObject.h
ROOT::Minuit2::Minuit2Minimizer::fDim
unsigned int fDim
Definition: Minuit2Minimizer.h:317
ROOT::Minuit2::kFumili
@ kFumili
Definition: Minuit2Minimizer.h:51
IOptions.h
ROOT::Math::MinimizerOptions::FindDefault
static ROOT::Math::IOptions * FindDefault(const char *name)
Definition: MinimizerOptions.cxx:234
ROOT::Minuit2::MinimumState::Error
const MinimumError & Error() const
Definition: MinimumState.h:70
ROOT::Minuit2::Minuit2Minimizer::SetVariableValue
virtual bool SetVariableValue(unsigned int ivar, double val)
set variable
Definition: Minuit2Minimizer.cxx:271
ROOT::Minuit2::Minuit2Minimizer::fUseFumili
bool fUseFumili
Definition: Minuit2Minimizer.h:318
ROOT::Minuit2::ModularFunctionMinimizer::Builder
virtual const MinimumBuilder & Builder() const =0
ROOT::Minuit2::FCNBase::SetErrorDef
virtual void SetErrorDef(double)
add interface to set dynamically a new error definition Re-implement this function if needed.
Definition: FCNBase.h:122
xmin
float xmin
Definition: THbookFile.cxx:95
ROOT::Minuit2::SimplexMinimizer
Class implementing the required methods for a minimization using Simplex.
Definition: SimplexMinimizer.h:36
MinuitParameter.h
ROOT::Minuit2::MnUserParameterState::Name
const char * Name(unsigned int) const
Definition: MnUserParameterState.cxx:406
ROOT::Minuit2::MinosError
Class holding the result of Minos (lower and upper values) for a specific parameter.
Definition: MinosError.h:34
ROOT::Minuit2::MnUserParameterState::Hessian
MnUserCovariance Hessian() const
Definition: MnUserParameterState.cxx:168
ROOT::Minuit2::Minuit2Minimizer::Correlation
virtual double Correlation(unsigned int i, unsigned int j) const
return correlation coefficient between variable i and j.
Definition: Minuit2Minimizer.cxx:755
ROOT::Minuit2::Minuit2Minimizer::fState
ROOT::Minuit2::MnUserParameterState fState
Definition: Minuit2Minimizer.h:320
ROOT::Minuit2::MnUserParameterState::Trafo
const MnUserTransformation & Trafo() const
Definition: MnUserParameterState.h:109
MN_INFO_MSG2
#define MN_INFO_MSG2(loc, str)
Definition: MnPrint.h:125
ROOT::Minuit2::Minuit2Minimizer::~Minuit2Minimizer
virtual ~Minuit2Minimizer()
Destructor (no operations)
Definition: Minuit2Minimizer.cxx:159
ROOT::Minuit2::MnUserParameterState::SetValue
void SetValue(unsigned int, double)
Definition: MnUserParameterState.cxx:299
ROOT::Minuit2::MinimumState::Fval
double Fval() const
Definition: MinimumState.h:72
ROOT::Fit::ParameterSettings::SetUpperLimit
void SetUpperLimit(double up)
set a single upper limit
Definition: ParameterSettings.h:182
ROOT::Minuit2::RestoreGlobalPrintLevel
void RestoreGlobalPrintLevel(int)
Definition: Minuit2Minimizer.cxx:85
ROOT::Fit::ParameterSettings::SetLimits
void SetLimits(double low, double up)
set a double side limit, if low == up the parameter is fixed if low > up the limits are removed The c...
Definition: ParameterSettings.h:162
ROOT::Math::Minimizer::Tolerance
double Tolerance() const
absolute tolerance
Definition: Minimizer.h:422
ROOT::Fit::ParameterSettings::Set
void Set(const std::string &name, double value, double step)
set value and name (unlimited parameter)
Definition: ParameterSettings.h:93
ROOT::Minuit2::MinuitParameter::IsFixed
bool IsFixed() const
Definition: MinuitParameter.h:163
ROOT::Minuit2::MnUserParameterState::HasGlobalCC
bool HasGlobalCC() const
Definition: MnUserParameterState.h:113
ROOT::Math::Minimizer::fStatus
int fStatus
Definition: Minimizer.h:492
TMinuit2TraceObject
Definition: TMinuit2TraceObject.h:30
ROOT::Minuit2::MinimumError::Dcovar
double Dcovar() const
Definition: MinimumError.h:76
ROOT::Minuit2::MnUserParameterState::SetUpperLimit
void SetUpperLimit(unsigned int, double)
Definition: MnUserParameterState.cxx:332
MnTraceObject.h
ROOT::Math::IOptions
Generic interface for defining configuration options of a numerical algorithm.
Definition: IOptions.h:41
y
Double_t y[n]
Definition: legend1.C:17
ROOT::Minuit2::MinuitParameter::Value
double Value() const
Definition: MinuitParameter.h:117
sqrt
double sqrt(double)
ROOT::Minuit2::MinimumError::InvertFailed
bool InvertFailed() const
Definition: MinimumError.h:82
ROOT::Minuit2::MinimumBuilder::SetPrintLevel
virtual void SetPrintLevel(int level)
Definition: MinimumBuilder.h:52
ROOT::Minuit2::Minuit2Minimizer
Minuit2Minimizer class implementing the ROOT::Math::Minimizer interface for Minuit2 minimization algo...
Definition: Minuit2Minimizer.h:65
VariableMetricMinimizer.h
ROOT::Minuit2::MinimumBuilder::SetTraceObject
virtual void SetTraceObject(MnTraceObject &obj)
Definition: MinimumBuilder.h:56
ROOT::Minuit2::Minuit2Minimizer::PrintResults
virtual void PrintResults()
return reference to the objective function virtual const ROOT::Math::IGenFunction & Function() const;
Definition: Minuit2Minimizer.cxx:622
ROOT::Minuit2::Minuit2Minimizer::FixVariable
virtual bool FixVariable(unsigned int ivar)
fix an existing variable
Definition: Minuit2Minimizer.cxx:318
MnHesse.h
FumiliFCNAdapter.h
ROOT::Fit::ParameterSettings
Class, describing value, limits and step size of the parameters Provides functionality also to set/re...
Definition: ParameterSettings.h:46
ScanMinimizer.h
ROOT::Minuit2::MinimumState::size
int size() const
Definition: MinimumState.h:68
ROOT::Minuit2::MinimumState::Vec
const MnAlgebraicVector & Vec() const
Definition: MinimumState.h:67
ROOT::Math::Minimizer::IsValidError
bool IsValidError() const
return true if Minimizer has performed a detailed error validation (e.g. run Hesse for Minuit)
Definition: Minimizer.h:439
ROOT::Minuit2::Minuit2Minimizer::CovMatrixStatus
virtual int CovMatrixStatus() const
return the status of the covariance matrix status = -1 : not available (inversion failed or Hesse fai...
Definition: Minuit2Minimizer.cxx:1170
MnParameterScan.h
ROOT::Minuit2::MinuitParameter::HasLimits
bool HasLimits() const
Definition: MinuitParameter.h:165
ROOT::Minuit2::MnUserParameterState::Add
void Add(const std::string &name, double val, double err)
Definition: MnUserParameterState.cxx:212
MinosError.h
RooFit::Minimizer
RooCmdArg Minimizer(const char *type, const char *alg=0)
Definition: RooGlobalFunc.cxx:211
ROOT::Minuit2::Minuit2Minimizer::SetStorageLevel
void SetStorageLevel(int level)
set storage level = 1 : store all iteration states (default) = 0 : store only first and last state to...
Definition: Minuit2Minimizer.cxx:1199
gErrorIgnoreLevel
R__EXTERN Int_t gErrorIgnoreLevel
Definition: TError.h:131
ROOT::Minuit2::FunctionMinimum
class holding the full result of the minimization; both internal and external (MnUserParameterState) ...
Definition: FunctionMinimum.h:40
ROOT::Minuit2::FCNGradientBase
Extension of the FCNBase for providing the analytical Gradient of the function.
Definition: FCNGradientBase.h:42
ROOT::Minuit2::MinuitParameter::Error
double Error() const
Definition: MinuitParameter.h:118
ROOT::Math::IGradientFunctionMultiDimTempl::NDim
virtual unsigned int NDim() const=0
Retrieve the dimension of the function.
ROOT::Minuit2::MnUserParameterState
class which holds the external user and/or internal Minuit representation of the parameters and error...
Definition: MnUserParameterState.h:42
ROOT::Minuit2::kSimplex
@ kSimplex
Definition: Minuit2Minimizer.h:48
ROOT::Minuit2::MnUserParameterState::Parameter
const MinuitParameter & Parameter(unsigned int i) const
Definition: MnUserParameterState.cxx:207
ROOT::Minuit2::Minuit2Minimizer::GetFCN
virtual const ROOT::Minuit2::FCNBase * GetFCN() const
Definition: Minuit2Minimizer.h:310
ROOT::Minuit2::Minuit2Minimizer::GetMinosError
virtual bool GetMinosError(unsigned int i, double &errLow, double &errUp, int=0)
get the minos error for parameter i, return false if Minos failed A minimizaiton must be performed be...
Definition: Minuit2Minimizer.cxx:783
CombinedMinimizer.h
ROOT::Minuit2::MnUserParameterState::IntOfExt
unsigned int IntOfExt(unsigned int) const
Definition: MnUserParameterState.cxx:425
ROOT::Minuit2::MnPrint::SetLevel
static int SetLevel(int level)
Definition: MnPrint.cxx:41
ROOT::Minuit2::Minuit2Minimizer::SetFixedVariable
virtual bool SetFixedVariable(unsigned int, const std::string &, double)
set fixed variable (override if minimizer supports them )
Definition: Minuit2Minimizer.cxx:245
SimplexMinimizer.h
ROOT::Minuit2::CombinedMinimizer
Combined minimizer: combination of Migrad and Simplex.
Definition: CombinedMinimizer.h:38
ROOT::Minuit2::Minuit2Minimizer::SetVariableValues
virtual bool SetVariableValues(const double *val)
set the values of all existing variables (array must be dimensioned to the size of the existing param...
Definition: Minuit2Minimizer.cxx:278
ROOT::Minuit2::Minuit2Minimizer::fValues
std::vector< double > fValues
Definition: Minuit2Minimizer.h:325
ROOT::Minuit2::Minuit2Minimizer::GetHessianMatrix
virtual bool GetHessianMatrix(double *h) const
Fill the passed array with the Hessian matrix elements The Hessian matrix is the matrix of the second...
Definition: Minuit2Minimizer.cxx:726
ROOT::Minuit2::MnUserParameterState::Parameters
const MnUserParameters & Parameters() const
Definition: MnUserParameterState.h:94
ROOT::Minuit2::Minuit2Minimizer::SetVariable
virtual bool SetVariable(unsigned int ivar, const std::string &name, double val, double step)
set free variable
Definition: Minuit2Minimizer.cxx:192
ROOT::Minuit2::Minuit2Minimizer::SetVariableLowerLimit
virtual bool SetVariableLowerLimit(unsigned int ivar, double lower)
set the lower-limit of an already existing variable
Definition: Minuit2Minimizer.cxx:295
ROOT::Minuit2::Minuit2Minimizer::GetVariableSettings
virtual bool GetVariableSettings(unsigned int ivar, ROOT::Fit::ParameterSettings &varObj) const
get variable settings in a variable object (like ROOT::Fit::ParamsSettings)
Definition: Minuit2Minimizer.cxx:341
ROOT::Minuit2::Minuit2Minimizer::IsFixedVariable
virtual bool IsFixedVariable(unsigned int ivar) const
query if an existing variable is fixed (i.e.
Definition: Minuit2Minimizer.cxx:332
ROOT::Minuit2::FunctionMinimum::HasValidCovariance
bool HasValidCovariance() const
Definition: FunctionMinimum.h:108
TObject
Definition: TObject.h:37
ROOT::Minuit2::FunctionMinimum::HasPosDefCovar
bool HasPosDefCovar() const
Definition: FunctionMinimum.h:110
ROOT::Minuit2::MnUserParameterState::GlobalCC
const MnGlobalCorrelationCoeff & GlobalCC() const
Definition: MnUserParameterState.h:96
ROOT::Minuit2::MinimumState::HasParameters
bool HasParameters() const
Definition: MinimumState.h:78
ROOT::Minuit2::MnStrategy
API class for defining three levels of strategies: low (0), medium (1), high (>=2); acts on: Migrad (...
Definition: MnStrategy.h:35
ROOT::Minuit2::Minuit2Minimizer::VariableIndex
virtual int VariableIndex(const std::string &name) const
get index of variable given a variable given a name return -1 if variable is not found
Definition: Minuit2Minimizer.cxx:264
ROOT::Minuit2::Minuit2Minimizer::X
virtual const double * X() const
return pointer to X values at the minimum
Definition: Minuit2Minimizer.cxx:652
ROOT::Minuit2::Minuit2Minimizer::CovMatrix
virtual double CovMatrix(unsigned int i, unsigned int j) const
return covariance matrix elements if the variable is fixed or const the value is zero The ordering of...
Definition: Minuit2Minimizer.cxx:688
ROOT::Minuit2::Minuit2Minimizer::ExamineMinimum
bool ExamineMinimum(const ROOT::Minuit2::FunctionMinimum &min)
examine the minimum result
Definition: Minuit2Minimizer.cxx:548
ROOT::Minuit2::MnUserParameterState::Index
unsigned int Index(const std::string &) const
Definition: MnUserParameterState.cxx:401
name
char name[80]
Definition: TGX11.cxx:110
ROOT::Minuit2::MnUserParameterState::Release
void Release(unsigned int)
Definition: MnUserParameterState.cxx:285
ROOT::Math::IOptions::Print
virtual void Print(std::ostream &=std::cout) const
print options
Definition: IOptions.h:114
FumiliMinimizer.h
MnUserFcn.h
ROOT::Minuit2::ScanMinimizer
Class implementing the required methods for a minimization using SCAN API is provided in the upper RO...
Definition: ScanMinimizer.h:36
MinimumBuilder.h
ROOT::Minuit2::VariableMetricMinimizer
Instantiates the SeedGenerator and MinimumBuilder for Variable Metric Minimization method.
Definition: VariableMetricMinimizer.h:42
MN_ERROR_MSG2
#define MN_ERROR_MSG2(loc, str)
Definition: MnPrint.h:128
ROOT::Minuit2::Minuit2Minimizer::Hesse
virtual bool Hesse()
perform a full calculation of the Hessian matrix for error calculation If a valid minimum exists the ...
Definition: Minuit2Minimizer.cxx:1084
ROOT::Minuit2::Minuit2Minimizer::Scan
virtual bool Scan(unsigned int i, unsigned int &nstep, double *x, double *y, double xmin=0, double xmax=0)
scan a parameter i around the minimum.
Definition: Minuit2Minimizer.cxx:969
ROOT::Minuit2::MnMinos
API class for Minos Error analysis (asymmetric errors); minimization has to be done before and Minimu...
Definition: MnMinos.h:42
ROOT::Minuit2::Minuit2Minimizer::GetMinimizer
virtual const ROOT::Minuit2::ModularFunctionMinimizer * GetMinimizer() const
Definition: Minuit2Minimizer.h:304
ROOT::Math::BasicFitMethodFunction
FitMethodFunction class Interface for objective functions (like chi2 and likelihood used in the fit) ...
Definition: Fitter.h:40
ROOT::Minuit2::FunctionMinimum::HasCovariance
bool HasCovariance() const
Definition: FunctionMinimum.h:113
ROOT::Minuit2::FunctionMinimum::IsAboveMaxEdm
bool IsAboveMaxEdm() const
Definition: FunctionMinimum.h:114
ParameterSettings.h
ROOT::Minuit2::Minuit2Minimizer::fErrors
std::vector< double > fErrors
Definition: Minuit2Minimizer.h:326
ROOT::Minuit2::FunctionMinimum::State
const MinimumState & State() const
Definition: FunctionMinimum.h:97
ROOT::Minuit2::MinuitParameter::LowerLimit
double LowerLimit() const
Definition: MinuitParameter.h:168
type
int type
Definition: TGX11.cxx:121
ROOT::Math::IBaseFunctionMultiDimTempl
Documentation for the abstract class IBaseFunctionMultiDim.
Definition: IFunction.h:62
ROOT::Minuit2::Minuit2Minimizer::Clear
virtual void Clear()
reset for consecutive minimizations - implement if needed
Definition: Minuit2Minimizer.cxx:181
ROOT::Minuit2::Minuit2Minimizer::fMinimizer
ROOT::Minuit2::ModularFunctionMinimizer * fMinimizer
Definition: Minuit2Minimizer.h:322
ROOT::Minuit2::Minuit2Minimizer::SetMinimizerType
void SetMinimizerType(ROOT::Minuit2::EMinimizerType type)
Definition: Minuit2Minimizer.cxx:125
ROOT::Minuit2::Minuit2Minimizer::SetFunction
virtual void SetFunction(const ROOT::Math::IMultiGenFunction &func)
set the function to minimize
Definition: Minuit2Minimizer.cxx:364
ROOT::Minuit2::MnUserParameterState::SetLowerLimit
void SetLowerLimit(unsigned int, double)
Definition: MnUserParameterState.cxx:346
ROOT::Minuit2::MnUserParameterState::Value
double Value(unsigned int) const
Definition: MnUserParameterState.cxx:369
MnPrint.h
ROOT::Minuit2::FunctionMinimum::States
const std::vector< ROOT::Minuit2::MinimumState > & States() const
Definition: FunctionMinimum.h:83
ROOT::Minuit2::FunctionMinimum::HasMadePosDefCovar
bool HasMadePosDefCovar() const
Definition: FunctionMinimum.h:111
ROOT::Minuit2::Minuit2Minimizer::fMinuitFCN
ROOT::Minuit2::FCNBase * fMinuitFCN
Definition: Minuit2Minimizer.h:323
ROOT::Minuit2::MnUserParameterState::Covariance
const MnUserCovariance & Covariance() const
Definition: MnUserParameterState.h:95
ROOT::Minuit2::MnHesse
API class for calculating the numerical covariance matrix (== 2x Inverse Hessian == 2x Inverse 2nd de...
Definition: MnHesse.h:48
ROOT::Math::Minimizer::Precision
double Precision() const
precision of minimizer in the evaluation of the objective function ( a value <=0 corresponds to the l...
Definition: Minimizer.h:426
ROOT::Minuit2::kScan
@ kScan
Definition: Minuit2Minimizer.h:50
ROOT
VSD Structures.
Definition: StringConv.hxx:21
ROOT::Minuit2::MinuitParameter::Name
const char * Name() const
Definition: MinuitParameter.h:115
ROOT::Minuit2::Minuit2Minimizer::operator=
Minuit2Minimizer & operator=(const Minuit2Minimizer &rhs)
Assignment operator.
Definition: Minuit2Minimizer.cxx:173
Math
ROOT::Minuit2::MnUserParameterState::IntCovariance
const MnUserCovariance & IntCovariance() const
Definition: MnUserParameterState.h:103
ROOT::Minuit2::MinimumError::IsPosDef
bool IsPosDef() const
Definition: MinimumError.h:79
ROOT::Minuit2::MnUserParameterState::Int2ext
double Int2ext(unsigned int, double) const
Definition: MnUserParameterState.cxx:417
ROOT::Minuit2::Minuit2Minimizer::GetCovMatrix
virtual bool GetCovMatrix(double *cov) const
Fill the passed array with the covariance matrix elements if the variable is fixed or const the value...
Definition: Minuit2Minimizer.cxx:699
ROOT::Minuit2::FumiliMinimizer
Instantiates the seed generator and Minimum builder for the Fumili minimization method.
Definition: FumiliMinimizer.h:60
ROOT::Minuit2::MinuitParameter::HasLowerLimit
bool HasLowerLimit() const
Definition: MinuitParameter.h:166
ROOT::Minuit2::MnUserParameterState::Fix
void Fix(unsigned int)
Definition: MnUserParameterState.cxx:271
FCNGradAdapter.h
ROOT::Minuit2::Minuit2Minimizer::Minuit2Minimizer
Minuit2Minimizer(ROOT::Minuit2::EMinimizerType type=ROOT::Minuit2::kMigrad)
Default constructor.
Definition: Minuit2Minimizer.cxx:91
ROOT::Minuit2::Minuit2Minimizer::SetVariableLimits
virtual bool SetVariableLimits(unsigned int ivar, double lower, double upper)
set the limits of an already existing variable
Definition: Minuit2Minimizer.cxx:310
gROOT
#define gROOT
Definition: TROOT.h:406
ROOT::Minuit2::Minuit2Minimizer::SetUpperLimitedVariable
virtual bool SetUpperLimitedVariable(unsigned int ivar, const std::string &name, double val, double step, double upper)
set upper limit variable (override if minimizer supports them )
Definition: Minuit2Minimizer.cxx:229
ROOT::Minuit2::Minuit2Minimizer::SetTraceObject
void SetTraceObject(MnTraceObject &obj)
set an object to trace operation for each iteration The object must be a (or inherit from) ROOT::Minu...
Definition: Minuit2Minimizer.cxx:1193
ROOT::Minuit2::Minuit2Minimizer::Minimize
virtual bool Minimize()
method to perform the minimization.
Definition: Minuit2Minimizer.cxx:400
ROOT::Minuit2::ModularFunctionMinimizer::Minimize
virtual FunctionMinimum Minimize(const FCNBase &, const std::vector< double > &, const std::vector< double > &, unsigned int stra=1, unsigned int maxfcn=0, double toler=0.1) const
Definition: ModularFunctionMinimizer.cxx:49