ctools  2.0.0
 All Classes Namespaces Files Functions Variables Macros Pages
cterror.hpp
Go to the documentation of this file.
1 /***************************************************************************
2  * cterror - Parameter error calculation tool *
3  * ----------------------------------------------------------------------- *
4  * copyright (C) 2015-2022 by Florent Forest *
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 cterror.hpp
23  * @brief Parameter error calculation tool interface definition
24  * @author Florent Forest
25  */
26 
27 #ifndef CTERROR_HPP
28 #define CTERROR_HPP
29 
30 /* __ Includes ___________________________________________________________ */
31 #include "ctlikelihood.hpp"
32 
33 /* __Definitions _________________________________________________________ */
34 #define CTERROR_NAME "cterror"
35 
36 
37 /***********************************************************************//**
38  * @class cterror
39  *
40  * @brief Parameter error calculation tool
41  ***************************************************************************/
42 class cterror : public ctlikelihood {
43 
44 public:
45  // Constructors and destructors
46  cterror(void);
47  explicit cterror(const GObservations& obs);
48  cterror(int argc, char *argv[]);
49  cterror(const cterror& app);
50  virtual ~cterror(void);
51 
52  // Operators
53  cterror& operator=(const cterror& app);
54 
55  // Methods
56  void clear(void);
57  void process(void);
58  void save(void);
59 
60 protected:
61  // Protected methods
62  void init_members(void);
63  void copy_members(const cterror& app);
64  void free_members(void);
65  void get_parameters(void);
66  double error_bisection(const double& min, const double& max);
67 
68  // User parameters
69  std::string m_srcname; //!< Name of source
70  GFilename m_outmodel; //!< Output model XML file
71  double m_confidence; //!< Confidence level
72  double m_tol; //!< Tolerance for limit determination
73  int m_max_iter; //!< Maximum number of iterations
74  bool m_apply_edisp; //!< Apply energy dispersion?
75  GChatter m_chatter; //!< Chattiness
76 
77  // Protected members
78  double m_value; //!< Parameter value
79  double m_dlogL; //!< Likelihood difference for upper limit computation
80  GModelPar* m_model_par; //!< Pointer to model parameter
81  double m_best_logL; //!< Best fit log likelihood of given model
82 };
83 
84 #endif /* CTERROR_HPP */
void save(void)
Save model.
Definition: cterror.cpp:342
Parameter error calculation tool.
Definition: cterror.hpp:42
void free_members(void)
Delete class members.
Definition: cterror.cpp:432
double m_tol
Tolerance for limit determination.
Definition: cterror.hpp:72
void get_parameters(void)
Get application parameters.
Definition: cterror.cpp:444
GChatter m_chatter
Chattiness.
Definition: cterror.hpp:75
const GObservations & obs(void) const
Return observation container.
double m_dlogL
Likelihood difference for upper limit computation.
Definition: cterror.hpp:79
double error_bisection(const double &min, const double &max)
Calculate error using a bisection method.
Definition: cterror.cpp:504
void init_members(void)
Initialise class members.
Definition: cterror.cpp:380
virtual ~cterror(void)
Destructor.
Definition: cterror.cpp:134
Likelihood tool base class interface definition.
double m_value
Parameter value.
Definition: cterror.hpp:78
std::string m_srcname
Name of source.
Definition: cterror.hpp:69
void process(void)
Compute parameter errors using a likelihood profile method.
Definition: cterror.cpp:223
cterror(void)
Void constructor.
Definition: cterror.cpp:60
void clear(void)
Clear cterror tool.
Definition: cterror.cpp:193
GModelPar * m_model_par
Pointer to model parameter.
Definition: cterror.hpp:80
GFilename m_outmodel
Output model XML file.
Definition: cterror.hpp:70
bool m_apply_edisp
Apply energy dispersion?
Definition: cterror.hpp:74
void copy_members(const cterror &app)
Copy class members.
Definition: cterror.cpp:407
cterror & operator=(const cterror &app)
Assignment operator.
Definition: cterror.cpp:158
double m_confidence
Confidence level.
Definition: cterror.hpp:71
int m_max_iter
Maximum number of iterations.
Definition: cterror.hpp:73
double m_best_logL
Best fit log likelihood of given model.
Definition: cterror.hpp:81
Base class for likelihood tools.