ctools  2.0.0
 All Classes Namespaces Files Functions Variables Macros Pages
ctlikelihood.hpp
Go to the documentation of this file.
1 /***************************************************************************
2  * ctlikelihood - Base class for likelihood tools *
3  * ----------------------------------------------------------------------- *
4  * copyright (C) 2016-2022 by Juergen Knoedlseder *
5  * ----------------------------------------------------------------------- *
6  * *
7  * This program is free software: you can redistribute it and/or modify *
8  * it under the terms of the GNU General Public License as published by *
9  * the Free Software Foundation, either version 3 of the License, or *
10  * (at your option) any later version. *
11  * *
12  * This program is distributed in the hope that it will be useful, *
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15  * GNU General Public License for more details. *
16  * *
17  * You should have received a copy of the GNU General Public License *
18  * along with this program. If not, see <http://www.gnu.org/licenses/>. *
19  * *
20  ***************************************************************************/
21 /**
22  * @file ctlikelihood.hpp
23  * @brief Likelihood tool base class interface definition
24  * @author Juergen Knoedlseder
25  */
26 
27 #ifndef CTLIKELIHOOD_HPP
28 #define CTLIKELIHOOD_HPP
29 
30 /* __ Includes ___________________________________________________________ */
31 #include "ctobservation.hpp"
32 
33 /* __Definitions _________________________________________________________ */
34 
35 
36 /***********************************************************************//**
37  * @class ctlikelihood
38  *
39  * @brief Base class for likelihood tools
40  ***************************************************************************/
41 class ctlikelihood : public ctobservation {
42 
43 public:
44  // Constructors and destructors
45  ctlikelihood(const std::string& name,
46  const std::string& version);
47  ctlikelihood(const std::string& name,
48  const std::string& version,
49  const GApplicationPars& pars);
50  ctlikelihood(const std::string& name,
51  const std::string& version,
52  int argc,
53  char* argv[]);
54  ctlikelihood(const std::string& name,
55  const std::string& version,
56  const GObservations& obs);
58  virtual ~ctlikelihood(void);
59 
60  // Operators
61  ctlikelihood& operator=(const ctlikelihood& app);
62 
63  // Pure virtual methods
64  virtual void clear(void) = 0;
65  virtual void process(void) = 0;
66  virtual void save(void) = 0;
67 
68  // Methods
69  void opt(const GOptimizer* opt);
70  const GOptimizer* opt(void) const;
71 
72 #ifndef SWIG
73 protected:
74 #endif
75  // Protected methods in C++, public in SWIG interface
76  double evaluate(GModelPar& par, const double& value);
77 
78 protected:
79  // Protected methods
80  void init_members(void);
81  void copy_members(const ctlikelihood& app);
82  void free_members(void);
83 
84  // Protected members
85  GOptimizerLM m_opt; //!< Optimizer
86 };
87 
88 
89 /***********************************************************************//**
90  * @brief Return optimizer
91  *
92  * @return Pointer to optimizer.
93  *
94  * Returns a pointer to the optimizer.
95  ***************************************************************************/
96 inline
97 const GOptimizer* ctlikelihood::opt(void) const
98 {
99  return &m_opt;
100 }
101 
102 #endif /* CTLIKELIHOOD_HPP */
void copy_members(const ctlikelihood &app)
Copy class members.
ctlikelihood & operator=(const ctlikelihood &app)
Assignment operator.
double evaluate(GModelPar &par, const double &value)
Evaluates the log-likelihood function.
const GObservations & obs(void) const
Return observation container.
virtual ~ctlikelihood(void)
Destructor.
const GOptimizer * opt(void) const
Return optimizer.
virtual void process(void)=0
Observation tool base class interface definition.
Base class for observation tools.
void free_members(void)
Delete class members.
virtual void clear(void)=0
void init_members(void)
Initialise class members.
ctlikelihood(const std::string &name, const std::string &version)
Name constructor.
Base class for likelihood tools.
GOptimizerLM m_opt
Optimizer.
virtual void save(void)=0