CosmoBolognaLib
Free Software C++/Python libraries for cosmological calculations
HaloProfile.h
Go to the documentation of this file.
1 /********************************************************************
2  * Copyright (C) 2022 by Federico Marulli and Giorgio Lesci *
3  * federico.marulli3@unibo.it *
4  * *
5  * This program is free software; you can redistribute it and/or *
6  * modify it under the terms of the GNU General Public License as *
7  * published by the Free Software Foundation; either version 2 of *
8  * the License, or (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the GNU General Public *
16  * License along with this program; if not, write to the Free *
17  * Software Foundation, Inc., *
18  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19  ********************************************************************/
20 
34 #ifndef __HALOPROFILE__
35 #define __HALOPROFILE__
36 
37 #include "Cosmology.h"
38 
39 
40 // ============================================================================================
41 
42 
43 namespace cbl {
44 
45  namespace cosmology {
46 
52  class HaloProfile {
53 
54  private :
55 
57  std::shared_ptr<cosmology::Cosmology> m_cosmology = NULL;
58 
61 
63  std::string m_halo_def;
64 
66  double m_Delta;
67 
69  std::function<double(const double, cbl::cosmology::Cosmology, const double)> m_Delta_func;
70 
72  double m_trunc_fact;
73 
76 
78  double m_sigma_off;
79 
81  double m_f_off;
82 
85 
88 
90  double m_min_Smis;
91 
93  double m_max_Smis;
94 
97 
99  std::vector<double> (HaloProfile::*m_rho_ptr) (const std::vector<double>);
100 
102  double (HaloProfile::*m_rho_s_ptr) ();
103 
105  std::vector<double> (HaloProfile::*m_Sigma_mis_ptr) (const std::vector<double>);
106 
108  std::vector<double> (HaloProfile::*m_Sigma_cen_ptr) (const std::vector<double>);
109 
111  std::vector<double> (HaloProfile::*m_Sigma_mean_cen_ptr) (const std::vector<double>);
112 
114  std::vector<double> (HaloProfile::*m_Sigma_ptr) (const std::vector<double>);
115 
117  std::vector<double> (HaloProfile::*m_DeltaSigma_mis_ptr) (const std::vector<double>);
118 
120  std::vector<double> (HaloProfile::*m_DeltaSigma_cen_ptr) (const std::vector<double>);
121 
123  std::vector<double> (HaloProfile::*m_DeltaSigma_ptr) (const std::vector<double>);
124 
126  bool m_isSet_cM_relation = false;
127 
130 
133 
136 
139 
142 
145 
148 
153 
218  void m_set_profile (const cbl::cosmology::Cosmology cosmology, const double redshift, const double conc, const double Mass, const double Delta, const std::string profile_author, const std::string halo_def, const double trunc_fact=3., const bool miscentering=false, const bool single_profile=false, const double sigma_off=0.1, const double f_off=1.);
219 
227  { return m_concentration; }
228 
236  double m_concentration_Duffy ();
237 
244  double m_rho_s_NFW ();
245 
252  double m_rho_s_NFW_trunc ();
253 
262  std::vector<double> m_rho_NFW (const std::vector<double> rad);
263 
272  std::vector<double> m_rho_NFW_trunc (const std::vector<double> rad);
273 
282  std::vector<double> m_Sigma_NFW (const std::vector<double> rad);
283 
292  std::vector<double> m_Sigma_mean_NFW (const std::vector<double> rad);
293 
302  std::vector<double> m_Sigma_NFW_trunc (const std::vector<double> rad);
303 
312  std::vector<double> m_Sigma_mean_NFW_trunc (const std::vector<double> rad);
313 
322  std::vector<double> m_Sigma_mis (const std::vector<double> rad);
323 
333  std::vector<double> m_Sigma_including_miscentering (const std::vector<double> rad);
334 
344  std::vector<double> m_DeltaSigma_cen (const std::vector<double> rad);
345 
354  std::vector<double> m_DeltaSigma_mis (const std::vector<double> rad);
355 
365  std::vector<double> m_DeltaSigma_including_miscentering (const std::vector<double> rad);
366 
386  void m_set_cM_relation (const std::string cM_author="Duffy");
387 
389 
391 
392  public:
393 
398 
403  HaloProfile () = default;
404 
469  HaloProfile (const cbl::cosmology::Cosmology cosmology, const double redshift, const double conc, const double Mass, const double Delta, const std::string profile_author, const std::string halo_def, const double trunc_fact=3., const bool miscentering=false, const bool single_profile=false, const double sigma_off=0.1, const double f_off=1.);
470 
542  HaloProfile (const cbl::cosmology::Cosmology cosmology, const double redshift, const std::string cM_author, const double Mass, const double Delta, const std::string profile_author, const std::string halo_def, const double trunc_fact=3., const bool miscentering=false, const bool single_profile=false, const double sigma_off=0.1, const double f_off=1.);
543 
547  ~HaloProfile () = default;
548 
550 
551 
557 
567  double concentration ()
568  { return (this->*m_return_concentration)(); }
569 
578  double concentration2 (const double Vmax, const double Rmax) const;
579 
592  double Delta ()
594 
606  std::vector<double> density_profile_3D (const std::vector<double> rad);
607 
614  double rho_s ();
615 
627  std::vector<double> Sigma (const std::vector<double> rad);
628 
641  std::vector<double> Sigma_mis (const std::vector<double> rad);
642 
655  std::vector<double> Sigma_cen (const std::vector<double> rad);
656 
689  std::vector<double> Sigma_2h (const std::vector<double> rad, const std::string bias_author, const std::string method_Pk="EisensteinHu", const std::string interp_type="Linear", const bool NL=false);
690 
719  std::vector<double> Sigma_2h (const std::vector<double> rad, const double bias, const std::string method_Pk="EisensteinHu", const std::string interp_type="Linear", const bool NL=false);
720 
733  std::vector<double> DeltaSigma (const std::vector<double> rad);
734 
747  std::vector<double> DeltaSigma_mis (const std::vector<double> rad);
748 
761  std::vector<double> DeltaSigma_cen (const std::vector<double> rad);
762 
795  std::vector<double> DeltaSigma_2h (const std::vector<double> rad, const std::string bias_author, const std::string method_Pk="EisensteinHu", const std::string interp_type="Linear", const bool NL=false);
796 
825  std::vector<double> DeltaSigma_2h (const std::vector<double> rad, const double bias, const std::string method_Pk="EisensteinHu", const std::string interp_type="Linear", const bool NL=false);
826 
827 
867  double density_profile_FourierSpace (const double kk);
868 
955  double Mass_Delta (const double Mass, const double Delta_in, const double Delta_out, const double conc, const bool is_input_conc, const double rRmin_guess=1.e-3, const double rRmax_guess=10.) const;
956 
958 
959 
964 
971  void set_cosmology (const cbl::cosmology::Cosmology cosmology);
972 
977  void set_mass (const double mass=par::defaultDouble)
978  { m_mass = mass; }
979 
984  void set_concentration (const double conc=par::defaultDouble)
985  { m_concentration = conc; }
986 
991  void set_f_off (const double f_off=par::defaultDouble)
992  { m_f_off = f_off; }
993 
998  void set_sigma_off (const double sigma_off=par::defaultDouble)
999  { m_sigma_off = sigma_off; }
1000 
1005  void set_trunc_fact (const double trunc_fact=par::defaultDouble)
1006  { m_trunc_fact = trunc_fact; }
1007 
1009 
1010  };
1011  }
1012 }
1013 
1014 #endif
1015 
The class Cosmology.
The class Cosmology.
Definition: Cosmology.h:277
The class HaloProfile.
Definition: HaloProfile.h:52
std::vector< double > Sigma(const std::vector< double > rad)
the total surface density profile of the halo.
~HaloProfile()=default
default destructor
void set_mass(const double mass=par::defaultDouble)
set the private member m_mass
Definition: HaloProfile.h:977
double density_profile_FourierSpace(const double kk)
the Fourier transform of the normalised halo density
std::vector< double >(HaloProfile::* m_DeltaSigma_cen_ptr)(const std::vector< double >)
function returning the centered cluster excess surface density for a given radius
Definition: HaloProfile.h:120
double(HaloProfile::* m_return_concentration)()
pointer returning the concentration, the one set by the user or from a concentration-mass relation fu...
Definition: HaloProfile.h:129
double m_concentration
halo concentration
Definition: HaloProfile.h:144
void set_concentration(const double conc=par::defaultDouble)
set the private member m_concentration
Definition: HaloProfile.h:984
std::vector< double > Sigma_cen(const std::vector< double > rad)
the centered contribution to the total surface density profile of the halo.
std::vector< double >(HaloProfile::* m_Sigma_mis_ptr)(const std::vector< double >)
function returning the miscentering contribution to the total cluster surface density for a given rad...
Definition: HaloProfile.h:105
std::vector< double >(HaloProfile::* m_rho_ptr)(const std::vector< double >)
cluster 3D density profile function
Definition: HaloProfile.h:99
double m_redshift
halo redshift
Definition: HaloProfile.h:147
std::vector< double > m_Sigma_mis(const std::vector< double > rad)
the mis-centered surface density profile of the halo (see e.g. Bellagamba et al. 2019).
double m_min_Smis
minimum value where the off-centered Sigma(R) is computed
Definition: HaloProfile.h:90
bool m_single_profile
if true, the miscetering is related to a single cluster. Otherwise, a population of clusters is consi...
Definition: HaloProfile.h:96
double m_Delta
overdensity factor
Definition: HaloProfile.h:66
std::vector< double > m_DeltaSigma_cen(const std::vector< double > rad)
Excess surface density without the miscentering contribution.
double m_sigma_off
rms of the off-centered cluster distribution
Definition: HaloProfile.h:78
bool m_miscentering
if true, account for the miscentering
Definition: HaloProfile.h:75
double m_B
parameter B in the c-M relation
Definition: HaloProfile.h:135
std::vector< double >(HaloProfile::* m_DeltaSigma_ptr)(const std::vector< double >)
function returning the excess cluster surface density for a given radius
Definition: HaloProfile.h:123
std::vector< double > m_Sigma_mean_NFW_trunc(const std::vector< double > rad)
Mean surface density of the truncated NFW profile.
std::vector< double > m_Sigma_mean_NFW(const std::vector< double > rad)
Mean surface density of the NFW profile.
std::vector< double > Sigma_mis(const std::vector< double > rad)
the miscentering contribution to the total surface density profile of the halo.
double m_trunc_fact
truncation factor $F_t$ defining the truncation radius, that is
Definition: HaloProfile.h:72
std::vector< double >(HaloProfile::* m_Sigma_mean_cen_ptr)(const std::vector< double >)
function returning the centered mean cluster surface density for a given radius
Definition: HaloProfile.h:111
std::vector< double > m_Sigma_including_miscentering(const std::vector< double > rad)
Surface density including the miscentering contribution.
HaloProfile()=default
default constructor
std::vector< double > DeltaSigma_2h(const std::vector< double > rad, const std::string bias_author, const std::string method_Pk="EisensteinHu", const std::string interp_type="Linear", const bool NL=false)
the 2-halo contribution to the excess surface density profile of the halo, computed by assuming a hal...
std::vector< double > density_profile_3D(const std::vector< double > rad)
the 3D halo density profile.
double m_return_set_concentration()
Return the concentration set by the user.
Definition: HaloProfile.h:226
std::string m_halo_def
halo (overdensity) definition
Definition: HaloProfile.h:63
double m_f_off
fraction of off-centered clusters
Definition: HaloProfile.h:81
double m_sigma_off_threshold
lower threshold for sigma_off
Definition: HaloProfile.h:84
double concentration2(const double Vmax, const double Rmax) const
compute the halo concentration
void m_set_cM_relation(const std::string cM_author="Duffy")
set the concentration-mass relation. A function is set, computing the concentration of a dark matter ...
double rho_s()
the characteristic density of the 3D halo density profile.
double m_concentration_Duffy()
The concentration-mass relation by Duffy et al. (2008):
Definition: HaloProfile.cpp:64
std::vector< double > m_rho_NFW(const std::vector< double > rad)
The NFW 3D density profile.
std::vector< double > DeltaSigma_cen(const std::vector< double > rad)
the centered contribution to the excess surface density profile of the halo.
std::vector< double > m_Sigma_NFW(const std::vector< double > rad)
Surface density of the NFW profile.
std::vector< double > DeltaSigma(const std::vector< double > rad)
the total excess surface density profile of the halo.
std::vector< double > m_DeltaSigma_mis(const std::vector< double > rad)
the mis-centered excess surface density profile of the halo (see e.g. Bellagamba et al....
double m_f_off_threshold
lower threshold for f_off
Definition: HaloProfile.h:87
std::function< double(const double, cbl::cosmology::Cosmology, const double)> m_Delta_func
function returning the overdensity factor
Definition: HaloProfile.h:69
std::string m_profile_author
cluster density profile author
Definition: HaloProfile.h:60
double concentration()
get the concentration
Definition: HaloProfile.h:567
double Delta()
get the overdensity
Definition: HaloProfile.h:592
std::vector< double > m_DeltaSigma_including_miscentering(const std::vector< double > rad)
Excess surface density including the miscentering contribution.
double m_max_Smis
maxmimum value where the off-centered Sigma(R) is computed
Definition: HaloProfile.h:93
double(HaloProfile::* m_rho_s_ptr)()
function returning the characteristic density of the cluster profile
Definition: HaloProfile.h:102
double m_rho_s_NFW()
Characteristic density of the NFW profile.
Definition: HaloProfile.cpp:76
double m_A
parameter A in the c-M relation
Definition: HaloProfile.h:132
std::shared_ptr< cosmology::Cosmology > m_cosmology
pointer to the input cosmology
Definition: HaloProfile.h:57
void set_f_off(const double f_off=par::defaultDouble)
set the private member m_f_off
Definition: HaloProfile.h:991
std::vector< double > m_Sigma_NFW_trunc(const std::vector< double > rad)
Surface density of the truncated NFW profile.
void set_sigma_off(const double sigma_off=par::defaultDouble)
set the private member m_sigma_off
Definition: HaloProfile.h:998
void set_trunc_fact(const double trunc_fact=par::defaultDouble)
set the private member m_trunc_fact
Definition: HaloProfile.h:1005
double m_C
parameter C in the c-M relation
Definition: HaloProfile.h:138
std::vector< double >(HaloProfile::* m_DeltaSigma_mis_ptr)(const std::vector< double >)
function returning the miscentering contribution to the total cluster excess surface density for a gi...
Definition: HaloProfile.h:117
std::vector< double > Sigma_2h(const std::vector< double > rad, const std::string bias_author, const std::string method_Pk="EisensteinHu", const std::string interp_type="Linear", const bool NL=false)
the 2-halo contribution to the total surface density profile of the halo, computed by assuming a halo...
void m_set_profile(const cbl::cosmology::Cosmology cosmology, const double redshift, const double conc, const double Mass, const double Delta, const std::string profile_author, const std::string halo_def, const double trunc_fact=3., const bool miscentering=false, const bool single_profile=false, const double sigma_off=0.1, const double f_off=1.)
private function that sets the halo profile parameters. If the miscentering is considered,...
double m_rho_s_NFW_trunc()
Characteristic density of the truncated NFW profile.
Definition: HaloProfile.cpp:89
std::vector< double > m_rho_NFW_trunc(const std::vector< double > rad)
The truncated NFW 3D density profile.
std::vector< double >(HaloProfile::* m_Sigma_cen_ptr)(const std::vector< double >)
function returning the centered cluster surface density for a given radius
Definition: HaloProfile.h:108
void set_cosmology(const cbl::cosmology::Cosmology cosmology)
set the cosmological model
std::vector< double >(HaloProfile::* m_Sigma_ptr)(const std::vector< double >)
function returning the cluster surface density for a given radius
Definition: HaloProfile.h:114
double Mass_Delta(const double Mass, const double Delta_in, const double Delta_out, const double conc, const bool is_input_conc, const double rRmin_guess=1.e-3, const double rRmax_guess=10.) const
The halo mass converted to a different value of , assuming the Navarro-Frenk-White density profile.
bool m_isSet_cM_relation
if true, the concentration-mass relation is set
Definition: HaloProfile.h:126
std::vector< double > DeltaSigma_mis(const std::vector< double > rad)
the miscentering contribution to the excess surface density profile of the halo.
static const std::string defaultString
default std::string value
Definition: Constants.h:336
static const double defaultDouble
default double value
Definition: Constants.h:348
double bias(const double Mmin, const double sigmalgM, const double M0, const double M1, const double alpha, const std::shared_ptr< void > inputs)
the mean galaxy bias
The global namespace of the CosmoBolognaLib
Definition: CAMB.h:38
T Mass(const T RR, const T Rho)
the mass of a sphere of a given radius and density
Definition: Func.h:1243