GammaLib 2.0.0
Loading...
Searching...
No Matches
GModelSpatialRadialShell.hpp
Go to the documentation of this file.
1/***************************************************************************
2 * GModelSpatialRadialShell.hpp - Radial shell source model class *
3 * ----------------------------------------------------------------------- *
4 * copyright (C) 2011-2022 by Christoph Deil *
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 GModelSpatialRadialShell.hpp
23 * @brief Radial shell model class interface definition
24 * @author Christoph Deil
25 */
26
27#ifndef GMODELSPATIALRADIALSHELL_HPP
28#define GMODELSPATIALRADIALSHELL_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 GModelSpatialRadialShell
47 *
48 * @brief Shell source model class
49 *
50 * This class implements the spatial component of the factorised source
51 * model for a shell source (can be used e.g. as a toy supernova remnant
52 * model). The shell is simply the volume between an inner and outer radius
53 * (a large sphere with a smaller sphere cut out) with constant volume
54 * emissivity and no absorption. To determine the surface brightness
55 * distribution on the sky, the shell is analytically integrated along lines
56 * of sight.
57 * The shell is parametrised by the inner shell radius and the shell width.
58 * Obviously, the shell width has to be a positive quantity. To assure
59 * positivity, 1 arcsec is added internally to the shell width. This should
60 * be negligible compared to shell widths encountered (and detectable) in
61 * the gamma-ray domain, and improves the convergence of the fitting
62 * algorithms.
63 ***************************************************************************/
65
66public:
67 // Constructors and destructors
69 GModelSpatialRadialShell(const bool& dummy, const std::string& type);
71 const double& radius,
72 const double& width,
73 const std::string& coordsys = "CEL");
74 explicit GModelSpatialRadialShell(const GXmlElement& xml);
76 virtual ~GModelSpatialRadialShell(void);
77
78 // Operators
80
81 // Implemented pure virtual methods
82 virtual void clear(void);
83 virtual GModelSpatialRadialShell* clone(void) const;
84 virtual std::string classname(void) const;
85 virtual double eval(const double& theta,
86 const GEnergy& energy,
87 const GTime& time,
88 const bool& gradients = false) const;
89 virtual GSkyDir mc(const GEnergy& energy,
90 const GTime& time,
91 GRan& ran) const;
92 virtual bool contains(const GSkyDir& dir,
93 const double& margin = 0.0) const;
94 virtual double theta_max(void) const;
95 virtual void read(const GXmlElement& xml);
96 virtual void write(GXmlElement& xml) const;
97 virtual std::string print(const GChatter& chatter = NORMAL) const;
98
99 // Other methods
100 double radius(void) const;
101 double width(void) const;
102 void radius(const double& radius);
103 void width(const double& width);
104
105protected:
106 // Protected methods
107 void init_members(void);
108 void copy_members(const GModelSpatialRadialShell& model);
109 void free_members(void);
110 void update(void) const;
111 static double f1(double x);
112 static double f2(double x);
113 virtual void set_region(void) const;
114
115 // Protected members
116 GModelPar m_radius; //!< Inner shell radius (deg)
117 GModelPar m_width; //!< Shell thickness (deg)
118
119 // Cached members used for pre-computations
120 mutable double m_last_radius; //!< Last shell radius (deg)
121 mutable double m_last_width; //!< Last shell width (deg)
122 mutable double m_theta_in; //!< Inner shell radius (rad)
123 mutable double m_x_in; //!< sin(m_theta_in)^2
124 mutable double m_theta_out; //!< Outer shell radius (rad)
125 mutable double m_x_out; //!< sin(m_theta_out)^2
126 mutable double m_norm; //!< Shell normalization
127};
128
129
130/***********************************************************************//**
131 * @brief Return class name
132 *
133 * @return String containing the class name ("GModelSpatialRadialShell").
134 ***************************************************************************/
135inline
137{
138 return ("GModelSpatialRadialShell");
139}
140
141
142/***********************************************************************//**
143 * @brief Return shell radius
144 *
145 * @return Shell radius (degrees).
146 *
147 * Returns the shell radius in degrees.
148 ***************************************************************************/
149inline
151{
152 return (m_radius.value());
153}
154
155
156/***********************************************************************//**
157 * @brief Set shell radius
158 *
159 * @param[in] radius Shell radius (degrees).
160 *
161 * Sets the shell radius in degrees.
162 ***************************************************************************/
163inline
164void GModelSpatialRadialShell::radius(const double& radius)
165{
167 return;
168}
169
170
171/***********************************************************************//**
172 * @brief Return shell width
173 *
174 * @return Shell width (degrees).
175 *
176 * Returns the shell width in degrees.
177 ***************************************************************************/
178inline
180{
181 return (m_width.value());
182}
183
184
185/***********************************************************************//**
186 * @brief Set width radius
187 *
188 * @param[in] width Shell width (degrees).
189 *
190 * Sets the shell width in degrees.
191 ***************************************************************************/
192inline
193void GModelSpatialRadialShell::width(const double& width)
194{
196 return;
197}
198
199#endif /* GMODELSPATIALRADIALSHELL_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
double radius(void) const
Return shell radius.
void copy_members(const GModelSpatialRadialShell &model)
Copy class members.
virtual GModelSpatialRadialShell * clone(void) const
Clone radial shell model.
virtual std::string print(const GChatter &chatter=NORMAL) const
Print information.
void free_members(void)
Delete class members.
double m_last_radius
Last shell radius (deg)
void update(void) const
Update precomputation cache.
virtual std::string classname(void) const
Return class name.
double m_last_width
Last shell width (deg)
virtual ~GModelSpatialRadialShell(void)
Destructor.
GModelPar m_width
Shell thickness (deg)
static double f1(double x)
Return function 1 value needed for precomputation.
void init_members(void)
Initialise class members.
virtual void set_region(void) const
Set boundary sky region.
GModelPar m_radius
Inner shell radius (deg)
virtual double eval(const double &theta, const GEnergy &energy, const GTime &time, const bool &gradients=false) const
Evaluate function (in units of sr^-1)
virtual void clear(void)
Clear radial shell model.
double m_norm
Shell normalization.
virtual GSkyDir mc(const GEnergy &energy, const GTime &time, GRan &ran) const
Returns MC sky direction.
virtual double theta_max(void) const
Return maximum model radius (in radians)
double width(void) const
Return shell width.
double m_theta_in
Inner shell radius (rad)
virtual bool contains(const GSkyDir &dir, const double &margin=0.0) const
Checks where model contains specified sky direction.
virtual GModelSpatialRadialShell & operator=(const GModelSpatialRadialShell &model)
Assignment operator.
virtual void write(GXmlElement &xml) const
Write model into XML element.
GModelSpatialRadialShell(void)
Void constructor.
double m_theta_out
Outer shell radius (rad)
virtual void read(const GXmlElement &xml)
Read model from XML element.
static double f2(double x)
Return function 2 value needed for precomputation.
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.
std::string type(void) const
Return model type.
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.