GammaLib  2.0.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GModelSpatialRadialProfileDMBurkert.hpp
Go to the documentation of this file.
1 /***************************************************************************
2  * GModelSpatialRadialProfileDMBurkert.hpp - DM Burkert profile class *
3  * ----------------------------------------------------------------------- *
4  * copyright (C) 2016-2020 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 GModelSpatialRadialProfileDMBurkert.hpp
23  * @brief Dark Matter Burkert profile model class interface definition
24  * @author Nathan Kelley-Hoskins
25  */
26 
27 #ifndef GMODELSPATIALRADIALPROFILEDMBURKERT_HPP
28 #define GMODELSPATIALRADIALPROFILEDMBURKERT_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 GModelSpatialRadialProfileDMBurkert
43  *
44  * @brief Radial Dark Matter Burkert 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 Burkert density halo.
48  ***************************************************************************/
50 
51 public:
52  // Constructors and destructors
57 
58  // Operators
60 
61  // Implemented pure virtual base class methods
62  virtual void clear(void);
63  virtual GModelSpatialRadialProfileDMBurkert* clone(void) const;
64  virtual std::string classname(void) const;
65  virtual double theta_min(void) const;
66  virtual double theta_max(void) const;
67  virtual void read(const GXmlElement& xml);
68  virtual void write(GXmlElement& xml) const;
69  virtual std::string print(const GChatter& chatter = NORMAL) const;
70 
71  // Other methods
72  double scale_radius(void) const;
73  void scale_radius(const double& scale_radius);
74  double scale_density(void) const;
75  void scale_density(const double& scale_density);
76  double halo_distance(void) const;
77  void halo_distance(const double& halo_distance);
78  double mass_density(const double& radius ) const;
79  double jfactor(const double& angle) const;
80 
81 protected:
82  // Protected methods
83  void init_members(void);
85  void free_members(void);
86  virtual double profile_value(const double& theta) const;
87  void update(void) const;
88 
89  // Integration kernel for line-of-sight integral
90  class halo_kernel_los : public GFunction {
91  public :
92  halo_kernel_los(const double& scale_radius,
93  const double& halo_distance,
94  const double& theta,
95  const double& core_radius) :
96  m_scale_radius(scale_radius),
97  m_halo_distance(halo_distance),
98  m_theta(theta),
99  m_core_radius(core_radius) {}
100  double eval(const double& los);
101  protected :
104  double m_theta;
106  };
107 
108  // Protected members
109  GModelPar m_theta_min; //!< Minimum theta angle
110  GModelPar m_theta_max; //!< Maximum theta angle
111  GModelPar m_scale_radius; //!< Scale radius of halo profile
112  GModelPar m_scale_density; //!< Scale density of halo profile
113  GModelPar m_halo_distance; //!< Distance from Earth to halo center
114  GModelPar m_core_radius; //!< Core radius
115 
116  // Cached members used for precomputation
117  mutable double m_last_scale_radius;
118  mutable double m_last_scale_density;
119  mutable double m_mass_radius;
120  mutable double m_scale_density_squared;
121 };
122 
123 
124 /***********************************************************************//**
125  * @brief Return class name
126  *
127  * @return String containing the class name ("GModelSpatialRadialProfileDMBurkert").
128  ***************************************************************************/
129 inline
131 {
132  return ("GModelSpatialRadialProfileDMBurkert");
133 }
134 
135 
136 /***********************************************************************//**
137  * @brief Return scale radius
138  *
139  * @return Scale radius (kpc).
140  *
141  * Returns the scale radius of the halo profile in kpc.
142  ***************************************************************************/
143 inline
145 {
146  return (m_scale_radius.value());
147 }
148 
149 
150 /***********************************************************************//**
151  * @brief Set scale radius
152  *
153  * @param[in] radius Scale radius (kpc).
154  *
155  * Sets the scale radius of the halo profile in kpc.
156  ***************************************************************************/
157 inline
159 {
160  m_scale_radius.value(radius);
161  return;
162 }
163 
164 
165 /***********************************************************************//**
166  * @brief Return scale density
167  *
168  * @return Scale density (GeV/cm^3).
169  *
170  * Returns the scale density (mass/volume density at the scale radius) of
171  * the halo profile in GeV/cm^3.
172  ***************************************************************************/
173 inline
175 {
176  return (m_scale_density.value());
177 }
178 
179 
180 /***********************************************************************//**
181  * @brief Set scale density
182  *
183  * @param[in] density Scale density (GeV/cm^3).
184  *
185  * Sets the scale density ( mass/volume density at the scale radius) of the
186  * halo profile in GeV/cm^3.
187  ***************************************************************************/
188 inline
190 {
191  m_scale_density.value(density);
192  return;
193 }
194 
195 
196 /***********************************************************************//**
197  * @brief Return halo distance
198  *
199  * @return Halo distance (kpc).
200  *
201  * Returns the distance to the halo center in kpc.
202  ***************************************************************************/
203 inline
205 {
206  return (m_halo_distance.value());
207 }
208 
209 
210 /***********************************************************************//**
211  * @brief Set halo distance
212  *
213  * @param[in] distance Halo distance (kpc).
214  *
215  * Sets the distance between the observer and the halo center in kpc.
216  ***************************************************************************/
217 inline
219 {
220  m_halo_distance.value(distance);
221  return;
222 }
223 
224 #endif /* GMODELSPATIALRADIALPROFILEDMBURKERT_HPP */
virtual void write(GXmlElement &xml) const
Write model into XML element.
double mass_density(const double &radius) const
Calculate Halo Mass Density.
XML element node class.
Definition: GXmlElement.hpp:48
double scale_radius(void) const
Return scale radius.
virtual std::string print(const GChatter &chatter=NORMAL) const
Print information.
virtual GModelSpatialRadialProfileDMBurkert & operator=(const GModelSpatialRadialProfileDMBurkert &model)
Assignment operator.
GModelPar m_scale_density
Scale density of halo profile.
Radial profile model class interface definition.
Model parameter class interface definition.
Model parameter class.
Definition: GModelPar.hpp:87
virtual double theta_max(void) const
Return maximum model radius (in radians)
Single parameter function abstract base class definition.
GChatter
Definition: GTypemaps.hpp:33
virtual GModelSpatialRadialProfileDMBurkert * clone(void) const
Clone radial DMBurkert profile model.
double angle(const GVector &a, const GVector &b)
Computes angle between vectors.
Definition: GVector.cpp:974
halo_kernel_los(const double &scale_radius, const double &halo_distance, const double &theta, const double &core_radius)
GModelPar m_halo_distance
Distance from Earth to halo center.
double eval(const double &los)
Kernel for halo density profile squared.
double jfactor(const double &angle) const
Calculate J-factor.
void update(void) const
Update precomputation cache.
virtual double theta_min(void) const
Return minimum model radius (in radians)
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 void clear(void)
Clear radial DMBurkert profile model.
virtual std::string classname(void) const
Return class name.
virtual double profile_value(const double &theta) const
Radial profile.
Integration class interface definition.
GModelPar m_scale_radius
Scale radius of halo profile.
void copy_members(const GModelSpatialRadialProfileDMBurkert &model)
Copy class members.
virtual void read(const GXmlElement &xml)
Read model from XML element.
double halo_distance(void) const
Return halo distance.