Logo ROOT  
Reference Guide
 
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Loading...
Searching...
No Matches
RooMinimizer.cxx
Go to the documentation of this file.
1/*****************************************************************************
2 * Project: RooFit *
3 * Package: RooFitCore *
4 * @(#)root/roofitcore:$Id$
5 * Authors: *
6 * WV, Wouter Verkerke, UC Santa Barbara, verkerke@slac.stanford.edu *
7 * DK, David Kirkby, UC Irvine, dkirkby@uci.edu *
8 * AL, Alfio Lazzaro, INFN Milan, alfio.lazzaro@mi.infn.it *
9 * PB, Patrick Bos, NL eScience Center, p.bos@esciencecenter.nl *
10 * *
11 * Redistribution and use in source and binary forms, *
12 * with or without modification, are permitted according to the terms *
13 * listed in LICENSE (http://roofit.sourceforge.net/license.txt) *
14 *****************************************************************************/
15
16/**
17\file RooMinimizer.cxx
18\class RooMinimizer
19\ingroup Roofitcore
20
21Wrapper class around ROOT::Math::Minimizer that
22provides a seamless interface between the minimizer functionality
23and the native RooFit interface.
24By default the Minimizer is Minuit 2.
25RooMinimizer can minimize any RooAbsReal function with respect to
26its parameters. Usual choices for minimization are the object returned by
27RooAbsPdf::createNLL() or RooAbsReal::createChi2().
28RooMinimizer has methods corresponding to MINUIT functions like
29hesse(), migrad(), minos() etc. In each of these function calls
30the state of the MINUIT engine is synchronized with the state
31of the RooFit variables: any change in variables, change
32in the constant status etc is forwarded to MINUIT prior to
33execution of the MINUIT call. Afterwards the RooFit objects
34are resynchronized with the output state of MINUIT: changes
35parameter values, errors are propagated.
36Various methods are available to control verbosity, profiling,
37automatic PDF optimization.
38**/
39
40#include "RooMinimizer.h"
41
42#include "RooAbsMinimizerFcn.h"
43#include "RooArgSet.h"
44#include "RooArgList.h"
45#include "RooAbsReal.h"
46#include "RooDataSet.h"
47#include "RooRealVar.h"
48#include "RooSentinel.h"
49#include "RooMsgService.h"
50#include "RooPlot.h"
51#include "RooMinimizerFcn.h"
52#include "RooFitResult.h"
56#ifdef ROOFIT_MULTIPROCESS
59#endif
60
61#include <Fit/BasicFCN.h>
62#include <Math/Minimizer.h>
63#include <TClass.h>
64#include <TGraph.h>
65#include <TMarker.h>
66
67#include <fstream>
68#include <iostream>
69#include <stdexcept> // logic_error
70
71
72////////////////////////////////////////////////////////////////////////////////
73/// Construct MINUIT interface to given function. Function can be anything,
74/// but is typically a -log(likelihood) implemented by RooNLLVar or a chi^2
75/// (implemented by RooChi2Var). Other frequent use cases are a RooAddition
76/// of a RooNLLVar plus a penalty or constraint term. This class propagates
77/// all RooFit information (floating parameters, their values and errors)
78/// to MINUIT before each MINUIT call and propagates all MINUIT information
79/// back to the RooFit object at the end of each call (updated parameter
80/// values, their (asymmetric errors) etc. The default MINUIT error level
81/// for HESSE and MINOS error analysis is taken from the defaultErrorLevel()
82/// value of the input function.
83
84/// Constructor that accepts all configuration in struct with RooAbsReal likelihood
85RooMinimizer::RooMinimizer(RooAbsReal &function, Config const &cfg) : _cfg(cfg)
86{
88 auto nll_real = dynamic_cast<RooFit::TestStatistics::RooRealL *>(&function);
89 if (nll_real != nullptr) {
90 if (_cfg.parallelize != 0) { // new test statistic with multiprocessing library with
91 // parallel likelihood or parallel gradient
92#ifdef ROOFIT_MULTIPROCESS
94 // Note that this is necessary because there is currently no serial-mode LikelihoodGradientWrapper.
95 // We intend to repurpose RooGradMinimizerFcn to build such a LikelihoodGradientSerial class.
96 coutI(InputArguments) << "Modular likelihood detected and likelihood parallelization requested, "
97 << "also setting parallel gradient calculation mode." << std::endl;
99 }
100 // If _cfg.parallelize is larger than zero set the number of workers to that value. Otherwise do not do
101 // anything and let RooFit::MultiProcess handle the number of workers
102 if (_cfg.parallelize > 0)
105
106 _fcn = std::make_unique<RooFit::TestStatistics::MinuitFcnGrad>(
107 nll_real->getRooAbsL(), this, _config.ParamsSettings(),
109 static_cast<RooFit::TestStatistics::LikelihoodMode>(int(_cfg.enableParallelDescent))},
111#else
112 throw std::logic_error(
113 "Parallel minimization requested, but ROOT was not compiled with multiprocessing enabled, "
114 "please recompile with -Droofit_multiprocess=ON for parallel evaluation");
115#endif
116 } else { // modular test statistic non parallel
117 coutW(InputArguments)
118 << "Requested modular likelihood without gradient parallelization, some features such as offsetting "
119 << "may not work yet. Non-modular likelihoods are more reliable without parallelization." << std::endl;
120 // The RooRealL that is used in the case where the modular likelihood is being passed to a RooMinimizerFcn does
121 // not have offsetting implemented. Therefore, offsetting will not work in this case. Other features might also
122 // not work since the RooRealL was not intended for minimization. Further development is required to make the
123 // MinuitFcnGrad also handle serial gradient minimization. The MinuitFcnGrad accepts a RooAbsL and has
124 // offsetting implemented, thus omitting the need for RooRealL minimization altogether.
125 _fcn = std::make_unique<RooMinimizerFcn>(&function, this);
126 }
127 } else {
128 if (_cfg.parallelize != 0) { // Old test statistic with parallel likelihood or gradient
129 throw std::logic_error("In RooMinimizer constructor: Selected likelihood evaluation but a "
130 "non-modular likelihood was given. Please supply ModularL(true) as an "
131 "argument to createNLL for modular likelihoods to use likelihood "
132 "or gradient parallelization.");
133 }
134 _fcn = std::make_unique<RooMinimizerFcn>(&function, this);
135 }
136 initMinimizerFcnDependentPart(function.defaultErrorLevel());
137};
138
139/// Initialize the part of the minimizer that is independent of the function to be minimized
141{
142 RooSentinel::activate();
144
146 setEps(1.0); // default tolerance
147}
148
149/// Initialize the part of the minimizer that is dependent on the function to be minimized
151{
152 // default max number of calls
153 _config.MinimizerOptions().SetMaxIterations(500 * _fcn->getNDim());
155
156 // Shut up for now
157 setPrintLevel(-1);
158
159 // Use +0.5 for 1-sigma errors
160 setErrorLevel(defaultErrorLevel);
161
162 // Declare our parameters to MINUIT
163 _fcn->Synchronize(_config.ParamsSettings());
164
165 // Now set default verbosity
166 setPrintLevel(RooMsgService::instance().silentMode() ? -1 : 1);
167
168 // Set user defined and default _fcn config
170
171 // Likelihood holds information on offsetting in old style, so do not set here unless explicitly set by user
172 if (_cfg.offsetting != -1) {
174 }
175}
176
177////////////////////////////////////////////////////////////////////////////////
178/// Destructor
179
181
182////////////////////////////////////////////////////////////////////////////////
183/// Change MINUIT strategy to istrat. Accepted codes
184/// are 0,1,2 and represent MINUIT strategies for dealing
185/// most efficiently with fast FCNs (0), expensive FCNs (2)
186/// and 'intermediate' FCNs (1)
187
192
193////////////////////////////////////////////////////////////////////////////////
194/// Change maximum number of MINUIT iterations
195/// (RooMinimizer default 500 * #%parameters)
196
201
202////////////////////////////////////////////////////////////////////////////////
203/// Change maximum number of likelihood function class from MINUIT
204/// (RooMinimizer default 500 * #%parameters)
205
210
211////////////////////////////////////////////////////////////////////////////////
212/// Set the level for MINUIT error analysis to the given
213/// value. This function overrides the default value
214/// that is taken in the RooMinimizer constructor from
215/// the defaultErrorLevel() method of the input function
216
218{
220}
221
222////////////////////////////////////////////////////////////////////////////////
223/// Change MINUIT epsilon
224
225void RooMinimizer::setEps(double eps)
226{
228}
229
230////////////////////////////////////////////////////////////////////////////////
231/// Enable internal likelihood offsetting for enhanced numeric precision
232
234{
236 _fcn->setOffsetting(_cfg.offsetting);
237}
238
239////////////////////////////////////////////////////////////////////////////////
240/// Choose the minimizer algorithm.
241///
242/// Passing an empty string selects the default minimizer type returned by
243/// ROOT::Math::MinimizerOptions::DefaultMinimizerType().
244
245void RooMinimizer::setMinimizerType(std::string const &type)
246{
248
249 if ((_cfg.parallelize != 0) && _cfg.minimizerType != "Minuit2") {
250 std::stringstream ss;
251 ss << "In RooMinimizer::setMinimizerType: only Minuit2 is supported when not using classic function mode!";
252 if (type.empty()) {
253 ss << "\nPlease set it as your default minimizer via "
254 "ROOT::Math::MinimizerOptions::SetDefaultMinimizer(\"Minuit2\").";
255 }
256 throw std::invalid_argument(ss.str());
257 }
258}
259
261{
262 // Minuit-given status:
263 _status = fitterReturnValue ? _result->fStatus : -1;
264
265 // RooFit-based additional failed state information:
266 if (evalCounter() <= _fcn->GetNumInvalidNLL()) {
267 coutE(Minimization) << "RooMinimizer: all function calls during minimization gave invalid NLL values!"
268 << std::endl;
269 }
270}
271
272////////////////////////////////////////////////////////////////////////////////
273/// Minimise the function passed in the constructor.
274/// \param[in] type Type of fitter to use, e.g. "Minuit" "Minuit2". Passing an
275/// empty string will select the default minimizer type of the
276/// RooMinimizer, as returned by
277/// ROOT::Math::MinimizerOptions::DefaultMinimizerType().
278/// \attention This overrides the default fitter of this RooMinimizer.
279/// \param[in] alg Fit algorithm to use. (Optional)
280int RooMinimizer::minimize(const char *type, const char *alg)
281{
282 if (_cfg.timingAnalysis) {
283#ifdef ROOFIT_MULTIPROCESS
285#else
286 throw std::logic_error("ProcessTimer, but ROOT was not compiled with multiprocessing enabled, "
287 "please recompile with -Droofit_multiprocess=ON for logging with the "
288 "ProcessTimer.");
289#endif
290 }
291 _fcn->Synchronize(_config.ParamsSettings());
292
295
296 profileStart();
297 {
298 auto ctx = makeEvalErrorContext();
299
300 bool ret = fitFCN(*_fcn->getMultiGenFcn());
302 }
303 profileStop();
304 _fcn->BackProp();
305
306 saveStatus("MINIMIZE", _status);
307
308 return _status;
309}
310
311////////////////////////////////////////////////////////////////////////////////
312/// Execute MIGRAD. Changes in parameter values
313/// and calculated errors are automatically
314/// propagated back the RooRealVars representing
315/// the floating parameters in the MINUIT operation.
316
318{
319 return exec("migrad", "MIGRAD");
320}
321
322int RooMinimizer::exec(std::string const &algoName, std::string const &statusName)
323{
324 _fcn->Synchronize(_config.ParamsSettings());
325 profileStart();
326 {
327 auto ctx = makeEvalErrorContext();
328
329 bool ret = false;
330 if (algoName == "hesse") {
331 // HESSE has a special entry point in the ROOT::Math::Fitter
334 } else if (algoName == "minos") {
335 // MINOS has a special entry point in the ROOT::Math::Fitter
338 } else {
340 ret = fitFCN(*_fcn->getMultiGenFcn());
341 }
343 }
344 profileStop();
345 _fcn->BackProp();
346
347 saveStatus(statusName.c_str(), _status);
348
349 return _status;
350}
351
352////////////////////////////////////////////////////////////////////////////////
353/// Execute HESSE. Changes in parameter values
354/// and calculated errors are automatically
355/// propagated back the RooRealVars representing
356/// the floating parameters in the MINUIT operation.
357
359{
360 if (_minimizer == nullptr) {
361 coutW(Minimization) << "RooMinimizer::hesse: Error, run Migrad before Hesse!" << std::endl;
362 _status = -1;
363 return _status;
364 }
365
366 return exec("hesse", "HESSE");
367}
368
369////////////////////////////////////////////////////////////////////////////////
370/// Execute MINOS. Changes in parameter values
371/// and calculated errors are automatically
372/// propagated back the RooRealVars representing
373/// the floating parameters in the MINUIT operation.
374
376{
377 if (_minimizer == nullptr) {
378 coutW(Minimization) << "RooMinimizer::minos: Error, run Migrad before Minos!" << std::endl;
379 _status = -1;
380 return _status;
381 }
382
383 return exec("minos", "MINOS");
384}
385
386////////////////////////////////////////////////////////////////////////////////
387/// Execute MINOS for given list of parameters. Changes in parameter values
388/// and calculated errors are automatically
389/// propagated back the RooRealVars representing
390/// the floating parameters in the MINUIT operation.
391
393{
394 if (_minimizer == nullptr) {
395 coutW(Minimization) << "RooMinimizer::minos: Error, run Migrad before Minos!" << std::endl;
396 _status = -1;
397 } else if (!minosParamList.empty()) {
398
399 _fcn->Synchronize(_config.ParamsSettings());
400 profileStart();
401 {
402 auto ctx = makeEvalErrorContext();
403
404 // get list of parameters for Minos
405 std::vector<unsigned int> paramInd;
406 RooArgList floatParams = _fcn->floatParams();
407 for (RooAbsArg *arg : minosParamList) {
408 RooAbsArg *par = floatParams.find(arg->GetName());
409 if (par && !par->isConstant()) {
410 int index = floatParams.index(par);
411 paramInd.push_back(index);
412 }
413 }
414
415 if (!paramInd.empty()) {
416 // set the parameter indices
418
420 bool ret = calculateMinosErrors();
422 // to avoid that following minimization computes automatically the Minos errors
423 _config.SetMinosErrors(false);
424 }
425 }
426 profileStop();
427 _fcn->BackProp();
428
429 saveStatus("MINOS", _status);
430 }
431
432 return _status;
433}
434
435////////////////////////////////////////////////////////////////////////////////
436/// Execute SEEK. Changes in parameter values
437/// and calculated errors are automatically
438/// propagated back the RooRealVars representing
439/// the floating parameters in the MINUIT operation.
440
442{
443 return exec("seek", "SEEK");
444}
445
446////////////////////////////////////////////////////////////////////////////////
447/// Execute SIMPLEX. Changes in parameter values
448/// and calculated errors are automatically
449/// propagated back the RooRealVars representing
450/// the floating parameters in the MINUIT operation.
451
453{
454 return exec("simplex", "SIMPLEX");
455}
456
457////////////////////////////////////////////////////////////////////////////////
458/// Execute IMPROVE. Changes in parameter values
459/// and calculated errors are automatically
460/// propagated back the RooRealVars representing
461/// the floating parameters in the MINUIT operation.
462
464{
465 return exec("migradimproved", "IMPROVE");
466}
467
468////////////////////////////////////////////////////////////////////////////////
469/// Change the MINUIT internal printing level
470
475
476////////////////////////////////////////////////////////////////////////////////
477/// Get the MINUIT internal printing level
478
483
484////////////////////////////////////////////////////////////////////////////////
485/// If flag is true, perform constant term optimization on
486/// function being minimized.
487
489{
490 _fcn->setOptimizeConst(flag);
491}
492
493////////////////////////////////////////////////////////////////////////////////
494/// Save and return a RooFitResult snapshot of current minimizer status.
495/// This snapshot contains the values of all constant parameters,
496/// the value of all floating parameters at RooMinimizer construction and
497/// after the last MINUIT operation, the MINUIT status, variance quality,
498/// EDM setting, number of calls with evaluation problems, the minimized
499/// function value and the full correlation matrix.
500
502{
503 if (_minimizer == nullptr) {
504 coutW(Minimization) << "RooMinimizer::save: Error, run minimization before!" << std::endl;
505 return nullptr;
506 }
507
508 TString name = userName ? userName : Form("%s", _fcn->getFunctionName().c_str());
509 TString title = userTitle ? userTitle : Form("%s", _fcn->getFunctionTitle().c_str());
510 auto fitRes = std::make_unique<RooFitResult>(name, title);
511
512 fitRes->setConstParList(_fcn->constParams());
513
514 fitRes->setNumInvalidNLL(_fcn->GetNumInvalidNLL());
515
516 fitRes->setStatus(_status);
517 fitRes->setCovQual(_minimizer->CovMatrixStatus());
518 fitRes->setMinNLL(_result->fVal -_fcn->getOffset());
519 fitRes->setEDM(_result->fEdm);
520
521 fitRes->setInitParList(_fcn->initFloatParams());
522 fitRes->setFinalParList(_fcn->floatParams());
523
524 if (!_extV) {
526 } else {
527 fitRes->setCovarianceMatrix(*_extV);
528 }
529
530 fitRes->setStatusHistory(_statusHistory);
531
532 return RooFit::makeOwningPtr(std::move(fitRes));
533}
534
535namespace {
536
537/// retrieve covariance matrix element
538double covMatrix(std::vector<double> const &covMat, unsigned int i, unsigned int j)
539{
540 if (covMat.empty())
541 return 0; // no matrix is available in case of non-valid fits
542 return j < i ? covMat[j + i * (i + 1) / 2] : covMat[i + j * (j + 1) / 2];
543}
544
545/// retrieve correlation elements
546double correlation(std::vector<double> const &covMat, unsigned int i, unsigned int j)
547{
548 if (covMat.empty())
549 return 0; // no matrix is available in case of non-valid fits
552}
553
554} // namespace
555
557{
558 const std::size_t nParams = _fcn->getNDim();
559 std::vector<double> globalCC;
562 for (std::size_t ic = 0; ic < nParams; ic++) {
563 globalCC.push_back(_result->fGlobalCC[ic]);
564 for (std::size_t ii = 0; ii < nParams; ii++) {
565 corrs(ic, ii) = correlation(_result->fCovMatrix, ic, ii);
566 covs(ic, ii) = covMatrix(_result->fCovMatrix, ic, ii);
567 }
568 }
569 fitRes.fillCorrMatrix(globalCC, corrs, covs);
570}
571
572////////////////////////////////////////////////////////////////////////////////
573/// Create and draw a TH2 with the error contours in the parameters `var1` and `var2`.
574/// \param[in] var1 The first parameter (x axis).
575/// \param[in] var2 The second parameter (y axis).
576/// \param[in] n1 First contour.
577/// \param[in] n2 Optional contour. 0 means don't draw.
578/// \param[in] n3 Optional contour. 0 means don't draw.
579/// \param[in] n4 Optional contour. 0 means don't draw.
580/// \param[in] n5 Optional contour. 0 means don't draw.
581/// \param[in] n6 Optional contour. 0 means don't draw.
582/// \param[in] npoints Number of points for evaluating the contour.
583///
584/// Up to six contours can be drawn using the arguments `n1` to `n6` to request the desired
585/// coverage in units of \f$ \sigma = n^2 \cdot \mathrm{ErrorDef} \f$.
586/// See ROOT::Math::Minimizer::ErrorDef().
587
588RooPlot *RooMinimizer::contour(RooRealVar &var1, RooRealVar &var2, double n1, double n2, double n3, double n4,
589 double n5, double n6, unsigned int npoints)
590{
591 RooArgList params = _fcn->floatParams();
593 params.snapshot(paramSave);
594
595 // Verify that both variables are floating parameters of PDF
596 int index1 = params.index(&var1);
597 if (index1 < 0) {
598 coutE(Minimization) << "RooMinimizer::contour(" << GetName() << ") ERROR: " << var1.GetName()
599 << " is not a floating parameter of " << _fcn->getFunctionName() << std::endl;
600 return nullptr;
601 }
602
603 int index2 = params.index(&var2);
604 if (index2 < 0) {
605 coutE(Minimization) << "RooMinimizer::contour(" << GetName() << ") ERROR: " << var2.GetName()
606 << " is not a floating parameter of PDF " << _fcn->getFunctionName() << std::endl;
607 return nullptr;
608 }
609
610 // create and draw a frame
611 RooPlot *frame = new RooPlot(var1, var2);
612
613 // draw a point at the current parameter values
614 TMarker *point = new TMarker(var1.getVal(), var2.getVal(), 8);
615 frame->addObject(point);
616
617 // check first if a inimizer is available. If not means
618 // the minimization is not done , so do it
619 if (_minimizer == nullptr) {
620 coutW(Minimization) << "RooMinimizer::contour: Error, run Migrad before contours!" << std::endl;
621 return frame;
622 }
623
624 // remember our original value of ERRDEF
625 double errdef = _minimizer->ErrorDef();
626
627 double n[6];
628 n[0] = n1;
629 n[1] = n2;
630 n[2] = n3;
631 n[3] = n4;
632 n[4] = n5;
633 n[5] = n6;
634
635 for (int ic = 0; ic < 6; ic++) {
636 if (n[ic] > 0) {
637
638 // set the value corresponding to an n1-sigma contour
639 _minimizer->SetErrorDef(n[ic] * n[ic] * errdef);
640
641 // calculate and draw the contour
642 std::vector<double> xcoor(npoints + 1);
643 std::vector<double> ycoor(npoints + 1);
644 bool ret = _minimizer->Contour(index1, index2, npoints, xcoor.data(), ycoor.data());
645
646 if (!ret) {
647 coutE(Minimization) << "RooMinimizer::contour(" << GetName()
648 << ") ERROR: MINUIT did not return a contour graph for n=" << n[ic] << std::endl;
649 } else {
650 xcoor[npoints] = xcoor[0];
651 ycoor[npoints] = ycoor[0];
652 TGraph *graph = new TGraph(npoints + 1, xcoor.data(), ycoor.data());
653
654 graph->SetName(Form("contour_%s_n%f", _fcn->getFunctionName().c_str(), n[ic]));
655 graph->SetLineStyle(ic + 1);
656 graph->SetLineWidth(2);
657 graph->SetLineColor(kBlue);
658 frame->addObject(graph, "L");
659 }
660 }
661 }
662
663 // restore the original ERRDEF
664 _minimizer->SetErrorDef(errdef);
665
666 // restore parameter values
667 params.assign(paramSave);
668
669 return frame;
670}
671
672////////////////////////////////////////////////////////////////////////////////
673/// Add parameters in metadata field to process timer
674
676{
677#ifdef ROOFIT_MULTIPROCESS
678 // parameter indices for use in timing heat matrix
679 std::vector<std::string> parameter_names;
680 for (RooAbsArg *parameter : _fcn->floatParams()) {
681 parameter_names.push_back(parameter->GetName());
682 if (_cfg.verbose) {
683 coutI(Minimization) << "parameter name: " << parameter_names.back() << std::endl;
684 }
685 }
687#else
688 coutI(Minimization) << "Not adding parameters to processtimer because multiprocessing is not enabled." << std::endl;
689#endif
690}
691
692////////////////////////////////////////////////////////////////////////////////
693/// Start profiling timer
694
696{
697 if (_cfg.profile) {
698 _timer.Start();
699 _cumulTimer.Start(_profileStart ? false : true);
700 _profileStart = true;
701 }
702}
703
704////////////////////////////////////////////////////////////////////////////////
705/// Stop profiling timer and report results of last session
706
708{
709 if (_cfg.profile) {
710 _timer.Stop();
712 coutI(Minimization) << "Command timer: ";
713 _timer.Print();
714 coutI(Minimization) << "Session timer: ";
716 }
717}
718
720{
721 return _fcn->getMultiGenFcn();
722}
723
724////////////////////////////////////////////////////////////////////////////////
725/// Apply results of given external covariance matrix. i.e. propagate its errors
726/// to all RRV parameter representations and give this matrix instead of the
727/// HESSE matrix at the next save() call
728
730{
731 _extV.reset(static_cast<TMatrixDSym *>(V.Clone()));
732 _fcn->ApplyCovarianceMatrix(*_extV);
733}
734
736{
737 // Import the results of the last fit performed, interpreting
738 // the fit parameters as the given varList of parameters.
739
740 if (_minimizer == nullptr) {
741 oocoutE(nullptr, InputArguments) << "RooMinimizer::save: Error, run minimization before!" << std::endl;
742 return nullptr;
743 }
744
745 auto res = std::make_unique<RooFitResult>("lastMinuitFit", "Last MINUIT fit");
746
747 // Extract names of fit parameters
748 // and construct corresponding RooRealVars
749 RooArgList constPars("constPars");
750 RooArgList floatPars("floatPars");
751
752 const RooArgList floatParsFromFcn = _fcn->floatParams();
753
754 for (unsigned int i = 0; i < _fcn->getNDim(); ++i) {
755
756 TString varName(floatParsFromFcn.at(i)->GetName());
757 bool isConst(_result->isParameterFixed(i));
758
759 double xlo = _config.ParSettings(i).LowerLimit();
760 double xhi = _config.ParSettings(i).UpperLimit();
761 double xerr = _result->error(i);
762 double xval = _result->fParams[i];
763
764 std::unique_ptr<RooRealVar> var;
765
766 if ((xlo < xhi) && !isConst) {
767 var = std::make_unique<RooRealVar>(varName, varName, xval, xlo, xhi);
768 } else {
769 var = std::make_unique<RooRealVar>(varName, varName, xval);
770 }
771 var->setConstant(isConst);
772
773 if (isConst) {
774 constPars.addOwned(std::move(var));
775 } else {
776 var->setError(xerr);
777 floatPars.addOwned(std::move(var));
778 }
779 }
780
781 res->setConstParList(constPars);
782 res->setInitParList(floatPars);
783 res->setFinalParList(floatPars);
784 res->setMinNLL(_result->fVal);
785 res->setEDM(_result->fEdm);
786 res->setCovQual(_minimizer->CovMatrixStatus());
787 res->setStatus(_result->fStatus);
788 fillCorrMatrix(*res);
789
790 return RooFit::makeOwningPtr(std::move(res));
791}
792
793/// Try to recover from invalid function values. When invalid function values
794/// are encountered, a penalty term is returned to the minimiser to make it
795/// back off. This sets the strength of this penalty. \note A strength of zero
796/// is equivalent to a constant penalty (= the gradient vanishes, ROOT < 6.24).
797/// Positive values lead to a gradient pointing away from the undefined
798/// regions. Use ~10 to force the minimiser away from invalid function values.
803
804bool RooMinimizer::setLogFile(const char *logf)
805{
806 _cfg.logf = logf;
807 return _cfg.logf ? _fcn->SetLogFile(_cfg.logf) : false;
808}
809
811{
812 return _fcn->evalCounter();
813}
815{
816 _fcn->zeroEvalCount();
817}
818
820{
821 return _fcn->getNDim();
822}
823
824std::ofstream *RooMinimizer::logfile()
825{
826 return _fcn->GetLogFile();
827}
829{
830 return _fcn->GetMaxFCN();
831}
833{
834 return _fcn->getOffset();
835}
836
837std::unique_ptr<RooAbsReal::EvalErrorContext> RooMinimizer::makeEvalErrorContext() const
838{
840 // If evaluation error printing is disabled, we don't need to collect the
841 // errors and only need to count them. This significantly reduces the
842 // performance overhead when having evaluation errors.
844 return std::make_unique<RooAbsReal::EvalErrorContext>(m);
845}
846
848{
849 // fit a user provided FCN function
850 // create fit parameter settings
851 unsigned int npar = fcn.NDim();
852 if (npar == 0) {
853 coutE(Minimization) << "RooMinimizer::fitFCN(): FCN function has zero parameters" << std::endl;
854 return false;
855 }
856
857 // init the minimizer
859 // perform the minimization
860
861 // perform the minimization (assume we have already initialized the minimizer)
862
863 bool isValid = _minimizer->Minimize();
864
865 if (!_result)
866 _result = std::make_unique<FitResult>();
867
868 fillResult(isValid);
869
870 // set also new parameter values and errors in FitConfig
871 if (isValid)
873
874 return isValid;
875}
876
878{
879 // compute the Hesse errors according to configuration
880 // set in the parameters and append value in fit result
881
882 // update minimizer (recreate if not done or if name has changed
883 if (!updateMinimizerOptions()) {
884 coutE(Minimization) << "RooMinimizer::calculateHessErrors() Error re-initializing the minimizer" << std::endl;
885 return false;
886 }
887
888 // run Hesse
889 bool ret = _minimizer->Hesse();
890 if (!ret)
891 coutE(Minimization) << "RooMinimizer::calculateHessErrors() Error when calculating Hessian" << std::endl;
892
893 // update minimizer results with what comes out from Hesse
894 // in case is empty - create from a FitConfig
895 if (_result->fParams.empty())
896 _result = std::make_unique<FitResult>(_config);
897
898 // re-give a minimizer instance in case it has been changed
899 ret |= update(ret);
900
901 // set also new errors in FitConfig
902 if (ret)
904
905 return ret;
906}
907
909{
910 // compute the Minos errors according to configuration
911 // set in the parameters and append value in fit result
912 // normally Minos errors are computed just after the minimization
913 // (in DoMinimization) aftewr minimizing if the
914 // FitConfig::MinosErrors() flag is set
915
916 // update minimizer (but cannot re-create in this case). Must use an existing one
917 if (!updateMinimizerOptions(false)) {
918 coutE(Minimization) << "RooMinimizer::calculateHessErrors() Error re-initializing the minimizer" << std::endl;
919 return false;
920 }
921
922 const std::vector<unsigned int> &ipars = _config.MinosParams();
923 unsigned int n = (!ipars.empty()) ? ipars.size() : _fcn->getNDim();
924 bool ok = false;
925
926 int iparNewMin = 0;
927 int iparMax = n;
928 int iter = 0;
929 // rerun minos for the parameters run before a new Minimum has been found
930 do {
931 if (iparNewMin > 0)
932 coutI(Minimization) << "RooMinimizer::calculateMinosErrors() Run again Minos for some parameters because a "
933 "new Minimum has been found"
934 << std::endl;
935 iparNewMin = 0;
936 for (int i = 0; i < iparMax; ++i) {
937 double elow, eup;
938 unsigned int index = (!ipars.empty()) ? ipars[i] : i;
939 bool ret = _minimizer->GetMinosError(index, elow, eup);
940 // flags case when a new minimum has been found
941 if ((_minimizer->MinosStatus() & 8) != 0) {
942 iparNewMin = i;
943 }
944 if (ret)
945 _result->fMinosErrors.emplace(index, std::make_pair(elow, eup));
946 ok |= ret;
947 }
948
950 iter++; // to avoid infinite looping
951 } while (iparNewMin > 0 && iter < 10);
952 if (!ok) {
953 coutE(Minimization)
954 << "RooMinimizer::calculateMinosErrors() Minos error calculation failed for all the selected parameters"
955 << std::endl;
956 }
957
958 // re-give a minimizer instance in case it has been changed
959 // but maintain previous valid status. Do not set result to false if minos failed
960 ok &= update(_result->fValid);
961
962 return ok;
963}
964
966{
967 _minimizer = std::unique_ptr<ROOT::Math::Minimizer>(_config.CreateMinimizer());
968 _minimizer->SetFunction(*getMultiGenFcn());
970
972 std::vector<double> v;
973 for (std::size_t i = 0; i < _fcn->getNDim(); ++i) {
974 RooRealVar &param = _fcn->floatableParam(i);
975 v.push_back(param.getError() * param.getError());
976 }
977 _minimizer->SetCovarianceDiag(v, v.size());
978 }
979}
980
982{
983 // update minimizer options when re-doing a Fit or computing Hesse or Minos errors
984
985 // create a new minimizer if it is different type
986 // minimizer type string stored in FitResult is "minimizer name" + " / " + minimizer algo
987 std::string newMinimType = _config.MinimizerName();
988 if (_minimizer && _result && newMinimType != _result->fMinimType) {
989 // if a different minimizer is allowed (e.g. when calling Hesse)
990 if (canDifferentMinim) {
991 std::string msg = "Using now " + newMinimType;
992 coutI(Minimization) << "RooMinimizer::updateMinimizerOptions(): " << msg << std::endl;
994 } else {
995 std::string msg = "Cannot change minimizer. Continue using " + _result->fMinimType;
996 coutW(Minimization) << "RooMinimizer::updateMinimizerOptions() " << msg << std::endl;
997 }
998 }
999
1000 // create minimizer if it was not done before
1001 if (!_minimizer) {
1002 initMinimizer();
1003 }
1004
1005 // set new minimizer options (but not functions and parameters)
1006 _minimizer->SetOptions(_config.MinimizerOptions());
1007 return true;
1008}
1009
1011{
1012 // update the fit configuration after a fit using the obtained result
1013 if (_result->fParams.empty() || !_result->fValid)
1014 return;
1015 for (unsigned int i = 0; i < _config.NPar(); ++i) {
1017 par.SetValue(_result->fParams[i]);
1018 if (_result->error(i) > 0)
1019 par.SetStepSize(_result->error(i));
1020 }
1021}
1022
1024 : fStatus(-99), // use this special convention to flag it when printing result
1025 fCovStatus(0),
1026 fParams(fconfig.NPar()),
1027 fErrors(fconfig.NPar())
1028{
1029 // create a Fit result from a fit config (i.e. with initial parameter values
1030 // and errors equal to step values
1031 // The model function is NULL in this case
1032
1033 // set minimizer type and algorithm
1034 fMinimType = fconfig.MinimizerType();
1035 // append algorithm name for minimizer that support it
1036 if ((fMinimType.find("Fumili") == std::string::npos) && (fMinimType.find("GSLMultiFit") == std::string::npos)) {
1037 if (!fconfig.MinimizerAlgoType().empty())
1038 fMinimType += " / " + fconfig.MinimizerAlgoType();
1039 }
1040
1041 // get parameter values and errors (step sizes)
1042 for (unsigned int i = 0; i < fconfig.NPar(); ++i) {
1043 const ROOT::Fit::ParameterSettings &par = fconfig.ParSettings(i);
1044 fParams[i] = par.Value();
1045 fErrors[i] = par.StepSize();
1046 if (par.IsFixed())
1047 fFixedParams[i] = true;
1048 }
1049}
1050
1052{
1055
1056 // Fill the FitResult after minimization using result from Minimizers
1057
1058 _result->fValid = isValid;
1059 _result->fStatus = min.Status();
1060 _result->fCovStatus = min.CovMatrixStatus();
1061 _result->fVal = min.MinValue();
1062 _result->fEdm = min.Edm();
1063
1064 _result->fMinimType = fconfig.MinimizerName();
1065
1066 const unsigned int npar = min.NDim();
1067 if (npar == 0)
1068 return;
1069
1070 if (min.X())
1071 _result->fParams = std::vector<double>(min.X(), min.X() + npar);
1072 else {
1073 // case minimizer does not provide minimum values (it failed) take from configuration
1074 _result->fParams.resize(npar);
1075 for (unsigned int i = 0; i < npar; ++i) {
1076 _result->fParams[i] = (fconfig.ParSettings(i).Value());
1077 }
1078 }
1079
1080 // check for fixed or limited parameters
1081 for (unsigned int ipar = 0; ipar < npar; ++ipar) {
1082 if (fconfig.ParSettings(ipar).IsFixed())
1083 _result->fFixedParams[ipar] = true;
1084 }
1085
1086 // fill error matrix
1087 // if minimizer provides error provides also error matrix
1088 // clear in case of re-filling an existing result
1089 _result->fCovMatrix.clear();
1090 _result->fGlobalCC.clear();
1091
1092 if (min.Errors() != nullptr) {
1093 updateErrors();
1094 }
1095}
1096
1097bool RooMinimizer::update(bool isValid)
1098{
1101
1102 // update fit result with new status from minimizer
1103 // ncalls if it is not zero is used instead of value from minimizer
1104
1105 // in case minimizer changes
1106 _result->fMinimType = fconfig.MinimizerName();
1107
1108 const std::size_t npar = _result->fParams.size();
1109
1110 _result->fValid = isValid;
1111 // update minimum value
1112 _result->fVal = min.MinValue();
1113 _result->fEdm = min.Edm();
1114 _result->fStatus = min.Status();
1115 _result->fCovStatus = min.CovMatrixStatus();
1116
1117 // copy parameter value and errors
1118 std::copy(min.X(), min.X() + npar, _result->fParams.begin());
1119
1120 if (min.Errors() != nullptr) {
1121 updateErrors();
1122 }
1123 return true;
1124}
1125
1127{
1129 const std::size_t npar = _result->fParams.size();
1130
1131 _result->fErrors.resize(npar);
1132 std::copy(min.Errors(), min.Errors() + npar, _result->fErrors.begin());
1133
1134 if (_result->fCovStatus != 0) {
1135
1136 // update error matrix
1137 unsigned int r = npar * (npar + 1) / 2;
1138 _result->fCovMatrix.resize(r);
1139 unsigned int l = 0;
1140 for (unsigned int i = 0; i < npar; ++i) {
1141 for (unsigned int j = 0; j <= i; ++j)
1142 _result->fCovMatrix[l++] = min.CovMatrix(i, j);
1143 }
1144 }
1145 // minos errors are set separately when calling Fitter::CalculateMinosErrors()
1146
1147 // update global CC
1148 _result->fGlobalCC.resize(npar);
1149 for (unsigned int i = 0; i < npar; ++i) {
1150 double globcc = min.GlobalCC(i);
1151 if (globcc < 0) {
1152 _result->fGlobalCC.clear();
1153 break; // it is not supported by that minimizer
1154 }
1155 _result->fGlobalCC[i] = globcc;
1156 }
1157}
1158
1159double RooMinimizer::FitResult::lowerError(unsigned int i) const
1160{
1161 // return lower Minos error for parameter i
1162 // return the parabolic error if Minos error has not been calculated for the parameter i
1163 auto itr = fMinosErrors.find(i);
1164 return (itr != fMinosErrors.end()) ? itr->second.first : error(i);
1165}
1166
1167double RooMinimizer::FitResult::upperError(unsigned int i) const
1168{
1169 // return upper Minos error for parameter i
1170 // return the parabolic error if Minos error has not been calculated for the parameter i
1171 auto itr = fMinosErrors.find(i);
1172 return (itr != fMinosErrors.end()) ? itr->second.second : error(i);
1173}
1174
1176{
1177 return fFixedParams.find(ipar) != fFixedParams.end();
1178}
1179
1181{
1182 const size_t nParams = fParams.size();
1183 covs.ResizeTo(nParams, nParams);
1184 for (std::size_t ic = 0; ic < nParams; ic++) {
1185 for (std::size_t ii = 0; ii < nParams; ii++) {
1186 covs(ic, ii) = covMatrix(fCovMatrix, ic, ii);
1187 }
1188 }
1189}
#define coutI(a)
#define coutW(a)
#define oocoutE(o, a)
#define coutE(a)
@ kBlue
Definition Rtypes.h:66
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t r
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t index
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
char name[80]
Definition TGX11.cxx:110
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
Definition TString.cxx:2489
Class describing the configuration of the fit, options and parameter settings using the ROOT::Fit::Pa...
Definition FitConfig.h:47
const std::vector< unsigned int > & MinosParams() const
return vector of parameter indices for which the Minos Error will be computed
Definition FitConfig.h:218
void SetMinimizer(const char *type, const char *algo=nullptr)
set minimizer type
Definition FitConfig.h:179
void SetMinosErrors(bool on=true)
set Minos errors computation to be performed after fitting
Definition FitConfig.h:229
unsigned int NPar() const
number of parameters settings
Definition FitConfig.h:96
std::string MinimizerName() const
return Minimizer full name (type / algorithm)
const std::vector< ROOT::Fit::ParameterSettings > & ParamsSettings() const
get the vector of parameter settings (const method)
Definition FitConfig.h:86
ROOT::Math::Minimizer * CreateMinimizer()
create a new minimizer according to chosen configuration
const ParameterSettings & ParSettings(unsigned int i) const
get the parameter settings for the i-th parameter (const method)
Definition FitConfig.h:76
ROOT::Math::MinimizerOptions & MinimizerOptions()
access to the minimizer control parameter (non const method)
Definition FitConfig.h:167
Class, describing value, limits and step size of the parameters Provides functionality also to set/re...
bool IsFixed() const
check if is fixed
void SetValue(double val)
set the value
void SetStepSize(double err)
set the step size
double Value() const
return parameter value
double StepSize() const
return step size
Documentation for the abstract class IBaseFunctionMultiDim.
Definition IFunction.h:63
void SetMaxFunctionCalls(unsigned int maxfcn)
set maximum of function calls
void SetStrategy(int stra)
set the strategy
void SetMaxIterations(unsigned int maxiter)
set maximum iterations (one iteration can have many function calls)
static const std::string & DefaultMinimizerType()
int PrintLevel() const
non-static methods for retrieving options
void SetErrorDef(double err)
set error def
void SetPrintLevel(int level)
set print level
void SetTolerance(double tol)
set the tolerance
Abstract Minimizer class, defining the interface for the various minimizer (like Minuit2,...
Definition Minimizer.h:119
const_iterator begin() const
const_iterator end() const
Common abstract base class for objects that represent a value and a "shape" in RooFit.
Definition RooAbsArg.h:77
bool isConstant() const
Check if the "Constant" attribute is set.
Definition RooAbsArg.h:304
RooAbsCollection * snapshot(bool deepCopy=true) const
Take a snap shot of current collection contents.
Int_t index(const RooAbsArg *arg) const
Returns index of given arg, or -1 if arg is not in the collection.
void assign(const RooAbsCollection &other) const
Sets the value, cache and constant attribute of any argument in our set that also appears in the othe...
virtual bool addOwned(RooAbsArg &var, bool silent=false)
Add an argument and transfer the ownership to the collection.
RooAbsArg * find(const char *name) const
Find object with given name in list.
Abstract base class for objects that represent a real value and implements functionality common to al...
Definition RooAbsReal.h:59
static void clearEvalErrorLog()
Clear the stack of evaluation error messages.
RooArgList is a container object that can hold multiple RooAbsArg objects.
Definition RooArgList.h:22
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition RooArgSet.h:24
RooFitResult is a container class to hold the input and output of a PDF fit to a dataset.
static void setDefaultNWorkers(unsigned int N_workers)
Definition Config.cxx:67
static void setTimingAnalysis(bool timingAnalysis)
Definition Config.cxx:78
static void add_metadata(json data)
RooAbsReal that wraps RooAbsL likelihoods for use in RooFit outside of the RooMinimizer context.
Definition RooRealL.h:28
void setRecoverFromNaNStrength(double strength)
Try to recover from invalid function values.
int getPrintLevel()
Get the MINUIT internal printing level.
void optimizeConst(int flag)
If flag is true, perform constant term optimization on function being minimized.
void initMinimizerFirstPart()
Initialize the part of the minimizer that is independent of the function to be minimized.
std::ofstream * logfile()
int simplex()
Execute SIMPLEX.
std::unique_ptr< TMatrixDSym > _extV
void setMinimizerType(std::string const &type)
Choose the minimizer algorithm.
RooFit::OwningPtr< RooFitResult > save(const char *name=nullptr, const char *title=nullptr)
Save and return a RooFitResult snapshot of current minimizer status.
std::vector< std::pair< std::string, int > > _statusHistory
void profileStart()
Start profiling timer.
RooPlot * contour(RooRealVar &var1, RooRealVar &var2, double n1=1.0, double n2=2.0, double n3=0.0, double n4=0.0, double n5=0.0, double n6=0.0, unsigned int npoints=50)
Create and draw a TH2 with the error contours in the parameters var1 and var2.
std::unique_ptr< ROOT::Math::Minimizer > _minimizer
! pointer to used minimizer
bool setLogFile(const char *logf=nullptr)
void initMinimizerFcnDependentPart(double defaultErrorLevel)
Initialize the part of the minimizer that is dependent on the function to be minimized.
void fillCorrMatrix(RooFitResult &fitRes)
double & fcnOffset() const
ROOT::Fit::FitConfig _config
fitter configuration (options and parameter settings)
void profileStop()
Stop profiling timer and report results of last session.
int minos()
Execute MINOS.
double & maxFCN()
bool calculateHessErrors()
int hesse()
Execute HESSE.
bool calculateMinosErrors()
void setErrorLevel(double level)
Set the level for MINUIT error analysis to the given value.
void determineStatus(bool fitterReturnValue)
int migrad()
Execute MIGRAD.
bool update(bool isValid)
int seek()
Execute SEEK.
bool updateMinimizerOptions(bool canDifferentMinim=true)
void setEps(double eps)
Change MINUIT epsilon.
void setPrintLevel(int newLevel)
Change the MINUIT internal printing level.
void fillResult(bool isValid)
int exec(std::string const &algoName, std::string const &statusName)
int improve()
Execute IMPROVE.
void setOffsetting(bool flag)
Enable internal likelihood offsetting for enhanced numeric precision.
TStopwatch _timer
RooMinimizer::Config _cfg
bool fitFCN(const ROOT::Math::IMultiGenFunction &fcn)
std::unique_ptr< FitResult > _result
! pointer to the object containing the result of the fit
RooFit::OwningPtr< RooFitResult > lastMinuitFit()
void saveStatus(const char *label, int status)
~RooMinimizer() override
Destructor.
int minimize(const char *type, const char *alg=nullptr)
Minimise the function passed in the constructor.
ROOT::Math::IMultiGenFunction * getMultiGenFcn() const
std::unique_ptr< RooAbsReal::EvalErrorContext > makeEvalErrorContext() const
RooMinimizer(RooAbsReal &function, Config const &cfg={})
Construct MINUIT interface to given function.
void setMaxFunctionCalls(int n)
Change maximum number of likelihood function class from MINUIT (RooMinimizer default 500 * #parameter...
void setStrategy(int istrat)
Change MINUIT strategy to istrat.
int evalCounter() const
TStopwatch _cumulTimer
int getNPar() const
void setMaxIterations(int n)
Change maximum number of MINUIT iterations (RooMinimizer default 500 * #parameters)
void addParamsToProcessTimer()
Add parameters in metadata field to process timer.
std::unique_ptr< RooAbsMinimizerFcn > _fcn
void applyCovarianceMatrix(TMatrixDSym const &V)
Apply results of given external covariance matrix.
static RooMsgService & instance()
Return reference to singleton instance.
Plot frame and a container for graphics objects within that frame.
Definition RooPlot.h:43
void addObject(TObject *obj, Option_t *drawOptions="", bool invisible=false)
Add a generic object to this plot.
Definition RooPlot.cxx:325
Variable that can be changed from the outside.
Definition RooRealVar.h:37
double getError() const
Definition RooRealVar.h:58
virtual void SetLineStyle(Style_t lstyle)
Set the line style.
Definition TAttLine.h:44
virtual void SetLineWidth(Width_t lwidth)
Set the line width.
Definition TAttLine.h:45
virtual void SetLineColor(Color_t lcolor)
Set the line color.
Definition TAttLine.h:42
A TGraph is an object made of two arrays X and Y with npoints each.
Definition TGraph.h:41
void SetName(const char *name="") override
Set graph name.
Definition TGraph.cxx:2386
Manages Markers.
Definition TMarker.h:22
virtual const char * GetName() const
Returns name of object.
Definition TObject.cxx:456
void Start(Bool_t reset=kTRUE)
Start the stopwatch.
void Stop()
Stop the stopwatch.
void Print(Option_t *option="") const override
Print the real and cpu time passed between the start and stop events.
Basic string class.
Definition TString.h:139
const Int_t n
Definition legend1.C:16
T * OwningPtr
An alias for raw pointers for indicating that the return type of a RooFit function is an owning point...
Definition Config.h:35
OwningPtr< T > makeOwningPtr(std::unique_ptr< T > &&ptr)
Internal helper to turn a std::unique_ptr<T> into an OwningPtr.
Definition Config.h:40
Config argument to RooMinimizer constructor.
std::string minimizerType
double upperError(unsigned int i) const
std::string fMinimType
string indicating type of minimizer
std::vector< double > fErrors
errors
std::vector< double > fParams
parameter values. Size is total number of parameters
void GetCovarianceMatrix(TMatrixDSym &cov) const
std::map< unsigned int, bool > fFixedParams
list of fixed parameters
bool isParameterFixed(unsigned int ipar) const
double lowerError(unsigned int i) const
TMarker m
Definition textangle.C:8
TLine l
Definition textangle.C:4