#ifndef __JROOT__JMINIMIZER__ #define __JROOT__JMINIMIZER__ #include #include #include #include "Math/MinimizerOptions.h" /** * Auxiliary data structure to define ROOT minimizer. */ struct JMinimizer { /** * Default constructor. */ JMinimizer() : type ("Minuit"), algorithm("Migrad"), debug (0) { configure(); } /** * Configure ROOT minimizer. */ void configure() { ROOT::Math::MinimizerOptions::SetDefaultMinimizer(type.c_str(), algorithm.c_str()); ROOT::Math::MinimizerOptions::SetDefaultPrintLevel(debug); } /** * Stream input of ROOT minimzer. * * \param in input stream * \param object ROOT minimzer * \return input stream */ friend inline std::istream& operator>>(std::istream& in, JMinimizer& object) { if (in >> object.type >> object.algorithm) { in >> object.debug; in.clear(); object.configure(); } return in; } /** * Stream output of ROOT minimzer. * * \param out output stream * \param object ROOT minimzer * \return output stream */ friend inline std::ostream& operator<<(std::ostream& out, const JMinimizer& object) { return out << object.type << ' ' << object.algorithm; } std::string type; std::string algorithm; int debug; }; /** * ROOT minimizer. */ static JMinimizer minimizer; #endif