GammaLib 2.0.0
Loading...
Searching...
No Matches
GModelSpatialRadialGeneralGauss.hpp
Go to the documentation of this file.
1/***************************************************************************
2 * GModelSpatialRadialGeneralGauss.hpp - Generalised radial Gaussian *
3 * source model class *
4 * ----------------------------------------------------------------------- *
5 * copyright (C) 2021-2022 by Luigi Tibaldo *
6 * ----------------------------------------------------------------------- *
7 * *
8 * This program is free software: you can redistribute it and/or modify *
9 * it under the terms of the GNU General Public License as published by *
10 * the Free Software Foundation, either version 3 of the License, or *
11 * (at your option) any later version. *
12 * *
13 * This program is distributed in the hope that it will be useful, *
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16 * GNU General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU General Public License *
19 * along with this program. If not, see <http://www.gnu.org/licenses/>. *
20 * *
21 ***************************************************************************/
22/**
23 * @file GModelSpatialRadialGeneralGauss.hpp
24 * @brief Generalized radial Gaussian model class interface definition
25 * @author Luigi Tibaldo
26 */
27
28#ifndef GMODELSPATIALRADIALGENERALGAUSS_HPP
29#define GMODELSPATIALRADIALGENERALGAUSS_HPP
30
31/* __ Includes ___________________________________________________________ */
32#include <string>
34#include "GModelPar.hpp"
35
36/* __ Forward declarations _______________________________________________ */
37class GEnergy;
38class GTime;
39class GPhoton;
40class GRan;
41class GSkyDir;
42class GSkyRegion;
43class GXmlElement;
44
45
46/***********************************************************************//**
47 * @class GModelSpatialRadialGeneralGauss
48 *
49 * @brief Generalized radial Gaussian model class
50 *
51 * This class implements the spatial component of the factorised source
52 * model for a generalised radial Gaussian source.
53 ***************************************************************************/
55
56public:
57 // Constructors and destructors
60 const double& radius,
61 const double& ridx,
62 const std::string& coordsys = "CEL");
66
67 // Operators
69
70 // Implemented pure virtual methods
71 virtual void clear(void);
72 virtual GModelSpatialRadialGeneralGauss* clone(void) const;
73 virtual std::string classname(void) const;
74 virtual double eval(const double& theta,
75 const GEnergy& energy,
76 const GTime& time,
77 const bool& gradients = false) const;
78 virtual GSkyDir mc(const GEnergy& energy,
79 const GTime& time,
80 GRan& ran) const;
81 virtual bool contains(const GSkyDir& dir,
82 const double& margin = 0.0) const;
83 virtual double theta_max(void) const;
84 virtual void read(const GXmlElement& xml);
85 virtual void write(GXmlElement& xml) const;
86 virtual std::string print(const GChatter& chatter = NORMAL) const;
87
88 // Other methods
89 double radius(void) const;
90 void radius(const double& radius);
91 double ridx(void) const;
92 void ridx(const double& ridx);
93
94protected:
95 // Protected methods
96 void init_members(void);
98 void free_members(void);
99 void update(void) const;
100 virtual void set_region(void) const;
101
102 // Protected members
103 GModelPar m_radius; //!< Gaussian width (deg)
104 GModelPar m_ridx; //!< Reciprocal of exponent of the radial profile
105
106 // Cached members used for pre-computations
107 mutable double m_last_radius; //!< Last radius
108 mutable double m_inv_radius_rad; //!< radius(rad)^-1
109 mutable double m_last_ridx; //!< Last reciprocal radial index
110 mutable double m_inv_ridx; //!< Spatial profile index
111 mutable double m_value_norm; //!< 1/(2pi radius(rad)^2 ridx Gamma(ridx))
112};
113
114
115/***********************************************************************//**
116 * @brief Return class name
117 *
118 * @return String containing the class name ("GModelSpatialRadialGeneralGauss").
119 ***************************************************************************/
120inline
122{
123 return ("GModelSpatialRadialGeneralGauss");
124}
125
126
127/***********************************************************************//**
128 * @brief Return radius
129 *
130 * @return Radius (deg).
131 *
132 * Returns the radius in degrees.
133 ***************************************************************************/
134inline
136{
137 return (m_radius.value());
138}
139
140/***********************************************************************//**
141 * @brief Set radius
142 *
143 * @param[in] radius (deg).
144 *
145 * Sets the radius in degrees.
146 ***************************************************************************/
147inline
149{
151 return;
152}
153
154/***********************************************************************//**
155 * @brief Return ridx
156 *
157 * @return Reciprocal of the radial profile index.
158 *
159 * Returns the reciprocal of the radial profile index.
160 ***************************************************************************/
161inline
163{
164 return (m_ridx.value());
165}
166
167/***********************************************************************//**
168 * @brief Set reciprocal index
169 *
170 * @param[in] ridx Reciprocal of the radial profile index.
171 *
172 * Sets the reciprocal index of the radial profile.
173 ***************************************************************************/
174inline
176{
178 return;
179}
180
181#endif /* GMODELSPATIALRADIALGENERALGAUSS_HPP */
Model parameter class interface definition.
Abstract radial spatial model base class interface definition.
GChatter
Definition GTypemaps.hpp:33
@ NORMAL
Definition GTypemaps.hpp:36
Class that handles energies in a unit independent way.
Definition GEnergy.hpp:48
Model parameter class.
Definition GModelPar.hpp:87
Generalized radial Gaussian model class.
GModelPar m_ridx
Reciprocal of exponent of the radial profile.
virtual GModelSpatialRadialGeneralGauss & operator=(const GModelSpatialRadialGeneralGauss &model)
Assignment operator.
virtual void write(GXmlElement &xml) const
Write model into XML element.
virtual GSkyDir mc(const GEnergy &energy, const GTime &time, GRan &ran) const
Returns MC sky direction.
virtual std::string print(const GChatter &chatter=NORMAL) const
Print generalised radial Gaussian source information.
virtual std::string classname(void) const
Return class name.
virtual double eval(const double &theta, const GEnergy &energy, const GTime &time, const bool &gradients=false) const
Evaluate Generalised Gaussian source model.
void update(void) const
Update precomputation cache.
double m_value_norm
1/(2pi radius(rad)^2 ridx Gamma(ridx))
double m_last_ridx
Last reciprocal radial index.
void init_members(void)
Initialise class members.
virtual void set_region(void) const
Set boundary sky region.
virtual GModelSpatialRadialGeneralGauss * clone(void) const
Clone radial Gauss model.
virtual void read(const GXmlElement &xml)
Read model from XML element.
virtual void clear(void)
Clear radial Gauss model.
virtual bool contains(const GSkyDir &dir, const double &margin=0.0) const
Checks where model contains specified sky direction.
void copy_members(const GModelSpatialRadialGeneralGauss &model)
Copy class members.
virtual double theta_max(void) const
Return maximum model radius (in radians)
Abstract radial spatial model base class.
std::string coordsys(void) const
Return coordinate system.
const GSkyDir & dir(void) const
Return position of radial spatial model.
double value(void) const
Return parameter value.
Class that handles photons.
Definition GPhoton.hpp:47
Random number generator class.
Definition GRan.hpp:44
Sky direction class.
Definition GSkyDir.hpp:62
Abstract interface for the sky region class.
Time class.
Definition GTime.hpp:55
XML element node class.