18 #include <boost/format.hpp>
27 const int column_width = 18;
29 template <
typename T> std::string reportValue(
const std::string& name, T value)
31 std::ostringstream result;
32 result << std::setw(column_width) << std::left << name <<
": " << value << std::endl;
44 std::ostringstream result;
47 result << reportDescription(minimizer);
48 result << reportOption(minimizer);
49 result << reportStatus(minimizer);
56 std::ostringstream result;
60 result <<
"Name StartValue Limits FitValue"
61 <<
" Error" << std::endl;
63 for (
const auto& par : parameters) {
64 result << boost::format(
"%-26.26s %-8.3e %-28s %-8.3e %8.3e \n") % par.name()
65 % par.startValue() % par.limits().toString() % par.value() % par.error();
68 Fit::Parameters::corr_matrix_t matrix = parameters.correlationMatrix();
69 if (!matrix.empty()) {
71 for (
size_t i = 0; i < matrix.size(); ++i) {
72 result << boost::format(
"#%-2d ") % i;
73 for (
size_t j = 0; j < matrix[i].size(); ++j)
74 result << boost::format(
"%_7.4f ") % matrix[i][j];
87 std::ostringstream result;
88 result << reportValue(
"MinimizerType", minimizer.
minimizerName());
89 result << reportValue(
"AlgorithmName", minimizer.
algorithmName());
95 if (minimizer.options().empty())
98 std::ostringstream result;
100 for (
auto option : minimizer.options()) {
101 std::ostringstream opt;
102 opt << std::setw(5) << std::left << option->value() << option->description();
103 result << reportValue(option->name(), opt.str());
113 std::ostringstream result;
117 for (
auto it : status)
118 result << reportValue(it.first, it.second);
Declares MinimizerResultUtils namespace.
Declares namespace MinimizerUtils.
Declares class RootMinimizerAdapter.
A collection of fit parameters.
std::string toOptionString() const
Returns string with all options (i.e. "Strategy=1;Tolerance=0.01;")
Pure virtual interface that adapts the CERN ROOT minimizer to our IMinimizer.
std::string minimizerName() const override final
Returns name of the minimizer.
std::string algorithmName() const override final
Returns name of the minimization algorithm.
virtual std::map< std::string, std::string > statusMap() const
Returns map of string representing different minimizer statuses.
Objective function types.
std::string reportToString(const RootMinimizerAdapter &minimizer)
Reports results of minimization in the form of multi-line string.
std::string reportParameters(const Fit::Parameters ¶meters)
Reports fit parameters settings and final results.
std::string sectionString(const std::string §ionName="", size_t report_width=80)
Returns horizontal line of 80 characters length with section name in it.