GammaLib 2.1.0.dev
Loading...
Searching...
No Matches
GModelTemporalConst.hpp
Go to the documentation of this file.
1/***************************************************************************
2 * GModelTemporalConst.hpp - Temporal constant model class *
3 * ----------------------------------------------------------------------- *
4 * copyright (C) 2009-2016 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 GModelTemporalConst.hpp
23 * @brief Constant temporal model class interface definition
24 * @author Juergen Knoedlseder
25 */
26
27#ifndef GMODELTEMPORALCONST_HPP
28#define GMODELTEMPORALCONST_HPP
29
30/* __ Includes ___________________________________________________________ */
31#include <string>
32#include "GModelPar.hpp"
33#include "GModelTemporal.hpp"
34#include "GTime.hpp"
35#include "GTimes.hpp"
36#include "GXmlElement.hpp"
37
38
39/***********************************************************************//**
40 * @class GModelTemporalConst
41 *
42 * @brief Constant temporal model class
43 *
44 * This class implements a constant light curve. The model is defined by
45 *
46 * \f[
47 * S_{\rm t}(t) = {\tt m\_norm}
48 * \f]
49 *
50 * where
51 * \f${\tt m\_norm}\f$ is the normalization constant which by default is
52 * set to unity. The parameter \f${\tt m\_norm}\f$ is not supposed to be
53 * fitted.
54 ***************************************************************************/
56
57public:
58 // Constructors and destructors
60 explicit GModelTemporalConst(const GXmlElement& xml);
61 explicit GModelTemporalConst(const double& norm);
63 virtual ~GModelTemporalConst(void);
64
65 // Operators
67
68 // Implemented virtual base class methods
69 virtual void clear(void);
70 virtual GModelTemporalConst* clone(void) const;
71 virtual std::string classname(void) const;
72 virtual std::string type(void) const;
73 virtual double eval(const GTime& srcTime,
74 const bool& gradients = false) const;
75 virtual GTimes mc(const double& rate, const GTime& tmin,
76 const GTime& tmax, GRan& ran) const;
77 virtual void read(const GXmlElement& xml);
78 virtual void write(GXmlElement& xml) const;
79 virtual std::string print(const GChatter& chatter = NORMAL) const;
80
81 // Other methods
82 double norm(void) const;
83 void norm(const double& norm);
84
85protected:
86 // Protected methods
87 void init_members(void);
88 void copy_members(const GModelTemporalConst& model);
89 void free_members(void);
90
91 // Protected members
92 GModelPar m_norm; //!< Constant
93};
94
95
96/***********************************************************************//**
97 * @brief Return class name
98 *
99 * @return String containing the class name ("GModelTemporalConst").
100 ***************************************************************************/
101inline
102std::string GModelTemporalConst::classname(void) const
103{
104 return ("GModelTemporalConst");
105}
106
107
108/***********************************************************************//**
109 * @brief Return model type
110 *
111 * @return "ConstantValue".
112 *
113 * Returns the type of the constant temporal model.
114 ***************************************************************************/
115inline
116std::string GModelTemporalConst::type(void) const
117{
118 return "Constant";
119}
120
121
122/***********************************************************************//**
123 * @brief Return normalization factor
124 *
125 * @return Normalization factor.
126 *
127 * Returns the normalization factor.
128 ***************************************************************************/
129inline
131{
132 return (m_norm.value());
133}
134
135
136/***********************************************************************//**
137 * @brief Set normalization factor
138 *
139 * @param[in] norm Normalization factor.
140 *
141 * Sets the normalization factor.
142 ***************************************************************************/
143inline
145{
147 return;
148}
149
150#endif /* GMODELTEMPORALCONST_HPP */
Model parameter class interface definition.
Abstract temporal model base class interface definition.
Time class interface definition.
Time container class definition.
GChatter
Definition GTypemaps.hpp:33
@ NORMAL
Definition GTypemaps.hpp:36
double norm(const GVector &vector)
Computes vector norm.
Definition GVector.cpp:932
XML element node class interface definition.
Model parameter class.
Definition GModelPar.hpp:87
Constant temporal model class.
virtual GModelTemporalConst & operator=(const GModelTemporalConst &model)
Assignment operator.
virtual double eval(const GTime &srcTime, const bool &gradients=false) const
Evaluate function.
virtual std::string type(void) const
Return model type.
GModelTemporalConst(void)
Void constructor.
virtual void write(GXmlElement &xml) const
Write model into XML element.
virtual std::string print(const GChatter &chatter=NORMAL) const
Print constant information.
GModelPar m_norm
Constant.
void copy_members(const GModelTemporalConst &model)
Copy class members.
void free_members(void)
Delete class members.
virtual void read(const GXmlElement &xml)
Read model from XML element.
void init_members(void)
Initialise class members.
virtual ~GModelTemporalConst(void)
Destructor.
virtual GTimes mc(const double &rate, const GTime &tmin, const GTime &tmax, GRan &ran) const
Returns vector of random event times.
virtual void clear(void)
Clear constant temporal model.
virtual GModelTemporalConst * clone(void) const
Clone constant temporal model.
virtual std::string classname(void) const
Return class name.
double norm(void) const
Return normalization factor.
Abstract temporal model base class.
double value(void) const
Return parameter value.
Random number generator class.
Definition GRan.hpp:44
Time class.
Definition GTime.hpp:55
Time container class.
Definition GTimes.hpp:45
XML element node class.