GammaLib  1.7.0.dev
 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-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 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 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 mass_density(const double& radius ) const;
80  double jfactor(const double& angle) const;
81 
82 protected:
83  // Protected methods
84  void init_members(void);
86  void free_members(void);
87  virtual double profile_value(const double& theta) const;
88  void update(void) const;
89 
90  // Integration kernel for line-of-sight integral
91  class halo_kernel_los : public GFunction {
92  public :
93  halo_kernel_los(const double& scale_radius,
94  const double& halo_distance,
95  const double& theta,
96  const double& core_radius) :
97  m_scale_radius(scale_radius),
98  m_halo_distance(halo_distance),
99  m_theta(theta),
100  m_core_radius(core_radius) {}
101  double eval(const double& los);
102  protected :
105  double m_theta;
107  };
108 
109  // Protected members
110  GModelPar m_theta_min; //!< Minimum theta angle
111  GModelPar m_theta_max; //!< Maximum theta angle
112  GModelPar m_scale_radius; //!< Scale radius of halo profile
113  GModelPar m_scale_density; //!< Scale density of halo profile
114  GModelPar m_halo_distance; //!< Distance from Earth to halo center
115  GModelPar m_core_radius; //!< Core radius
116 
117  // Cached members used for precomputation
118  mutable double m_last_scale_radius;
119  mutable double m_last_scale_density;
120  mutable double m_mass_radius;
121  mutable double m_scale_density_squared;
122 };
123 
124 
125 /***********************************************************************//**
126  * @brief Return class name
127  *
128  * @return String containing the class name ("GModelSpatialRadialProfileDMBurkert").
129  ***************************************************************************/
130 inline
132 {
133  return ("GModelSpatialRadialProfileDMBurkert");
134 }
135 
136 
137 /***********************************************************************//**
138  * @brief Return model type
139  *
140  * @return "DMBurkertProfile".
141  *
142  * Returns the type of the radial profile model.
143  ***************************************************************************/
144 inline
146 {
147  return "DMBurkertProfile";
148 }
149 
150 /***********************************************************************//**
151  * @brief Return scale radius
152  *
153  * @return Scale radius (kpc).
154  *
155  * Returns the scale radius of the halo profile in kpc.
156  ***************************************************************************/
157 inline
159 {
160  return (m_scale_radius.value());
161 }
162 
163 /***********************************************************************//**
164  * @brief Set scale radius
165  *
166  * @param[in] radius Scale radius (kpc).
167  *
168  * Sets the scale radius of the halo profile in kpc.
169  ***************************************************************************/
170 inline
172 {
173  m_scale_radius.value(radius);
174  return;
175 }
176 
177 /***********************************************************************//**
178  * @brief Return scale density
179  *
180  * @return Scale density (GeV/cm^3).
181  *
182  * Returns the scale density (mass/volume density at the scale radius) of
183  * the halo profile in GeV/cm^3.
184  ***************************************************************************/
185 inline
187 {
188  return (m_scale_density.value());
189 }
190 
191 /***********************************************************************//**
192  * @brief Set scale density
193  *
194  * @param[in] density Scale density (GeV/cm^3).
195  *
196  * Sets the scale density ( mass/volume density at the scale radius) of the
197  * halo profile in GeV/cm^3.
198  ***************************************************************************/
199 inline
201 {
202  m_scale_density.value(density);
203  return;
204 }
205 
206 /***********************************************************************//**
207  * @brief Return halo distance
208  *
209  * @return Halo distance (kpc).
210  *
211  * Returns the distance to the halo center in kpc.
212  ***************************************************************************/
213 inline
215 {
216  return (m_halo_distance.value());
217 }
218 
219 /***********************************************************************//**
220  * @brief Set halo distance
221  *
222  * @param[in] distance Halo distance (kpc).
223  *
224  * Sets the distance between the observer and the halo center in kpc.
225  ***************************************************************************/
226 inline
228 {
229  m_halo_distance.value(distance);
230  return;
231 }
232 
233 #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:47
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.
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.
virtual std::string type(void) const
Return model type.
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.