GammaLib  1.7.0.dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GModelSpatialRadialProfileDMZhao.hpp
Go to the documentation of this file.
1 /***************************************************************************
2  * GModelSpatialRadialProfileDMZhao.hpp - DM Zhao profile class *
3  * ----------------------------------------------------------------------- *
4  * copyright (C) 2016-2017 by Nathan Kelley-Hoskins *
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 GModelSpatialRadialProfileDMZhao.hpp
23  * @brief Dark Matter Zhao profile model class interface definition
24  * @author Nathan Kelley-Hoskins
25  */
26 
27 #ifndef GMODELSPATIALRADIALPROFILEDMZHAO_HPP
28 #define GMODELSPATIALRADIALPROFILEDMZHAO_HPP
29 
30 /* __ Includes ___________________________________________________________ */
31 #include <string>
33 #include "GModelPar.hpp"
34 #include "GFunction.hpp"
35 #include "GIntegral.hpp"
36 
37 /* __ Forward declaration ________________________________________________ */
38 class GXmlElement;
39 
40 
41 /**************************************************************************
42  * @class GModelSpatialRadialProfileDMZhao
43  *
44  * @brief Radial Dark Matter Zhao profile source model class
45  *
46  * This class implements the spatial component of the factorised source
47  * model for a radial Dark Matter profile, using an Zhao density halo.
48  ***************************************************************************/
50 
51 public:
52  // Constructors and destructors
54  explicit GModelSpatialRadialProfileDMZhao(const GXmlElement& xml);
57 
58  // Operators
60 
61  // Implemented pure virtual base class methods
62  virtual void clear(void);
63  virtual GModelSpatialRadialProfileDMZhao* clone(void) const;
64  virtual std::string classname(void) const;
65  virtual std::string type(void) const;
66  virtual double theta_min(void) const;
67  virtual double theta_max(void) const;
68  virtual void read(const GXmlElement& xml);
69  virtual void write(GXmlElement& xml) const;
70  virtual std::string print(const GChatter& chatter = NORMAL) const;
71 
72  // Other methods
73  double scale_radius(void) const;
74  void scale_radius(const double& scale_radius);
75  double scale_density(void) const;
76  void scale_density(const double& scale_density);
77  double halo_distance(void) const;
78  void halo_distance(const double& halo_distance);
79  double alpha(void) const;
80  void alpha(const double& alpha);
81  double beta(void) const;
82  void beta(const double& beta);
83  double gamma(void) const;
84  void gamma(const double& gamma);
85  double mass_density(const double& radius) const;
86  double jfactor(const double& angle) const;
87 
88 protected:
89  // Protected methods
90  void init_members(void);
92  void free_members(void);
93  void update(void) const;
94  virtual double profile_value(const double& theta) const;
95 
96  // Integration kernel for line-of-sight integral
97  class halo_kernel_los : public GFunction {
98  public :
99  halo_kernel_los(const double& scale_radius,
100  const double& halo_distance,
101  const double& alpha,
102  const double& beta,
103  const double& gamma,
104  const double& theta,
105  const double& core_radius) :
106  m_scale_radius(scale_radius),
107  m_halo_distance(halo_distance),
108  m_alpha(alpha),
109  m_beta(beta),
110  m_gamma(gamma),
111  m_theta(theta),
112  m_core_radius(core_radius) {}
113  double eval(const double& los);
114  protected :
117  double m_alpha;
118  double m_beta;
119  double m_gamma;
120  double m_theta;
122  } ;
123 
124  // Protected members
125  GModelPar m_theta_min; //!< Minimum theta angle
126  GModelPar m_theta_max; //!< Maximum theta angle
127  GModelPar m_scale_radius; //!< Scale radius of halo profile
128  GModelPar m_scale_density; //!< Scale density of halo profile
129  GModelPar m_halo_distance; //!< Distance from earth to halo center
130  GModelPar m_alpha; //!< Power index, inverse transition region width
131  GModelPar m_beta; //!< Power index, slope at >> m_scale_radius
132  GModelPar m_gamma; //!< Power index, slope at << m_scale_radius
133  GModelPar m_core_radius; //!< Core radius
134 
135  // Protected cached members
136  mutable double m_last_scale_radius;
137  mutable double m_last_scale_density;
138  mutable double m_mass_radius;
139  mutable double m_scale_density_squared;
140 };
141 
142 
143 /***********************************************************************//**
144  * @brief Return class name
145  *
146  * @return String containing the class name ("GModelSpatialRadialProfileDMZhao").
147  ***************************************************************************/
148 inline
150 {
151  return ("GModelSpatialRadialProfileDMZhao");
152 }
153 
154 
155 /***********************************************************************//**
156  * @brief Return model type
157  *
158  * @return "DMZhaoProfile".
159  *
160  * Returns the type of the radial profile model.
161  ***************************************************************************/
162 inline
164 {
165  return "DMZhaoProfile";
166 }
167 
168 /***********************************************************************//**
169  * @brief Return scale radius
170  *
171  * @return Scale radius (kpc).
172  *
173  * Returns the scale radius of the halo profile in kpc.
174  ***************************************************************************/
175 inline
177 {
178  return (m_scale_radius.value());
179 }
180 
181 /***********************************************************************//**
182  * @brief Set scale radius
183  *
184  * @param[in] radius Scale radius (kpc).
185  *
186  * Sets the scale radius of the halo profile in kpc.
187  ***************************************************************************/
188 inline
190 {
191  m_scale_radius.value(radius);
192  return;
193 }
194 
195 /***********************************************************************//**
196  * @brief Return scale density
197  *
198  * @return Scale density (GeV/cm^3).
199  *
200  * Returns the scale density (mass/volume density at the scale radius) of
201  * the halo profile in GeV/cm^3.
202  ***************************************************************************/
203 inline
205 {
206  return (m_scale_density.value());
207 }
208 
209 /***********************************************************************//**
210  * @brief Set scale density
211  *
212  * @param[in] density Scale density (GeV/cm^3).
213  *
214  * Sets the scale density (mass/volume density at the scale radius) of the
215  * halo profile in GeV/cm^3.
216  ***************************************************************************/
217 inline
219 {
220  m_scale_density.value(density);
221  return;
222 }
223 
224 /***********************************************************************//**
225  * @brief Return halo distance
226  *
227  * @return Halo distance (kpc).
228  *
229  * Returns the distance to the halo center in kpc.
230  ***************************************************************************/
231 inline
233 {
234  return (m_halo_distance.value());
235 }
236 
237 /***********************************************************************//**
238  * @brief Set halo distance
239  *
240  * @param[in] distance Halo distance (kpc).
241  *
242  * Sets the distance between the observer and the halo center in kpc.
243  ***************************************************************************/
244 inline
246 {
247  m_halo_distance.value(distance);
248  return;
249 }
250 
251 /***********************************************************************//**
252  * @brief Return Zhao alpha power index
253  *
254  * @return alpha (unitless).
255  *
256  * Returns the alpha power index in the Zhao halo density function
257  ***************************************************************************/
258 inline
260 {
261  return (m_alpha.value());
262 }
263 
264 /***********************************************************************//**
265  * @brief Set Zhao alpha power index
266  *
267  * @param[in] alpha (unitless).
268  *
269  * Sets the Zhao profile alpha power index.
270  ***************************************************************************/
271 inline
273 {
274  m_alpha.value(alpha);
275  return;
276 }
277 
278 /***********************************************************************//**
279  * @brief Return Zhao beta power index
280  *
281  * @return beta (unitless).
282  *
283  * Returns the beta power index in the Zhao halo density function
284  ***************************************************************************/
285 inline
287 {
288  return (m_beta.value());
289 }
290 
291 /***********************************************************************//**
292  * @brief Set Zhao beta power index
293  *
294  * @param[in] beta (unitless).
295  *
296  * Sets the Zhao profile beta power index.
297  ***************************************************************************/
298 inline
300 {
301  m_beta.value(beta);
302  return;
303 }
304 
305 /***********************************************************************//**
306  * @brief Return Zhao gamma power index
307  *
308  * @return gamma (unitless).
309  *
310  * Returns the gamma power index in the Zhao halo density function
311  ***************************************************************************/
312 inline
314 {
315  return (m_gamma.value());
316 }
317 
318 /***********************************************************************//**
319  * @brief Set Zhao gamma power index
320  *
321  * @param[in] gamma (unitless).
322  *
323  * Sets the Zhao profile gamma power index.
324  ***************************************************************************/
325 inline
327 {
328  m_gamma.value(gamma);
329  return;
330 }
331 
332 #endif /* GMODELSPATIALRADIALPROFILEDMZHAO_HPP */
virtual double theta_min(void) const
Return minimum model radius (in radians)
double scale_radius(void) const
Return scale radius.
GModelPar m_alpha
Power index, inverse transition region width.
GModelPar m_beta
Power index, slope at &gt;&gt; m_scale_radius.
GModelPar m_gamma
Power index, slope at &lt;&lt; m_scale_radius.
virtual void read(const GXmlElement &xml)
Read model from XML element.
virtual GModelSpatialRadialProfileDMZhao * clone(void) const
Clone radial DMZhao profile model.
GModelPar m_scale_radius
Scale radius of halo profile.
XML element node class.
Definition: GXmlElement.hpp:47
virtual void clear(void)
Clear radial DMZhao profile model.
double gamma(void) const
Return Zhao gamma power index.
Radial profile model class interface definition.
double halo_distance(void) const
Return halo distance.
virtual void write(GXmlElement &xml) const
Write model into XML element.
virtual std::string type(void) const
Return model type.
Model parameter class interface definition.
Model parameter class.
Definition: GModelPar.hpp:87
double beta(void) const
Return Zhao beta power index.
Single parameter function abstract base class definition.
double mass_density(const double &radius) const
Calculate Halo Mass Density.
halo_kernel_los(const double &scale_radius, const double &halo_distance, const double &alpha, const double &beta, const double &gamma, const double &theta, const double &core_radius)
virtual GModelSpatialRadialProfileDMZhao & operator=(const GModelSpatialRadialProfileDMZhao &model)
Assignment operator.
GChatter
Definition: GTypemaps.hpp:33
virtual double profile_value(const double &theta) const
Radial profile.
double alpha(void) const
Return Zhao alpha power index.
void copy_members(const GModelSpatialRadialProfileDMZhao &model)
Copy class members.
void init_members(void)
Initialise class members.
void update(void) const
Update precomputation cache.
GModelPar m_scale_density
Scale density of halo profile.
virtual std::string classname(void) const
Return class name.
GModelPar m_halo_distance
Distance from earth to halo center.
double jfactor(const double &angle) const
Calculate J-factor.
double value(void) const
Return parameter value.
Single parameter function abstract base class.
Definition: GFunction.hpp:44
double scale_density(void) const
Return scale density.
virtual double theta_max(void) const
Return maximum model radius (in radians)
Integration class interface definition.
double eval(const double &los)
Kernel for zhao halo density profile squared.
virtual std::string print(const GChatter &chatter=NORMAL) const
Print information.