npstat is hosted by Hepforge, IPPP Durham
NPStat  5.10.0
PLogliOSDE1DResult.hh
Go to the documentation of this file.
1 #ifndef NPSTAT_PLOGLIOSDE1DRESULT_HH_
2 #define NPSTAT_PLOGLIOSDE1DRESULT_HH_
3 
4 /*!
5 // \file PLogliOSDE1DResult.hh
6 //
7 // \brief Class for representing results of the
8 // pseudo-log-likelihood OSDE optimization algorithms
9 //
10 // Author: I. Volobouev
11 //
12 // March 2023
13 */
14 
15 #include <vector>
16 
17 namespace npstat {
18  enum PLogliOSDE1DMinimizerCode {
19  PLOSDE_NOT_OPTIMIZED = 0,
20  PLOSDE_MINUIT,
21  PLOSDE_N_MINIMIZER_CODES
22  };
23 
24  const char* plOSDEMinimizerName(unsigned minimizerCode);
25 
27  {
28  public:
29  inline PLogliOSDE1DResult(const std::vector<double>& i_coeffs,
30  const double i_pseudoLogli,
31  const double i_maxAbsGradient,
32  const unsigned i_minimizerCode,
33  const unsigned i_nIterations,
34  const bool i_converged,
35  const bool i_badHessian)
36  : coeffs_(i_coeffs),
37  pseudoLogli_(i_pseudoLogli),
38  maxAbsGradient_(i_maxAbsGradient),
39  minimizerCode_(i_minimizerCode),
40  nIterations_(i_nIterations),
41  converged_(i_converged),
42  badHessian_(i_badHessian)
43  {
44  }
45 
46  inline void setMinimizerCode(const unsigned c) {minimizerCode_ = c;}
47 
48  inline const std::vector<double>& coeffs() const {return coeffs_;}
49  inline double pseudoLogli() const {return pseudoLogli_;}
50  inline double maxAbsGradient() const {return maxAbsGradient_;}
51  inline unsigned minimizerCode() const {return minimizerCode_;}
52  inline unsigned nIterations() const {return nIterations_;}
53  inline bool converged() const {return converged_;}
54  inline bool badHessian() const {return badHessian_;}
55 
56  inline bool operator<(const PLogliOSDE1DResult& r) const
57  {
58  if (r.pseudoLogli_ < pseudoLogli_) return true;
59  if (pseudoLogli_ < r.pseudoLogli_) return false;
60  if (maxAbsGradient_ < r.maxAbsGradient_) return true;
61  if (r.maxAbsGradient_ < maxAbsGradient_) return false;
62  if (converged_ && !r.converged_) return true;
63  if (!converged_ && r.converged_) return false;
64  return false;
65  }
66 
67  private:
68  std::vector<double> coeffs_;
69  double pseudoLogli_;
70  double maxAbsGradient_;
71  unsigned minimizerCode_;
72  unsigned nIterations_;
73  bool converged_;
74  bool badHessian_;
75  };
76 }
77 
78 #endif // NPSTAT_PLOGLIOSDE1DRESULT_HH_
Definition: PLogliOSDE1DResult.hh:27
Definition: AbsArrayProjector.hh:14