GammaLib 2.0.0
Loading...
Searching...
No Matches
GModelSpatialRadialGauss.hpp
Go to the documentation of this file.
1/***************************************************************************
2 * GModelSpatialRadialGauss.hpp - Radial Gaussian source model class *
3 * ----------------------------------------------------------------------- *
4 * copyright (C) 2011-2022 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 GModelSpatialRadialGauss.hpp
23 * @brief Radial Gaussian model class interface definition
24 * @author Juergen Knoedlseder
25 */
26
27#ifndef GMODELSPATIALRADIALGAUSS_HPP
28#define GMODELSPATIALRADIALGAUSS_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 GModelSpatialRadialGauss
47 *
48 * @brief Radial Gaussian model class
49 *
50 * This class implements the spatial component of the factorised source
51 * model for a Gaussian source.
52 ***************************************************************************/
54
55public:
56 // Constructors and destructors
58 GModelSpatialRadialGauss(const bool& dummy, const std::string& type);
60 const double& sigma,
61 const std::string& coordsys = "CEL");
62 explicit GModelSpatialRadialGauss(const GXmlElement& xml);
64 virtual ~GModelSpatialRadialGauss(void);
65
66 // Operators
68
69 // Implemented pure virtual methods
70 virtual void clear(void);
71 virtual GModelSpatialRadialGauss* clone(void) const;
72 virtual std::string classname(void) const;
73 virtual double eval(const double& theta,
74 const GEnergy& energy,
75 const GTime& time,
76 const bool& gradients = false) const;
77 virtual GSkyDir mc(const GEnergy& energy,
78 const GTime& time,
79 GRan& ran) const;
80 virtual bool contains(const GSkyDir& dir,
81 const double& margin = 0.0) const;
82 virtual double theta_max(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 sigma(void) const;
89 void sigma(const double& sigma);
90
91protected:
92 // Protected methods
93 void init_members(void);
94 void copy_members(const GModelSpatialRadialGauss& model);
95 void free_members(void);
96 void update(const bool& gradients) const;
97 virtual void set_region(void) const;
98
99 // Protected members
100 GModelPar m_sigma; //!< Gaussian width (deg)
101
102 // Cached members used for pre-computations
103 mutable double m_last_sigma; //!< Last Gaussian sigma
104 mutable double m_inv_sigma2_rad; //!< sigma(rad)^-2
105 mutable double m_value_norm; //!< (2pi sigma(rad))^-2
106 mutable double m_g_theta_norm; //!< sigma(rad)^-2 deg2rad
107 mutable double m_g_sigma_norm; //!< sigma(rad)^-1 sigma_scale deg2rad
108};
109
110
111/***********************************************************************//**
112 * @brief Return class name
113 *
114 * @return String containing the class name ("GModelSpatialRadialGauss").
115 ***************************************************************************/
116inline
118{
119 return ("GModelSpatialRadialGauss");
120}
121
122
123/***********************************************************************//**
124 * @brief Return Gaussian sigma
125 *
126 * @return Gaussian sigma (degrees).
127 *
128 * Returns the Gaussian sigma in degrees.
129 ***************************************************************************/
130inline
132{
133 return (m_sigma.value());
134}
135
136
137/***********************************************************************//**
138 * @brief Set Gaussian sigma
139 *
140 * @param[in] sigma Gaussian sigma (degrees).
141 *
142 * Sets the Gaussian sigma in degrees.
143 ***************************************************************************/
144inline
145void GModelSpatialRadialGauss::sigma(const double& sigma)
146{
148 return;
149}
150
151#endif /* GMODELSPATIALRADIALGAUSS_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
Radial Gaussian model class.
void update(const bool &gradients) const
Update precomputation cache.
GModelSpatialRadialGauss(void)
Void constructor.
double m_value_norm
(2pi sigma(rad))^-2
virtual void read(const GXmlElement &xml)
Read model from XML element.
double m_last_sigma
Last Gaussian sigma.
double sigma(void) const
Return Gaussian sigma.
virtual GSkyDir mc(const GEnergy &energy, const GTime &time, GRan &ran) const
Returns MC sky direction.
virtual GModelSpatialRadialGauss & operator=(const GModelSpatialRadialGauss &model)
Assignment operator.
virtual void write(GXmlElement &xml) const
Write model into XML element.
virtual void clear(void)
Clear radial Gauss model.
virtual std::string classname(void) const
Return class name.
virtual bool contains(const GSkyDir &dir, const double &margin=0.0) const
Checks where model contains specified sky direction.
double m_g_sigma_norm
sigma(rad)^-1 sigma_scale deg2rad
virtual double theta_max(void) const
Return maximum model radius (in radians)
virtual std::string print(const GChatter &chatter=NORMAL) const
Print Gaussian source information.
GModelPar m_sigma
Gaussian width (deg)
virtual void set_region(void) const
Set boundary sky region.
void copy_members(const GModelSpatialRadialGauss &model)
Copy class members.
virtual ~GModelSpatialRadialGauss(void)
Destructor.
void init_members(void)
Initialise class members.
virtual double eval(const double &theta, const GEnergy &energy, const GTime &time, const bool &gradients=false) const
Evaluate Gaussian source model.
double m_g_theta_norm
sigma(rad)^-2 deg2rad
virtual GModelSpatialRadialGauss * clone(void) const
Clone radial Gauss model.
void free_members(void)
Delete 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.
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.