npstat is hosted by Hepforge, IPPP Durham
NPStat  5.10.0
NeymanOSDE1DResult.hh
Go to the documentation of this file.
1 #ifndef NPSTAT_NEYMANOSDE1DRESULT_HH_
2 #define NPSTAT_NEYMANOSDE1DRESULT_HH_
3 
4 /*!
5 // \file NeymanOSDE1DResult.hh
6 //
7 // \brief Class for representing results of the Neyman OSDE
8 // optimization algorithms
9 //
10 // Author: I. Volobouev
11 //
12 // March 2023
13 */
14 
15 #include <vector>
16 
17 namespace npstat {
18  enum NeymanOSDE1DMinimizerCode {
19  NOSDE_NOT_OPTIMIZED = 0,
20  NOSDE_NEWTON,
21  NOSDE_GRADIENT_DESCENT,
22  NOSDE_RANDOM_SEARCH,
23  NOSDE_MINUIT,
24  NOSDE_MINUIT_IMPROVED,
25  NOSDE_OTHER,
26  NOSDE_N_MINIMIZER_CODES
27  };
28 
29  const char* neymanOSDEMinimizerName(unsigned minimizerCode);
30 
32  {
33  public:
34  inline NeymanOSDE1DResult(const std::vector<double>& i_coeffs,
35  const std::vector<double>& polyStats,
36  const double i_chiSquare,
37  const double i_maxAbsGradient,
38  const unsigned i_minimizerCode,
39  const unsigned i_nIterations,
40  const bool i_converged,
41  const bool i_badHessian)
42  : coeffs_(i_coeffs),
43  polyStatistics_(polyStats),
44  chiSquare_(i_chiSquare),
45  maxAbsGradient_(i_maxAbsGradient),
46  minimizerCode_(i_minimizerCode),
47  nIterations_(i_nIterations),
48  converged_(i_converged),
49  badHessian_(i_badHessian)
50  {
51  }
52 
53  inline void setMinimizerCode(const unsigned c) {minimizerCode_ = c;}
54 
55  inline const std::vector<double>& coeffs() const {return coeffs_;}
56  inline const std::vector<double>& polyStatistics() const
57  {return polyStatistics_;}
58  inline double chiSquare() const {return chiSquare_;}
59  inline double maxAbsGradient() const {return maxAbsGradient_;}
60  inline unsigned minimizerCode() const {return minimizerCode_;}
61  inline unsigned nIterations() const {return nIterations_;}
62  inline bool converged() const {return converged_;}
63  inline bool badHessian() const {return badHessian_;}
64 
65  inline bool operator<(const NeymanOSDE1DResult& r) const
66  {
67  if (chiSquare_ < r.chiSquare_) return true;
68  if (r.chiSquare_ < chiSquare_) return false;
69  if (maxAbsGradient_ < r.maxAbsGradient_) return true;
70  if (r.maxAbsGradient_ < maxAbsGradient_) return false;
71  if (converged_ && !r.converged_) return true;
72  if (!converged_ && r.converged_) return false;
73  return false;
74  }
75 
76  private:
77  std::vector<double> coeffs_;
78  std::vector<double> polyStatistics_;
79  double chiSquare_;
80  double maxAbsGradient_;
81  unsigned minimizerCode_;
82  unsigned nIterations_;
83  bool converged_;
84  bool badHessian_;
85  };
86 }
87 
88 #endif // NPSTAT_NEYMANOSDE1DRESULT_HH_
Definition: NeymanOSDE1DResult.hh:32
Definition: AbsArrayProjector.hh:14