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