GammaLib  1.7.0.dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GModelSpatialRadialGauss.hpp
Go to the documentation of this file.
1 /***************************************************************************
2  * GModelSpatialRadialGauss.hpp - Radial Gaussian source model class *
3  * ----------------------------------------------------------------------- *
4  * copyright (C) 2011-2016 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>
32 #include "GModelSpatialRadial.hpp"
33 #include "GModelPar.hpp"
34 #include "GSkyDir.hpp"
35 #include "GSkyRegionCircle.hpp"
36 #include "GEnergy.hpp"
37 #include "GTime.hpp"
38 #include "GXmlElement.hpp"
39 
40 
41 /***********************************************************************//**
42  * @class GModelSpatialRadialGauss
43  *
44  * @brief Radial Gaussian model class
45  *
46  * This class implements the spatial component of the factorised source
47  * model for a Gaussian source.
48  ***************************************************************************/
50 
51 public:
52  // Constructors and destructors
54  GModelSpatialRadialGauss(const bool& dummy, const std::string& type);
55  GModelSpatialRadialGauss(const GSkyDir& dir, const double& sigma);
56  explicit GModelSpatialRadialGauss(const GXmlElement& xml);
58  virtual ~GModelSpatialRadialGauss(void);
59 
60  // Operators
62 
63  // Implemented pure virtual methods
64  virtual void clear(void);
65  virtual GModelSpatialRadialGauss* clone(void) const;
66  virtual std::string classname(void) const;
67  virtual std::string type(void) const;
68  virtual double eval(const double& theta,
69  const GEnergy& energy,
70  const GTime& time,
71  const bool& gradients = false) const;
72  virtual GSkyDir mc(const GEnergy& energy,
73  const GTime& time,
74  GRan& ran) const;
75  virtual bool contains(const GSkyDir& dir,
76  const double& margin = 0.0) const;
77  virtual double theta_max(void) const;
78  virtual GSkyRegion* region(void) const;
79  virtual void read(const GXmlElement& xml);
80  virtual void write(GXmlElement& xml) const;
81  virtual std::string print(const GChatter& chatter = NORMAL) const;
82 
83  // Other methods
84  double sigma(void) const;
85  void sigma(const double& sigma);
86 
87 protected:
88  // Protected methods
89  void init_members(void);
90  void copy_members(const GModelSpatialRadialGauss& model);
91  void free_members(void);
92  void set_region(void) const;
93 
94  // Protected members
95  std::string m_type; //!< Model type
96  GModelPar m_sigma; //!< Gaussian width (deg)
97  mutable GSkyRegionCircle m_region; //!< Bounding circle
98 };
99 
100 
101 /***********************************************************************//**
102  * @brief Return class name
103  *
104  * @return String containing the class name ("GModelSpatialRadialGauss").
105  ***************************************************************************/
106 inline
107 std::string GModelSpatialRadialGauss::classname(void) const
108 {
109  return ("GModelSpatialRadialGauss");
110 }
111 
112 
113 /***********************************************************************//**
114  * @brief Return model type
115  *
116  * @return Model type.
117  *
118  * Returns the type of the radial Gauss model.
119  ***************************************************************************/
120 inline
121 std::string GModelSpatialRadialGauss::type(void) const
122 {
123  return (m_type);
124 }
125 
126 
127 /***********************************************************************//**
128  * @brief Return Gaussian sigma
129  *
130  * @return Gaussian sigma (degrees).
131  *
132  * Returns the Gaussian sigma in degrees.
133  ***************************************************************************/
134 inline
136 {
137  return (m_sigma.value());
138 }
139 
140 
141 /***********************************************************************//**
142  * @brief Set Gaussian sigma
143  *
144  * @param[in] sigma Gaussian sigma (degrees).
145  *
146  * Sets the Gaussian sigma in degrees.
147  ***************************************************************************/
148 inline
149 void GModelSpatialRadialGauss::sigma(const double& sigma)
150 {
151  m_sigma.value(sigma);
152  return;
153 }
154 
155 
156 /***********************************************************************//**
157  * @brief Return boundary sky region
158  *
159  * @return Boundary sky region.
160  *
161  * Returns a sky region that fully encloses the spatial model component.
162  ***************************************************************************/
163 inline
165 {
166  set_region();
167  return (&m_region);
168 }
169 
170 #endif /* GMODELSPATIALRADIALGAUSS_HPP */
virtual GSkyRegion * region(void) const
Return boundary sky region.
double sigma(void) const
Return Gaussian sigma.
Energy value class definition.
XML element node class interface definition.
virtual double theta_max(void) const
Return maximum model radius (in radians)
Sky direction class interface definition.
Abstract radial spatial model base class interface definition.
XML element node class.
Definition: GXmlElement.hpp:47
Random number generator class.
Definition: GRan.hpp:44
Time class.
Definition: GTime.hpp:54
Interface for the circular sky region class.
virtual void write(GXmlElement &xml) const
Write model into XML element.
GModelPar m_sigma
Gaussian width (deg)
void copy_members(const GModelSpatialRadialGauss &model)
Copy class members.
virtual GModelSpatialRadialGauss * clone(void) const
Clone radial Gauss model.
Model parameter class interface definition.
Model parameter class.
Definition: GModelPar.hpp:87
virtual GSkyDir mc(const GEnergy &energy, const GTime &time, GRan &ran) const
Returns MC sky direction.
virtual std::string type(void) const
Return model type.
Abstract interface for the sky region class.
Definition: GSkyRegion.hpp:57
GModelSpatialRadialGauss(void)
Void constructor.
GSkyRegionCircle m_region
Bounding circle.
virtual void read(const GXmlElement &xml)
Read model from XML element.
GChatter
Definition: GTypemaps.hpp:33
void set_region(void) const
Set boundary sky region.
virtual double eval(const double &theta, const GEnergy &energy, const GTime &time, const bool &gradients=false) const
Evaluate function.
std::string m_type
Model type.
virtual std::string classname(void) const
Return class name.
GSkyDir dir(void) const
Return position of radial spatial model.
void init_members(void)
Initialise class members.
double value(void) const
Return parameter value.
virtual GModelSpatialRadialGauss & operator=(const GModelSpatialRadialGauss &model)
Assignment operator.
Abstract radial spatial model base class.
void free_members(void)
Delete class members.
virtual bool contains(const GSkyDir &dir, const double &margin=0.0) const
Checks where model contains specified sky direction.
Radial Gaussian model class.
Sky direction class.
Definition: GSkyDir.hpp:62
virtual void clear(void)
Clear radial Gauss model.
Time class interface definition.
Circular sky region class interface definition.
virtual std::string print(const GChatter &chatter=NORMAL) const
Print Gaussian source information.
Class that handles energies in a unit independent way.
Definition: GEnergy.hpp:48
virtual ~GModelSpatialRadialGauss(void)
Destructor.