GammaLib  1.7.0.dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GModelSpatialRadialProfileDMEinasto.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  * GModelSpatialRadialProfileDMEinasto.cpp - Einasto radial profile class *
3  * ----------------------------------------------------------------------- *
4  * copyright (C) 2016-2018 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 GModelSpatialRadialProfileDMEinasto.cpp
23  * @brief Radial DM Einasto profile model class implementation
24  * @author Nathan Kelley-Hoskins
25  */
26 
27 /* __ Includes ___________________________________________________________ */
28 #ifdef HAVE_CONFIG_H
29 #include <config.h>
30 #endif
31 #include "GException.hpp"
32 #include "GTools.hpp"
33 #include "GMath.hpp"
34 #include "GXmlElement.hpp"
37 
38 /* __ Constants __________________________________________________________ */
39 
40 /* __ Globals ____________________________________________________________ */
42 const GModelSpatialRegistry g_radial_disk_registry(&g_radial_disk_seed);
43 
44 /* __ Method name definitions ____________________________________________ */
45 #define G_READ "GModelSpatialRadialProfileDMEinasto::read(GXmlElement&)"
46 #define G_WRITE "GModelSpatialRadialProfileDMEinasto::write(GXmlElement&)"
47 
48 /* __ Macros _____________________________________________________________ */
49 
50 /* __ Coding definitions _________________________________________________ */
51 
52 /* __ Debug definitions __________________________________________________ */
53 
54 
55 /*==========================================================================
56  = =
57  = Constructors/destructors =
58  = =
59  ==========================================================================*/
60 
61 /***********************************************************************//**
62  * @brief Void constructor
63  *
64  * Constructs empty radial DMEinasto profile
65  ***************************************************************************/
68 {
69  // Initialise members
70  init_members();
71 
72  // Return
73  return;
74 }
75 
76 
77 /***********************************************************************//**
78  * @brief XML constructor
79  *
80  * @param[in] xml XML element.
81  *
82  * Constructs radial DMEinasto profile model by extracting information from
83  * an XML element. See the read() method for more information about the
84  * expected structure of the XML element.
85  ***************************************************************************/
88 {
89  // Initialise members
90  init_members();
91 
92  // Read information from XML element
93  read(xml);
94 
95  // Return
96  return;
97 }
98 
99 
100 /***********************************************************************//**
101  * @brief Copy constructor
102  *
103  * @param[in] model Radial DMEinasto profile model.
104  *
105  * Copies radial DMEinasto profile model from another radial profile model.
106  ***************************************************************************/
109 {
110  // Initialise members
111  init_members();
112 
113  // Copy members
114  copy_members(model);
115 
116  // Return
117  return;
118 }
119 
120 
121 /***********************************************************************//**
122  * @brief Destructor
123  *
124  * Destructs radial DMEinasto profile model.
125  ***************************************************************************/
127 {
128  // Free members
129  free_members();
130 
131  // Return
132  return;
133 }
134 
135 
136 /*==========================================================================
137  = =
138  = Operators =
139  = =
140  ==========================================================================*/
141 
142 /***********************************************************************//**
143  * @brief Assignment operator
144  *
145  * @param[in] model Radial DMEinasto profile model.
146  * @return Radial DMEinasto profile model.
147  *
148  * Assigns radial DMEinasto profile model.
149  ***************************************************************************/
151 {
152  // Execute only if object is not identical
153  if (this != &model) {
154 
155  // Copy base class members
157 
158  // Free members
159  free_members();
160 
161  // Initialise members
162  init_members();
163 
164  // Copy members
165  copy_members(model);
166 
167  } // endif: object was not identical
168 
169  // Return
170  return *this;
171 }
172 
173 
174 /*==========================================================================
175  = =
176  = Public methods =
177  = =
178  ==========================================================================*/
179 
180 /***********************************************************************//**
181  * @brief Clear radial DMEinasto profile model
182  *
183  * Clears radial DMEinasto profile model.
184  ***************************************************************************/
186 {
187  // Free class members
188  free_members();
192 
193  // Initialise members
197  init_members();
198 
199  // Return
200  return;
201 }
202 
203 
204 /***********************************************************************//**
205  * @brief Clone radial DMEinasto profile model
206  *
207  * @return Pointer to deep copy of radial DMEinasto profile model.
208  *
209  * Returns a deep copy of the radial DMEinasto profile model.
210  ***************************************************************************/
212 {
213  // Clone radial disk model
214  return new GModelSpatialRadialProfileDMEinasto(*this);
215 }
216 
217 
218 /***********************************************************************//**
219  * @brief Return minimum model radius (in radians)
220  *
221  * @return Minimum model radius (in radians).
222  ***************************************************************************/
224 {
225 
226  // update precomputation cache
227  update();
228 
229  // Return value
230  return m_theta_min.value();
231 }
232 
233 
234 /***********************************************************************//**
235  * @brief Return maximum model radius (in radians)
236  *
237  * @return Maximum model radius (in radians).
238  ***************************************************************************/
240 {
241 
242  // Update precomputation cache
243  update();
244 
245  // Initialise maximum theta angle
246  double theta = 0.0;
247 
248  // If Earth is within the significant radius, then theta_max must
249  // contain the entire profile (180deg) ...
251  theta = gammalib::pi;
252  }
253 
254  // ... otherwise if the halo is far enough away (further than the mass
255  // radius) then we just need to deal with the angles within the sphere
256  // of the significant radius.
257  else {
259  }
260 
261  // Always chose the lesser of mass_radius theta and theta_max
263  if (theta > theta_max) {
264  theta = theta_max;
265  }
266 
267  // Return maximum theta value
268  return theta;
269 }
270 
271 
272 /***********************************************************************//**
273  * @brief Read model from XML element
274  *
275  * @param[in] xml XML element.
276  *
277  * Reads the DMEinasto radial profile model information from an XML element.
278  * The XML element shall have the format
279  *
280  * <spatialModel type="DMEinastoProfile">
281  * <parameter name="RA" scale=.. value=.. min=.. max=.. free=../>
282  * <parameter name="DEC" scale=.. value=.. min=.. max=.. free=../>
283  * <parameter name="ScaleRadius" scale=.. value=.. min=.. max=.. free=../>
284  * <parameter name="ScaleDensity" scale=.. value=.. min=.. max=.. free=../>
285  * <parameter name="HaloDistance" scale=.. value=.. min=.. max=.. free=../>
286  * <parameter name="Alpha" scale=.. value=.. min=.. max=.. free=../>
287  * <parameter name="ThetaMin" scale=.. value=.. min=.. max=.. free=../>
288  * <parameter name="ThetaMax" scale=.. value=.. min=.. max=.. free=../>
289  * <parameter name="CoreRadius" scale=.. value=.. min=.. max=.. free=../>
290  * </spatialModel>
291  ***************************************************************************/
293 {
294  // Read DMEinasto location
296 
297  // Read ScaleRadius parameter
298  const GXmlElement* par1 = gammalib::xml_get_par(G_READ, xml, "ScaleRadius");
299  m_scale_radius.read(*par1);
300 
301  // Read ScaleDensity parameter
302  const GXmlElement* par2 = gammalib::xml_get_par(G_READ, xml, "ScaleDensity");
303  m_scale_density.read(*par2);
304 
305  // Read HaloDistance parameter
306  const GXmlElement* par3 = gammalib::xml_get_par(G_READ, xml, "HaloDistance");
307  m_halo_distance.read(*par3);
308 
309  // Read Alpha parameter
310  const GXmlElement* par4 = gammalib::xml_get_par(G_READ, xml, "Alpha");
311  m_alpha.read(*par4);
312 
313  // Read ThetaMin parameter
314  const GXmlElement* par5 = gammalib::xml_get_par(G_READ, xml, "ThetaMin");
315  m_theta_min.read(*par5);
316 
317  // Read ThetaMax parameter
318  const GXmlElement* par6 = gammalib::xml_get_par(G_READ, xml, "ThetaMax");
319  m_theta_max.read(*par6);
320 
321  // Read CoreRadius parameter
322  const GXmlElement* par7 = gammalib::xml_get_par(G_READ, xml, "CoreRadius");
323  m_core_radius.read(*par7);
324 
325  // Return
326  return;
327 }
328 
329 
330 /***********************************************************************//**
331  * @brief Write model into XML element
332  *
333  * @param[in] xml XML element into which model information is written.
334  *
335  * Writes the DMEinasto radial profile model information into an XML element.
336  * The XML element will have the format
337  *
338  * <spatialModel type="DMEinastoProfile">
339  * <parameter name="RA" scale=.. value=.. min=.. max=.. free=../>
340  * <parameter name="DEC" scale=.. value=.. min=.. max=.. free=../>
341  * <parameter name="ScaleRadius" scale=.. value=.. min=.. max=.. free=../>
342  * <parameter name="ScaleDensity" scale=.. value=.. min=.. max=.. free=../>
343  * <parameter name="HaloDistance" scale=.. value=.. min=.. max=.. free=../>
344  * <parameter name="Alpha" scale=.. value=.. min=.. max=.. free=../>
345  * <parameter name="ThetaMin" scale=.. value=.. min=.. max=.. free=../>
346  * <parameter name="ThetaMax" scale=.. value=.. min=.. max=.. free=../>
347  * <parameter name="CoreRadius" scale=.. value=.. min=.. max=.. free=../>
348  * </spatialModel>
349  ***************************************************************************/
351 {
352  // Write DMEinasto location
354 
355  // Write ScaleRadius parameter
356  GXmlElement* par1 = gammalib::xml_need_par(G_WRITE, xml, "ScaleRadius");
357  m_scale_radius.write(*par1);
358 
359  // Write ScaleDensity parameter
360  GXmlElement* par2 = gammalib::xml_need_par(G_WRITE, xml, "ScaleDensity");
361  m_scale_density.write(*par2);
362 
363  // Write HaloDistance parameter
364  GXmlElement* par3 = gammalib::xml_need_par(G_WRITE, xml, "HaloDistance");
365  m_halo_distance.write(*par3);
366 
367  // Write Alpha parameter
368  GXmlElement* par4 = gammalib::xml_need_par(G_WRITE, xml, "Alpha");
369  m_alpha.write(*par4);
370 
371  // Write ThetaMin parameter
372  GXmlElement* par5 = gammalib::xml_need_par(G_WRITE, xml, "ThetaMin");
373  m_theta_min.write(*par5);
374 
375  // Write ThetaMax parameter
376  GXmlElement* par6 = gammalib::xml_need_par(G_WRITE, xml, "ThetaMax");
377  m_theta_max.write(*par6);
378 
379  // Write CoreRadius parameter
380  GXmlElement* par7 = gammalib::xml_need_par(G_WRITE, xml, "CoreRadius");
381  m_core_radius.write(*par7);
382 
383  // Return
384  return;
385 }
386 
387 
388 /***********************************************************************//**
389  * @brief Print information
390  *
391  * @param[in] chatter Chattiness.
392  * @return String containing model information.
393  ***************************************************************************/
394 std::string GModelSpatialRadialProfileDMEinasto::print(const GChatter& chatter) const
395 {
396  // Initialise result string
397  std::string result;
398 
399  // Continue only if chatter is not silent
400  if (chatter != SILENT) {
401 
402  // Append header
403  result.append("=== GModelSpatialRadialProfileDMEinasto ===");
404 
405  // Append parameters
406  result.append("\n"+gammalib::parformat("Number of parameters"));
407  result.append(gammalib::str(size()));
408  for (int i = 0; i < size(); ++i) {
409  result.append("\n"+m_pars[i]->print(chatter));
410  }
411 
412  } // endif: chatter was not silent
413 
414  // Return result
415  return result;
416 }
417 
418 
419 /*==========================================================================
420  = =
421  = Private methods =
422  = =
423  ==========================================================================*/
424 
425 /***********************************************************************//**
426  * @brief Initialise class members
427  ***************************************************************************/
429 {
430 
431  // Initialise scale radius
433  m_scale_radius.name("ScaleRadius");
434  m_scale_radius.unit("kpc");
435  m_scale_radius.value(21.5); // default to GC scale radius
436  m_scale_radius.min(1.0e-6); // arbitrarily chosen :/
438  m_scale_radius.scale(1.0);
440  m_scale_radius.has_grad(false); // Radial components never have gradients
441 
442  // Initialise scale density
444  m_scale_density.name("ScaleDensity");
445  m_scale_density.unit("GeV/cm^3");
446  m_scale_density.value(0.2); // GeV/cm3, default to GC scale density
447  m_scale_density.min(1.0e-6);
449  m_scale_density.scale(1.0);
451  m_scale_density.has_grad(false); // Radial components never have gradients
452 
453  // Initialise halo distance
455  m_halo_distance.name("HaloDistance");
456  m_halo_distance.unit("kpc");
457  m_halo_distance.value(7.94); // default to GC halo distance
458  m_halo_distance.min(1.0e-6); // arbitrarily chosen
460  m_halo_distance.scale(1.0);
462  m_halo_distance.has_grad(false); // Radial components never have gradients
463 
464  // Initialise alpha
465  m_alpha.clear();
466  m_alpha.name("Alpha");
467  m_alpha.unit("unitless");
468  m_alpha.value(0.17); // default to GC alpha
469  m_alpha.min(0.01); // arbitrarily chosen
470  m_alpha.max(10.0); // arbitrarily chosen
471  m_alpha.free();
472  m_alpha.scale(1.0);
473  m_alpha.gradient(0.0);
474  m_alpha.has_grad(false); // Radial components never have gradients
475 
476  // Initialise theta max
477  m_theta_min.clear();
478  m_theta_min.name("ThetaMin");
479  m_theta_min.unit("degrees");
480  m_theta_min.value(180.0); // can only go from halo center to opposite halo center
481  m_theta_min.min(1.0e-6); // arbitrarily chosen
482  m_theta_min.fix(); // should always be fixed!
483  m_theta_min.scale(1.0);
484  m_theta_min.gradient(0.0);
485  m_theta_min.has_grad(false); // Radial components never have gradients
486 
487  // Initialise theta max
488  m_theta_max.clear();
489  m_theta_max.name("ThetaMax");
490  m_theta_max.unit("degrees");
491  m_theta_max.value(1.0e-6); // can only go from halo center to opposite halo center
492  m_theta_max.min(1.0e-10); // arbitrarily chosen
493  m_theta_max.fix(); // should always be fixed!
494  m_theta_max.scale(1.0);
495  m_theta_max.gradient(0.0);
496  m_theta_max.has_grad(false); // Radial components never have gradients
497 
498  // Initialise core radius
500  m_core_radius.name("CoreRadius");
501  m_core_radius.unit("kpc");
502  m_core_radius.value(0.5); // example: galactic center core
503  m_core_radius.min(0.0);
504  m_core_radius.fix();
505  m_core_radius.scale(1.0);
506  m_core_radius.gradient(0.0);
507  m_core_radius.has_grad(false);
508 
509  // Set parameter pointer(s)
510  m_pars.push_back(&m_scale_radius);
511  m_pars.push_back(&m_scale_density);
512  m_pars.push_back(&m_halo_distance);
513  m_pars.push_back(&m_alpha);
514  m_pars.push_back(&m_theta_min);
515  m_pars.push_back(&m_theta_max);
516  m_pars.push_back(&m_core_radius);
517 
518  // Initialize precomputation cache. Note that zero values flag
519  // uninitialised, as a zero radius is not meaningful
520  m_last_scale_radius = 0.0;
521  m_last_scale_density = 0.0;
522  m_mass_radius = 0.0;
524 
525  // Return
526  return;
527 }
528 
529 
530 /***********************************************************************//**
531  * @brief Copy class members
532  *
533  * @param[in] model Radial DMEinasto model.
534  *
535  * Copies class members from another radial profile model.
536  ***************************************************************************/
538 {
539  // Copy members. We do not have to push back the members on the parameter
540  // stack as this should have been done by init_members() that was called
541  // before.
545  m_alpha = model.m_alpha;
546  m_theta_min = model.m_theta_min;
547  m_theta_max = model.m_theta_max;
549 
550  // copy cache values
555 
556  // Return
557  return;
558 }
559 
560 
561 /***********************************************************************//**
562  * @brief Delete class members
563  ***************************************************************************/
565 {
566  // Return
567  return;
568 }
569 
570 
571 /***********************************************************************//**
572  * @brief Radial profile
573  *
574  * @param[in] theta Angular distance from DMEinasto centre (radians).
575  * @return Profile value.
576  ***************************************************************************/
577 double GModelSpatialRadialProfileDMEinasto::profile_value(const double& theta) const
578 {
579  // Update precomputation cache
580  update();
581 
582  // Initialize integral value
583  double value = 0.0;
584 
585  // Set up integration limits
586  double los_min = m_halo_distance.value() - m_mass_radius;
587  double los_max = m_halo_distance.value() + m_mass_radius;
588 
589  // handle case where observer is within halo mass radius
590  if (los_min < 0.0) {
591  los_min = 0.0;
592  }
593 
594  // Set up integral
597  m_alpha.value(),
598  theta,
599  m_core_radius.value());
600  GIntegral integral(&integrand);
601  integral.max_iter(30);
602 
603  // Set up integration boundaries. As there is usually an infinity at the
604  // halo center, this splits the integral at the m_halo_distance.
605  std::vector<double> bounds;
606  bounds.push_back(los_min);
607  bounds.push_back(los_max);
608  bounds.push_back(m_halo_distance.value());
609 
610  // Compute value
611  value = integral.romberg(bounds);
612 
613  // Multiply in the density^2
614  value *= m_scale_density_squared;
615 
616  // Return value
617  return value;
618 }
619 
620 
621 /***********************************************************************//**
622  * @brief Kernel for halo density profile squared
623  *
624  * @param[in] los Distance from observer to point in space (meters)
625  * @return Halo density.
626  *
627  * Computes the value of an einasto halo density profile squared,
628  * at distance l from observer, at angle \f[\theta\f] from the halo center:
629  *
630  * \f[
631  * f(\theta, l) = E^{ -\frac{2}{\alpha} \left( g^{\alpha} - 1 \right) }
632  * \f]
633  *
634  * where
635  *
636  * \f[
637  * g = \frac{ \sqrt{l^2+d^2-2ldCos(\theta)} }{r_s}
638  * \f]
639  *
640  * This profile is detailed in:
641  * Springel et al, 2008
642  * "The Aquarius Project: the subhaloes of galactic haloes"
643  * Mon. Not. R. Astron. Soc. 391, 1685–1711
644  * http://mnras.oxfordjournals.org/content/391/4/1685
645  *
646  * which cites:
647  * J. Einasto, 1965
648  * "Kinematics and dynamics of stellar systems"
649  * Trudy Inst. Astrofiz. Alma-Ata 5, 87
650  ***************************************************************************/
652 {
653  // Calculate the scale distance g, the ( distance from integration point
654  // to the halo center ) divided by ( the halo scale radius )
655 
656  // First calculate the distance of the integration point from the halo
657  // center via the law of cosines
658  double g = los * los;
660  g -= 2.0 * los * m_halo_distance * std::cos(m_theta);
661  g = std::sqrt(g);
662 
663  // If we have a core radius specified, all halo values inside this core
664  // radius should be the same as at the core radius itself.
665  if (g < m_core_radius) {
666  g = m_core_radius;
667  }
668 
669  // Finish scaling the integration point by the halo's scale radius
670  g /= m_scale_radius;
671 
672  // Calculate the halo density f at the scale distance g
673  double f = std::pow(g, m_alpha);
674  f -= 1.0;
675  f *= -2.0 / m_alpha;
676  f = std::exp(f);
677 
678  // Squared, for annihilating DM, would just be f if it was decaying DM
679  f = f * f;
680 
681  // Return function value
682  return f;
683 }
684 
685 
686 /***********************************************************************//**
687  * @brief Update precomputation cache
688  *
689  * Computes the m_mass_radius calculation, determining the radius around
690  * the halo that contains 99.99% of the mass. For an Einasto halo profile,
691  * this is just 10.0 * scale_radius .
692  ***************************************************************************/
694 {
695  // Update if scale radius has changed
698 
699  // Store last values
702 
703  // Perform precomputations
704  m_mass_radius = 10.0 * scale_radius();
706 
707  }
708 
709  // Return
710  return;
711 }
712 
713 
714 /***********************************************************************//**
715  * @brief Calculate halo mass density
716  *
717  * @param[in] radius Distance from halo center (kpc).
718  * @return Halo mass density.
719  *
720  * Calculates the halo's mass density at a given radial distance from the
721  * halo center.
722  ***************************************************************************/
723 double GModelSpatialRadialProfileDMEinasto::mass_density(const double& radius) const
724 {
725  // Set-up kernel
726  halo_kernel_los halo_shape(m_scale_radius.value(),
728  m_alpha.value(),
729  0.0,
730  m_core_radius.value());
731 
732 
733  // eval produces a unitless density^2, so we must take its square root
734  double density = std::sqrt(halo_shape.eval(m_halo_distance.value() + radius));
735 
736  // Multiply in the missing scale density
737  density *= m_scale_density.value();
738 
739  // Return halo mass density
740  return density;
741 }
742 
743 
744 /***********************************************************************//**
745  * @brief Calculate J-factor
746  *
747  * @param[in] angle from halo center (radians)
748  * @return J-factor.
749  *
750  * Calculates the halo's J-factor at an angle from the halo center.
751  ***************************************************************************/
752 double GModelSpatialRadialProfileDMEinasto::jfactor(const double& angle) const
753 {
754  // Integration settings
755  double minradian = 0.0;
756  int npoints = 200;
757 
758  // Initialize other variables
759  double jfactor = 0.0 ;
760  double dr = (angle - minradian) / npoints;
761  double r = 0.0;
762 
763  // Loop over different radii in the profile
764  for (int i = 0; i < npoints; ++i) {
765  r = minradian + (i * dr);
766  jfactor += profile_value(r) * r * dr;
767  }
768 
769  // J-factor = 2 * pi * Int[ profile(r) * r * dr , {r,minradian,angle} ]
770  jfactor *= gammalib::twopi;
771 
772  // Return J-factor
773  return jfactor;
774 }
GModelPar m_scale_density
Scale density of halo profile.
const std::string & name(void) const
Return parameter name.
XML element node class interface definition.
const double pi
Definition: GMath.hpp:35
double gradient(void) const
Return parameter gradient.
int size(void) const
Return number of parameters.
virtual std::string print(const GChatter &chatter=NORMAL) const
Print information.
void write(GXmlElement &xml) const
Set or update parameter attributes in XML element.
Definition: GModelPar.cpp:353
virtual double profile_value(const double &theta) const
Radial profile.
GVector cos(const GVector &vector)
Computes cosine of vector elements.
Definition: GVector.cpp:1100
XML element node class.
Definition: GXmlElement.hpp:47
GModelPar m_alpha
Einasto spatial power index.
double max(void) const
Return parameter maximum boundary.
const GModelSpatialRadialDisk g_radial_disk_seed
double scale_density(void) const
Return scale density.
Gammalib tools definition.
GIntegral class interface definition.
Definition: GIntegral.hpp:45
virtual double theta_max(void) const
Return maximum model radius (in radians)
Interface definition for the spatial model registry class.
double min(void) const
Return parameter minimum boundary.
void init_members(void)
Initialise class members.
GModelPar m_halo_distance
Distance from earth to halo center.
void init_members(void)
Initialise class members.
const double & scale(void) const
Return parameter scale.
const double deg2rad
Definition: GMath.hpp:43
GVector sqrt(const GVector &vector)
Computes square root of vector elements.
Definition: GVector.cpp:1268
virtual GModelSpatialRadialProfileDMEinasto * clone(void) const
Clone radial DMEinasto profile model.
bool has_grad(void) const
Signal if parameter gradient is computed analytically.
void free_members(void)
Delete class members.
virtual double theta_min(void) const
Return minimum model radius (in radians)
void free_members(void)
Delete class members.
void free(void)
Free a parameter.
std::vector< GModelPar * > m_pars
Parameter pointers.
GModelPar m_scale_radius
Scale radius of halo profile.
void fix(void)
Fix a parameter.
GXmlElement * xml_need_par(const std::string &origin, GXmlElement &xml, const std::string &name)
Return pointer to parameter with given name in XML element.
Definition: GTools.cpp:1513
virtual void read(const GXmlElement &xml)
Read model from XML element.
void clear(void)
Clear parameter.
Spatial model registry class definition.
virtual void write(GXmlElement &xml) const
Write model into XML element.
double jfactor(const double &angle) const
Calculate J-factor.
GChatter
Definition: GTypemaps.hpp:33
double mass_density(const double &radius) const
Calculate halo mass density.
virtual void read(const GXmlElement &xml)
Read model from XML element.
virtual void write(GXmlElement &xml) const
Write model into XML element.
void copy_members(const GModelSpatialRadialProfileDMEinasto &model)
Copy class members.
void free_members(void)
Delete class members.
double scale_radius(void) const
Return scale radius.
void read(const GXmlElement &xml)
Extract parameter attributes from XML element.
Definition: GModelPar.cpp:229
double value(void) const
Return parameter value.
virtual GModelSpatialRadialProfile & operator=(const GModelSpatialRadialProfile &model)
Assignment operator.
GVector pow(const GVector &vector, const double &power)
Computes tanh of vector elements.
Definition: GVector.cpp:1332
const std::string & unit(void) const
Return parameter unit.
virtual void clear(void)
Clear radial DMEinasto profile model.
Exception handler interface definition.
virtual GModelSpatialRadialProfileDMEinasto & operator=(const GModelSpatialRadialProfileDMEinasto &model)
Assignment operator.
Dark Matter Einasto profile model class interface definition.
GVector exp(const GVector &vector)
Computes exponential of vector elements.
Definition: GVector.cpp:1142
void init_members(void)
Initialise class members.
const double twopi
Definition: GMath.hpp:36
std::string parformat(const std::string &s, const int &indent=0)
Convert string in parameter format.
Definition: GTools.cpp:1022
void update(void) const
Update precomputation cache.
GVector atan(const GVector &vector)
Computes arctan of vector elements.
Definition: GVector.cpp:1058
const GXmlElement * xml_get_par(const std::string &origin, const GXmlElement &xml, const std::string &name)
Return pointer to parameter with given name in XML element.
Definition: GTools.cpp:1562
Mathematical function definitions.
double eval(const double &los)
Kernel for halo density profile squared.
std::string str(const unsigned short int &value)
Convert unsigned short integer value into string.
Definition: GTools.cpp:413