17 #include <Minuit2/Minuit2Minimizer.h>
21 std::map<int, std::string> statusDescription()
23 std::map<int, std::string> result;
24 result[0] =
"OK, valid minimum";
25 result[1] =
"Didn't converge, covariance was made pos defined";
26 result[2] =
"Didn't converge, Hessian is invalid";
27 result[3] =
"Didn't converge, Edm is above max";
28 result[4] =
"Didn't converge, reached call limit";
29 result[5] =
"Didn't converge, unknown failure";
33 std::map<int, std::string> covmatrixStatusDescription()
35 std::map<int, std::string> result;
36 result[-1] =
"Not available (inversion failed or Hessian failed)";
37 result[0] =
"Available but not positive defined";
38 result[1] =
"Covariance only approximate";
39 result[2] =
"Full matrix but forced pos def";
40 result[3] =
"Full accurate";
50 addOption(
"Strategy", 1,
"Minimization strategy (0-low, 1-medium, 2-high quality)");
51 addOption(
"ErrorDef", 1.0,
"Error definition factor for parameter error calculation");
52 addOption(
"Tolerance", 0.01,
"Tolerance on the function value at the minimum");
53 addOption(
"Precision", -1.0,
"Relative floating point arithmetic precision");
54 addOption(
"PrintLevel", 0,
"Minimizer internal print level");
55 addOption(
"MaxFunctionCalls", 0,
"Maximum number of function calls");
67 return optionValue<int>(
"Strategy");
77 return optionValue<double>(
"ErrorDef");
87 return optionValue<double>(
"Tolerance");
97 return optionValue<double>(
"Precision");
107 return optionValue<int>(
"PrintLevel");
117 return optionValue<int>(
"MaxFunctionCalls");
129 result[
"CovMatrixStatus"] = covmatrixStatusDescription()[
rootMinimizer()->CovMatrixStatus()];
130 result[
"functionCalls"] = std::to_string(
rootMinimizer()->NCalls());
Declares class Minuit2Minimizer.
Abstract base class that adapts the CERN ROOT minimizer to our IMinimizer.
virtual std::map< std::string, std::string > statusMap() const
Returns map of string representing different minimizer statuses.
OptionContainer::option_t addOption(const std::string &optionName, T value, const std::string &description="")
ROOT::Math::Minimizer root_minimizer_t
void setOptionValue(const std::string &optionName, T value)
std::string algorithmName() const final
Returns name of the minimization algorithm.
Info about a minimizer, including list of defined minimization algorithms.
Wrapper for the CERN ROOT facade of the Minuit2 minimizer.
void setPrecision(double value)
Sets relative floating point arithmetic precision.
void propagateOptions() override
Propagate options down to ROOT's Minuit2Minimizer.
Minuit2Minimizer(const std::string &algorithmName="Migrad")
void setMaxFunctionCalls(int value)
Sets maximum number of objective function calls.
std::unique_ptr< ROOT::Minuit2::Minuit2Minimizer > m_minuit2_minimizer
void setPrintLevel(int value)
Sets minimizer internal print level.
void setStrategy(int value)
Sets minimization strategy (0-low, 1-medium, 2-high minimization quality).
int maxFunctionCalls() const
std::string statusToString() const override
Returns string representation of current minimizer status.
void setTolerance(double value)
Sets tolerance on the function value at the minimum.
void setErrorDefinition(double value)
Sets error definition factor for parameter error calculation.
std::map< std::string, std::string > statusMap() const override
Returns map of string representing different minimizer statuses.
bool requiresResiduals() override
Returns true if minimizer computations are residual-based, false otherwise.
double errorDefinition() const
const root_minimizer_t * rootMinimizer() const override
std::string scientific(const T value, int n=10)
Returns scientific string representing given value of any numeric type.