GammaLib 2.0.0
Loading...
Searching...
No Matches
GModelSpatialRadialRing.hpp
Go to the documentation of this file.
1/***************************************************************************
2 * GModelSpatialRadialRing.hpp - Radial ring source model class *
3 * ----------------------------------------------------------------------- *
4 * copyright (C) 2020-2022 by Pierrick Martin *
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 GModelSpatialRadialRing.hpp
23 * @brief Radial ring model class interface definition
24 * @author Pierrick Martin
25 */
26
27#ifndef GMODELSPATIALRADIALRING_HPP
28#define GMODELSPATIALRADIALRING_HPP
29
30/* __ Includes ___________________________________________________________ */
31#include <string>
33#include "GModelPar.hpp"
34
35/* __ Forward declarations _______________________________________________ */
36class GEnergy;
37class GTime;
38class GPhoton;
39class GRan;
40class GSkyDir;
41class GSkyRegion;
42class GXmlElement;
43
44
45/**************************************************************************
46 * @class GModelSpatialRadialRing
47 *
48 * @brief Ring source model class
49 *
50 * This class implements the spatial component of the factorised source
51 * model for a ring source, i.e. constant surface brightness between an
52 * inner radius and an outer radius, and no emission elsewhere.
53 ***************************************************************************/
55
56public:
57 // Constructors and destructors
60 const double& radius,
61 const double& width,
62 const std::string& coordsys = "CEL");
63 explicit GModelSpatialRadialRing(const GXmlElement& xml);
65 virtual ~GModelSpatialRadialRing(void);
66
67 // Operators
69
70 // Implemented pure virtual base class methods
71 virtual void clear(void);
72 virtual GModelSpatialRadialRing* 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_min(void) const;
84 virtual double theta_max(void) const;
85 virtual void read(const GXmlElement& xml);
86 virtual void write(GXmlElement& xml) const;
87 virtual std::string print(const GChatter& chatter = NORMAL) const;
88
89 // Other methods
90 double radius(void) const;
91 void radius(const double& radius);
92 double width(void) const;
93 void width(const double& width);
94
95protected:
96 // Protected methods
97 void init_members(void);
98 void copy_members(const GModelSpatialRadialRing& model);
99 void free_members(void);
100 void update(void) const;
101 virtual void set_region(void) const;
102
103 // Protected members
104 GModelPar m_radius; //!< Ring inner radius (degrees)
105 GModelPar m_width; //!< Ring width (degrees)
106
107 // Cached members used for pre-computations
108 mutable double m_last_radius; //!< Last ring radius
109 mutable double m_last_width; //!< Last ring width
110 mutable double m_inner_radius_rad; //!< Inner radius in radians
111 mutable double m_outer_radius_rad; //!< Outer radius in radians
112 mutable double m_cos_inner_radius_rad; //!< Cosine of inner radius in radians
113 mutable double m_cos_outer_radius_rad; //!< Cosine of outer radius in radians
114 mutable double m_norm; //!< Normalization
115};
116
117
118/***********************************************************************//**
119 * @brief Return class name
120 *
121 * @return String containing the class name ("GModelSpatialRadialRing").
122 ***************************************************************************/
123inline
125{
126 return ("GModelSpatialRadialRing");
127}
128
129
130/***********************************************************************//**
131 * @brief Return ring inner radius
132 *
133 * @return Ring inner radius (degrees).
134 *
135 * Returns the inner radius of the ring in degrees.
136 ***************************************************************************/
137inline
139{
140 return (m_radius.value());
141}
142
143
144/***********************************************************************//**
145 * @brief Set ring inner radius
146 *
147 * @param[in] radius Ring inner radius (degrees).
148 *
149 * Sets the inner radius of the ring in degrees.
150 ***************************************************************************/
151inline
152void GModelSpatialRadialRing::radius(const double& radius)
153{
155 return;
156}
157
158
159/***********************************************************************//**
160 * @brief Return ring width
161 *
162 * @return Ring width (degrees).
163 *
164 * Returns the width of the ring in degrees.
165 ***************************************************************************/
166inline
168{
169 return (m_width.value());
170}
171
172
173/***********************************************************************//**
174 * @brief Set ring width
175 *
176 * @param[in] width Ring width (degrees).
177 *
178 * Sets the width of the ring in degrees.
179 ***************************************************************************/
180inline
181void GModelSpatialRadialRing::width(const double& width)
182{
184 return;
185}
186
187#endif /* GMODELSPATIALRADIALRING_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
virtual ~GModelSpatialRadialRing(void)
Destructor.
virtual GModelSpatialRadialRing * clone(void) const
Clone radial ring model.
GModelSpatialRadialRing(void)
Void constructor.
virtual void clear(void)
Clear radial ring model.
virtual std::string classname(void) const
Return class name.
virtual double theta_max(void) const
Return maximum model radius (in radians)
virtual std::string print(const GChatter &chatter=NORMAL) const
Print information.
virtual void read(const GXmlElement &xml)
Read model from XML element.
virtual GModelSpatialRadialRing & operator=(const GModelSpatialRadialRing &model)
Assignment operator.
GModelPar m_radius
Ring inner radius (degrees)
virtual void set_region(void) const
Set boundary sky region.
virtual void write(GXmlElement &xml) const
Write model into XML element.
double width(void) const
Return ring width.
double m_cos_outer_radius_rad
Cosine of outer radius in radians.
virtual bool contains(const GSkyDir &dir, const double &margin=0.0) const
Checks whether model contains specified sky direction.
double m_last_width
Last ring width.
double m_outer_radius_rad
Outer radius in radians.
virtual double theta_min(void) const
Return minimum model radius (in radians)
virtual GSkyDir mc(const GEnergy &energy, const GTime &time, GRan &ran) const
Return MC sky direction.
void free_members(void)
Delete class members.
void update(void) const
Update precomputation cache.
void copy_members(const GModelSpatialRadialRing &model)
Copy class members.
double m_cos_inner_radius_rad
Cosine of inner radius in radians.
double radius(void) const
Return ring inner radius.
virtual double eval(const double &theta, const GEnergy &energy, const GTime &time, const bool &gradients=false) const
Evaluate function (in units of sr^-1)
double m_inner_radius_rad
Inner radius in radians.
GModelPar m_width
Ring width (degrees)
double m_last_radius
Last ring radius.
void init_members(void)
Initialise class members.
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.