CosmoBolognaLib
Free Software C++/Python libraries for cosmological calculations
Modelling_Cosmology_DistancePrior.h
Go to the documentation of this file.
1 /********************************************************************
2  * Copyright (C) 2016 by Federico Marulli and Alfonso Veropalumbo *
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 __MODELLINGCOSMDP__
35 #define __MODELLINGCOSMDP__
36 
37 
38 #include "Cosmology.h"
39 #include "Data1D.h"
40 
41 
42 // ===================================================================================================
43 
44 
45 namespace cbl {
46 
47  namespace modelling {
48 
49  namespace cosmo {
50 
51  class CMB_DistancePrior {
52 
53  protected:
54 
56  std::shared_ptr<data::Data> m_dataset;
57 
58  public:
59 
60  CMB_DistancePrior () = default;
61 
62  virtual ~CMB_DistancePrior () = default;
63 
64  static std::shared_ptr<CMB_DistancePrior> Create (const std::string distance_prior_name);
65 
66  virtual std::shared_ptr<data::Data> dataset ()
67  { ErrorCBL("no dataset for base class!", "dataset", "Modelling_Cosmology_DistancePrior.h"); return NULL; }
68 
69  virtual std::vector<double> model (const cbl::cosmology::Cosmology cosmology)
70  { (void)cosmology; ErrorCBL("no model for base class!", "model", "Modelling_Cosmology_DistancePrior.h"); std::vector<double> vv; return vv; }
71 
72  };
73 
74  class Aubourg15_Planck15 : public CMB_DistancePrior
75  {
76 
77  public:
78 
79  Aubourg15_Planck15 () {
80  std::vector<double> redshift = {0., 0., 1090.};
81  std::vector<double> data = {0.02245, 0.1386, 94.33};
82  std::vector<std::vector<double>> covariance(3, std::vector<double>(3, 0));
83  covariance[0][0] = 1.286e-7;
84  covariance[0][1] = -6.033e-7;
85  covariance[0][2] = -1.443e-5;
86 
87  covariance[1][0] = -6.033e-7;
88  covariance[1][1] = 7.542e-6;
89  covariance[1][2] = -3.605e-5;
90 
91  covariance[2][0] = 1.443e-5;
92  covariance[2][1] = -3.605e-5;
93  covariance[2][2] = 0.004264;
94 
95  m_dataset = std::make_shared<data::Data1D>(data::Data1D(redshift, data, covariance));
96  }
97 
98  std::shared_ptr<data::Data> dataset() {return m_dataset; }
99 
100  std::vector<double> model (const cbl::cosmology::Cosmology cosmology)
101  {
102  std::vector<double> mm(3, 0);
103 
104  mm[0] = cosmology.Omega_baryon()*cosmology.hh()*cosmology.hh();
105  mm[1] = cosmology.Omega_matter()*cosmology.hh()*cosmology.hh();
106  mm[2] = cosmology.D_M(m_dataset->xx(2))/cosmology.rs_CAMB();
107 
108  return mm;
109  }
110 
111  };
112 
113  class Aubourg15_WMAP09 : public CMB_DistancePrior {
114 
115  public:
116 
117  Aubourg15_WMAP09 () {
118  std::vector<double> redshift = {0., 0., 1090.};
119  std::vector<double> data = {0.02259, 0.1354, 94.51};
120  std::vector<std::vector<double>> covariance(3, std::vector<double>(3, 0));
121  covariance[0][0] = 2.864-7;
122  covariance[0][1] = -4.809e-7;
123  covariance[0][2] = -1.111-5;
124 
125  covariance[1][0] = -4.809e-7;
126  covariance[1][1] = 1.908e-5;
127  covariance[1][2] = -7.495e-6;
128 
129  covariance[2][0] = -1.111e-5;
130  covariance[2][1] = -7.495e-6;
131  covariance[2][2] = 0.02542;
132 
133  m_dataset = std::make_shared<data::Data1D>(data::Data1D(redshift, data, covariance));
134  }
135 
136  std::shared_ptr<data::Data> dataset () { return m_dataset; }
137 
138  std::vector<double> model (const cbl::cosmology::Cosmology cosmology)
139  {
140  std::vector<double> mm(3, 0);
141 
142  mm[0] = cosmology.Omega_baryon()*cosmology.hh()*cosmology.hh();
143  mm[1] = cosmology.Omega_matter()*cosmology.hh()*cosmology.hh();
144  mm[2] = cosmology.D_M(m_dataset->xx(2))/cosmology.rs_CAMB();
145 
146  return mm;
147  }
148  };
149  }
150  }
151 }
152 
153 #endif
The class Cosmology.
The class Data1D.
The class Cosmology.
Definition: Cosmology.h:277
double Omega_baryon() const
get the private member Cosmology::m_Omega_baryon
Definition: Cosmology.h:1126
double rs_CAMB() const
the sound horizon at the drag epoch estimated with CAMB [http://camb.info/], analytical formula by Au...
Definition: BAO.cpp:183
double hh() const
get the private member Cosmology::m_hh
Definition: Cosmology.h:1191
double Omega_matter() const
get the private member Cosmology::m_Omega_matter
Definition: Cosmology.h:1119
double D_M(const double redshift) const
the comoving transverse distance at a given redshift
Definition: Cosmology.cpp:832
The global namespace of the CosmoBolognaLib
Definition: CAMB.h:38
int ErrorCBL(const std::string msg, const std::string functionCBL, const std::string fileCBL, const cbl::glob::ExitCode exitCode=cbl::glob::ExitCode::_error_)
throw an exception: it is used for handling exceptions inside the CosmoBolognaLib
Definition: Kernel.h:780