Jpp  master_rocky-43-ge265d140c
the software that should make you happy
JMinimizer.hh
Go to the documentation of this file.
1 #ifndef __JROOT__JMINIMIZER__
2 #define __JROOT__JMINIMIZER__
3 
4 #include <string>
5 #include <istream>
6 #include <ostream>
7 
8 #include "Math/MinimizerOptions.h"
9 
10 
11 /**
12  * Auxiliary data structure to define ROOT minimizer.
13  */
14 struct JMinimizer {
15  /**
16  * Default constructor.
17  */
19  type ("Minuit"),
20  algorithm("Migrad"),
21  debug (0)
22  {
23  configure();
24  }
25 
26 
27  /**
28  * Configure ROOT minimizer.
29  */
30  void configure()
31  {
32  ROOT::Math::MinimizerOptions::SetDefaultMinimizer(type.c_str(), algorithm.c_str());
33  ROOT::Math::MinimizerOptions::SetDefaultPrintLevel(debug);
34  }
35 
36 
37  /**
38  * Stream input of ROOT minimzer.
39  *
40  * \param in input stream
41  * \param object ROOT minimzer
42  * \return input stream
43  */
44  friend inline std::istream& operator>>(std::istream& in, JMinimizer& object)
45  {
46  if (in >> object.type >> object.algorithm) {
47 
48  in >> object.debug;
49 
50  in.clear();
51 
52  object.configure();
53  }
54 
55  return in;
56  }
57 
58 
59  /**
60  * Stream output of ROOT minimzer.
61  *
62  * \param out output stream
63  * \param object ROOT minimzer
64  * \return output stream
65  */
66  friend inline std::ostream& operator<<(std::ostream& out, const JMinimizer& object)
67  {
68  return out << object.type << ' ' << object.algorithm;
69  }
70 
71  std::string type;
72  std::string algorithm;
73  int debug;
74 };
75 
76 
77 /**
78  * ROOT minimizer.
79  */
81 
82 #endif
static JMinimizer minimizer
ROOT minimizer.
Definition: JMinimizer.hh:80
Auxiliary data structure to define ROOT minimizer.
Definition: JMinimizer.hh:14
friend std::ostream & operator<<(std::ostream &out, const JMinimizer &object)
Stream output of ROOT minimzer.
Definition: JMinimizer.hh:66
std::string type
Definition: JMinimizer.hh:71
JMinimizer()
Default constructor.
Definition: JMinimizer.hh:18
void configure()
Configure ROOT minimizer.
Definition: JMinimizer.hh:30
std::string algorithm
Definition: JMinimizer.hh:72
friend std::istream & operator>>(std::istream &in, JMinimizer &object)
Stream input of ROOT minimzer.
Definition: JMinimizer.hh:44