GammaLib 2.0.0
Loading...
Searching...
No Matches
GModelSpatialEllipticalGauss.hpp
Go to the documentation of this file.
1/***************************************************************************
2 * GModelSpatialEllipticalGauss.hpp - Elliptical gauss source model class *
3 * ----------------------------------------------------------------------- *
4 * copyright (C) 2015-2022 by Michael Mayer *
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 GModelSpatialEllipticalGauss.hpp
23 * @brief Elliptical gauss model class interface definition
24 * @author Michael Mayer
25 */
26
27#ifndef GMODELSPATIALELLIPTICALGAUSS_HPP
28#define GMODELSPATIALELLIPTICALGAUSS_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 GModelSpatialEllipticalGauss
47 *
48 * @brief Elliptical gauss source model class
49 *
50 * This class implements the spatial component of the factorised source
51 * model for an elliptical gauss source, i.e. constant surface brightness
52 * according to an asymmetric Gaussian.
53 ***************************************************************************/
55
56public:
57 // Constructors and destructors
59 GModelSpatialEllipticalGauss(const bool& dummy, const std::string& type);
61 const double& major,
62 const double& minor,
63 const double& posangle,
64 const std::string& coordsys = "CEL");
65 explicit GModelSpatialEllipticalGauss(const GXmlElement& xml);
68
69 // Operators
71
72 // Implemented pure virtual base class methods
73 virtual void clear(void);
74 virtual GModelSpatialEllipticalGauss* clone(void) const;
75 virtual std::string classname(void) const;
76 virtual double eval(const double& theta,
77 const double& posangle,
78 const GEnergy& energy,
79 const GTime& time,
80 const bool& gradients = false) const;
81 virtual GSkyDir mc(const GEnergy& energy,
82 const GTime& time,
83 GRan& ran) const;
84 virtual bool contains(const GSkyDir& dir,
85 const double& margin = 0.0) const;
86 virtual double theta_max(void) const;
87 virtual void read(const GXmlElement& xml);
88 virtual void write(GXmlElement& xml) const;
89 virtual std::string print(const GChatter& chatter = NORMAL) const;
90
91
92protected:
93 // Protected methods
94 void init_members(void);
96 void free_members(void);
97 void update(void) const;
98 virtual void set_region(void) const;
99
100 // Protected members
101
102 // Cached members used for pre-computations
103 mutable double m_last_minor; //!< Last semi-minor axis
104 mutable double m_last_major; //!< Last semi-major axis
105 mutable double m_last_posangle; //!< Last position angle
106 mutable double m_cospos2; //!< squared cosine of position angle
107 mutable double m_sinpos2; //!< squared sine of position angle
108 mutable double m_sin2pos; //!< sine of twice the position angle
109 mutable double m_minor2; //!< square of minor axis
110 mutable double m_major2; //!< square of major axis
111 mutable double m_minor_rad; //!< Minor axis in radians
112 mutable double m_major_rad; //!< Major axis in radians
113 mutable double m_norm; //!< Normalization
114 mutable double m_term1; //!< Help term 1
115 mutable double m_term2; //!< Help term 2
116 mutable double m_term3; //!< Help term 3
117
118};
119
120
121/***********************************************************************//**
122 * @brief Return class name
123 *
124 * @return String containing the class name ("GModelSpatialEllipticalGauss").
125 ***************************************************************************/
126inline
128{
129 return ("GModelSpatialEllipticalGauss");
130}
131
132#endif /* GMODELSPATIALELLIPTICALGAUSS_HPP */
Model parameter class interface definition.
Abstract elliptical 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
virtual std::string classname(void) const
Return class name.
virtual void set_region(void) const
Set boundary sky region.
virtual GModelSpatialEllipticalGauss * clone(void) const
Clone elliptical Gaussian model.
virtual double eval(const double &theta, const double &posangle, const GEnergy &energy, const GTime &time, const bool &gradients=false) const
Evaluate function (in units of sr^-1)
virtual void read(const GXmlElement &xml)
Read model from XML element.
void copy_members(const GModelSpatialEllipticalGauss &model)
Copy class members.
void free_members(void)
Delete class members.
void init_members(void)
Initialise class members.
virtual GModelSpatialEllipticalGauss & operator=(const GModelSpatialEllipticalGauss &model)
Assignment operator.
virtual void write(GXmlElement &xml) const
Write model into XML element.
virtual ~GModelSpatialEllipticalGauss(void)
Destructor.
virtual void clear(void)
Clear elliptical Gaussian model.
void update(void) const
Update precomputation cache.
virtual bool contains(const GSkyDir &dir, const double &margin=0.0) const
Checks whether model contains specified sky direction.
virtual double theta_max(void) const
Return maximum model radius (in radians)
virtual GSkyDir mc(const GEnergy &energy, const GTime &time, GRan &ran) const
Returns MC sky direction.
GModelSpatialEllipticalGauss(void)
Void constructor.
double m_sin2pos
sine of twice the position angle
double m_cospos2
squared cosine of position angle
virtual std::string print(const GChatter &chatter=NORMAL) const
Print information.
double m_sinpos2
squared sine of position angle
Abstract elliptical spatial model base class.
double posangle(void) const
Return Position Angle of model.
const GSkyDir & dir(void) const
Return position of elliptical spatial model.
std::string coordsys(void) const
Return coordinate system.
std::string type(void) const
Return model type.
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.