GammaLib 2.0.0
Loading...
Searching...
No Matches
GCTAModelRadialProfile.hpp
Go to the documentation of this file.
1/***************************************************************************
2 * GCTAModelRadialProfile.hpp - Radial Profile CTA model class *
3 * ----------------------------------------------------------------------- *
4 * copyright (C) 2011-2018 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 GCTAModelRadialProfile.hpp
23 * @brief Radial Profile model class interface definition
24 * @author Juergen Knoedlseder
25 */
26
27#ifndef GCTAMODELRADIALPROFILE_HPP
28#define GCTAMODELRADIALPROFILE_HPP
29
30/* __ Includes ___________________________________________________________ */
31#include <string>
32#include <cmath>
33#include "GMath.hpp"
34#include "GModelPar.hpp"
35#include "GCTAModelRadial.hpp"
36#include "GFunction.hpp"
37
38/* __ Forward declarations _______________________________________________ */
39class GRan;
40class GXmlElement;
41class GCTAObservation;
42class GCTAInstDir;
43
44
45/***********************************************************************//**
46 * @class GCTAModelRadialProfile
47 *
48 * @brief Radial Profile CTA model class
49 *
50 * This class implements the radial profile function
51 * \f[f(\theta) = (1 + (\theta/c_0)^{c_1})^{-c_2/c_1}\f]
52 * where
53 * \f$\theta\f$ is the offset angle (in degrees),
54 * \f$c_0\f$ is the width of the profile (width),
55 * \f$c_1\f$ is the width of the central plateau (core), and
56 * \f$c_2\f$ is the size of the tail (tail).
57 * Note that all 3 parameters are positive values.
58 ***************************************************************************/
60
61public:
62 // Constructors and destructors
64 explicit GCTAModelRadialProfile(const double& width, const double& core,
65 const double& tail);
66 explicit GCTAModelRadialProfile(const GXmlElement& xml);
68 virtual ~GCTAModelRadialProfile(void);
69
70 // Operators
72
73 // Implemented pure virtual methods
74 virtual void clear(void);
75 virtual GCTAModelRadialProfile* clone(void) const;
76 virtual std::string classname(void) const;
77 virtual std::string type(void) const;
78 virtual double eval(const double& offset,
79 const bool& gradients = false) const;
80 virtual GCTAInstDir mc(GRan& ran) const;
81 virtual double mc_max_value(const GCTAObservation& obs) const;
82 virtual double omega(void) const;
83 virtual void read(const GXmlElement& xml);
84 virtual void write(GXmlElement& xml) const;
85 virtual std::string print(const GChatter& chatter = NORMAL) const;
86
87 // Other methods
88 double width(void) const;
89 double core(void) const;
90 double tail(void) const;
91 void width(const double& width);
92 void core(const double& core);
93 void tail(const double& tail);
94
95protected:
96 // Protected methods
97 void init_members(void);
98 void copy_members(const GCTAModelRadialProfile& model);
99 void free_members(void);
100
101 // Radial integration class (used by omega() method). Note that the
102 // integration is done in radians
103 class integrand : public GFunction {
104 public:
105 integrand(const GCTAModelRadialProfile* model) : m_model(model) { }
106 double eval(const double& x) {
107 return (std::sin(x)*m_model->eval(x*gammalib::rad2deg));
108 }
109 private:
111 };
112
113 // Protected members
114 GModelPar m_width; //!< Width parameter
115 GModelPar m_core; //!< Core parameter
116 GModelPar m_tail; //!< Tail parameter
117};
118
119
120/***********************************************************************//**
121 * @brief Return class name
122 *
123 * @return String containing the class name ("GCTAModelRadialProfile").
124 ***************************************************************************/
125inline
127{
128 return ("GCTAModelRadialProfile");
129}
130
131
132/***********************************************************************//**
133 * @brief Return model type
134 *
135 * @return Model type "Profile".
136 ***************************************************************************/
137inline
138std::string GCTAModelRadialProfile::type(void) const
139{
140 return ("Profile");
141}
142
143
144/***********************************************************************//**
145 * @brief Return profile width
146 *
147 * @return Profile width.
148 ***************************************************************************/
149inline
151{
152 return (m_width.value());
153}
154
155
156/***********************************************************************//**
157 * @brief Return profile core
158 *
159 * @return Profile core.
160 ***************************************************************************/
161inline
163{
164 return (m_core.value());
165}
166
167
168/***********************************************************************//**
169 * @brief Return profile tail
170 *
171 * @return Profile tail.
172 ***************************************************************************/
173inline
175{
176 return (m_tail.value());
177}
178
179
180/***********************************************************************//**
181 * @brief Set profile width
182 *
183 * @param[in] width Profile width.
184 ***************************************************************************/
185inline
186void GCTAModelRadialProfile::width(const double& width)
187{
189 return;
190}
191
192
193/***********************************************************************//**
194 * @brief Set profile core
195 *
196 * @param[in] core Profile core.
197 ***************************************************************************/
198inline
199void GCTAModelRadialProfile::core(const double& core)
200{
202 return;
203}
204
205
206/***********************************************************************//**
207 * @brief Set profile tail
208 *
209 * @param[in] tail Profile tail.
210 ***************************************************************************/
211inline
212void GCTAModelRadialProfile::tail(const double& tail)
213{
215 return;
216}
217
218#endif /* GCTAMODELRADIALPROFILE_HPP */
Abstract radial acceptance model class interface definition.
Single parameter function abstract base class definition.
Mathematical function definitions.
Model parameter class interface definition.
GChatter
Definition GTypemaps.hpp:33
@ NORMAL
Definition GTypemaps.hpp:36
CTA instrument direction class.
integrand(const GCTAModelRadialProfile *model)
const GCTAModelRadialProfile * m_model
Radial Profile CTA model class.
void free_members(void)
Delete class members.
void init_members(void)
Initialise class members.
virtual void clear(void)
Clear instance.
GModelPar m_tail
Tail parameter.
virtual GCTAModelRadialProfile & operator=(const GCTAModelRadialProfile &model)
Assignment operator.
virtual GCTAModelRadialProfile * clone(void) const
Clone instance.
virtual double mc_max_value(const GCTAObservation &obs) const
Return maximum function value for Monte Carlo simulations.
virtual ~GCTAModelRadialProfile(void)
Destructor.
virtual void read(const GXmlElement &xml)
Read model from XML element.
virtual GCTAInstDir mc(GRan &ran) const
Returns MC instrument direction.
virtual double omega(void) const
Returns integral over radial model (in steradians)
double core(void) const
Return profile core.
GCTAModelRadialProfile(void)
Void constructor.
virtual double eval(const double &offset, const bool &gradients=false) const
Evaluate function.
virtual std::string classname(void) const
Return class name.
double tail(void) const
Return profile tail.
virtual void write(GXmlElement &xml) const
Write model into XML element.
virtual std::string print(const GChatter &chatter=NORMAL) const
Print point source information.
virtual std::string type(void) const
Return model type.
void copy_members(const GCTAModelRadialProfile &model)
Copy class members.
double width(void) const
Return profile width.
GModelPar m_width
Width parameter.
GModelPar m_core
Core parameter.
Abstract radial acceptance model class.
CTA observation class.
Single parameter function abstract base class.
Definition GFunction.hpp:44
Model parameter class.
Definition GModelPar.hpp:87
double value(void) const
Return parameter value.
Random number generator class.
Definition GRan.hpp:44
XML element node class.
const double rad2deg
Definition GMath.hpp:44