CosmoBolognaLib
Free Software C++/Python libraries for cosmological calculations
CosmClassFunc.h
Go to the documentation of this file.
1 /********************************************************************
2  * Copyright (C) 2010 by Federico Marulli *
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 
35 #ifndef __COSMCLASSFUNC__
36 #define __COSMCLASSFUNC__
37 
38 
39 // =====================================================================================
40 
41 
42 namespace cbl {
43 
44  namespace classfunc {
45 
46  class E_inv {
47 
48  private:
49  double m_Omega_matter;
50  double m_Omega_baryon;
51  double m_Omega_neutrinos;
52  double m_massless_neutrinos;
53  int m_massive_neutrinos;
54  double m_Omega_DE;
55  double m_Omega_radiation;
56  double m_hh;
57  double m_scalar_amp;
58  double m_scalar_pivot;
59  double m_n_spec;
60  double m_w0;
61  double m_wa;
62  double m_fNL;
63  int m_type_NG;
64  double m_tau;
65  std::string m_model;
66  bool m_unit;
67 
68  public:
69  E_inv (double Omega_matter, double Omega_baryon, double Omega_neutrinos, double massless_neutrinos, int massive_neutrinos, double Omega_DE, double Omega_radiation, double hh, double scalar_amp, double scalar_pivot, double n_spec, double w0, double wa, double fNL, int type_NG, double tau, std::string model, bool unit)
70  : m_Omega_matter(Omega_matter), m_Omega_baryon(Omega_baryon), m_Omega_neutrinos(Omega_neutrinos), m_massless_neutrinos(massless_neutrinos), m_massive_neutrinos(massive_neutrinos), m_Omega_DE(Omega_DE), m_Omega_radiation(Omega_radiation), m_hh(hh), m_scalar_amp(scalar_amp), m_scalar_pivot(scalar_pivot), m_n_spec(n_spec), m_w0(w0), m_wa(wa), m_fNL(fNL), m_type_NG(type_NG), m_tau(tau), m_model(model), m_unit(unit) {}
71 
72  double operator() (double redshift)
73  {
74  cosmology::Cosmology cosm(m_Omega_matter, m_Omega_baryon, m_Omega_neutrinos, m_massless_neutrinos, m_massive_neutrinos, m_Omega_DE, m_Omega_radiation, m_hh, m_scalar_amp, m_scalar_pivot, m_n_spec, m_w0, m_wa, m_fNL, m_type_NG, m_tau, m_model, m_unit);
75 
76  return 1./cosm.EE(redshift);
77  }
78  };
79 
80 
81  // =====================================================================================
82 
83 
84  class E_inv2
85  {
86  private:
87  double m_Omega_matter;
88  double m_Omega_baryon;
89  double m_Omega_neutrinos;
90  double m_massless_neutrinos;
91  int m_massive_neutrinos;
92  double m_Omega_DE;
93  double m_Omega_radiation;
94  double m_hh;
95  double m_scalar_amp;
96  double m_scalar_pivot;
97  double m_n_spec;
98  double m_w0;
99  double m_wa;
100  double m_fNL;
101  int m_type_NG;
102  double m_tau;
103  std::string m_model;
104  bool m_unit;
105 
106  public:
107  E_inv2 (double Omega_matter, double Omega_baryon, double Omega_neutrinos, double massless_neutrinos, int massive_neutrinos, double Omega_DE, double Omega_radiation, double hh, double scalar_amp, double scalar_pivot, double n_spec, double w0, double wa, double fNL, int type_NG, double tau, std::string model, bool unit)
108  : m_Omega_matter(Omega_matter), m_Omega_baryon(Omega_baryon), m_Omega_neutrinos(Omega_neutrinos), m_massless_neutrinos(massless_neutrinos), m_massive_neutrinos(massive_neutrinos), m_Omega_DE(Omega_DE), m_Omega_radiation(Omega_radiation), m_hh(hh), m_scalar_amp(scalar_amp), m_scalar_pivot(scalar_pivot), m_n_spec(n_spec), m_w0(w0), m_wa(wa), m_fNL(fNL), m_type_NG(type_NG), m_tau(tau), m_model(model), m_unit(unit) {}
109 
110  double operator() (double redshift)
111  {
112  cosmology::Cosmology cosm (m_Omega_matter, m_Omega_baryon, m_Omega_neutrinos, m_massless_neutrinos, m_massive_neutrinos, m_Omega_DE, m_Omega_radiation, m_hh, m_scalar_amp, m_scalar_pivot, m_n_spec, m_w0, m_wa, m_fNL, m_type_NG, m_tau, m_model, m_unit);
113 
114  return 1./(1.+redshift)/cosm.EE(redshift);
115  }
116  };
117 
118 
119  // =====================================================================================
120 
121 
122  class E_inv3 {
123 
124  private:
125  double m_Omega_matter;
126  double m_Omega_baryon;
127  double m_Omega_neutrinos;
128  double m_massless_neutrinos;
129  int m_massive_neutrinos;
130  double m_Omega_DE;
131  double m_Omega_radiation;
132  double m_hh;
133  double m_scalar_amp;
134  double m_scalar_pivot;
135  double m_n_spec;
136  double m_w0;
137  double m_wa;
138  double m_fNL;
139  int m_type_NG;
140  double m_tau;
141  std::string m_model;
142 
143  public:
144  E_inv3 (double Omega_matter, double Omega_baryon, double Omega_neutrinos, double massless_neutrinos, int massive_neutrinos, double Omega_DE, double Omega_radiation, double hh, double scalar_amp, double scalar_pivot, double n_spec, double w0, double wa, double fNL, int type_NG, double tau, std::string model)
145  : m_Omega_matter(Omega_matter), m_Omega_baryon(Omega_baryon), m_Omega_neutrinos(Omega_neutrinos), m_massless_neutrinos(massless_neutrinos), m_massive_neutrinos(massive_neutrinos), m_Omega_DE(Omega_DE), m_Omega_radiation(Omega_radiation), m_hh(hh), m_scalar_amp(scalar_amp), m_scalar_pivot(scalar_pivot), m_n_spec(n_spec), m_w0(w0), m_wa(wa), m_fNL(fNL), m_type_NG(type_NG), m_tau(tau), m_model(model) {}
146 
147  double operator() (double aa)
148  {
149  cosmology::Cosmology cosm (m_Omega_matter, m_Omega_baryon, m_Omega_neutrinos, m_massless_neutrinos, m_massive_neutrinos, m_Omega_DE, m_Omega_radiation, m_hh, m_scalar_amp, m_scalar_pivot, m_n_spec, m_w0, m_wa, m_fNL, m_type_NG, m_tau, m_model, 0);
150  double redshift = 1./aa-1.;
151  return (1.+redshift)/cosm.EE(redshift);
152  }
153  };
154 
155 
156  // =====================================================================================
157 
158 
159  class func_fDE { // test in CPL parameterisation
160 
161  private:
162  double m_w0;
163  double m_wa;
164 
165  public:
166  func_fDE (double w0, double wa)
167  : m_w0(w0), m_wa(wa) {}
168 
169  double operator() (double redshift)
170  {
171  cosmology::Cosmology cosm;
172  cosm.set_w0(m_w0); cosm.set_wa(m_wa);
173 
174  return (1.+cosm.w_CPL(redshift))/(1.+redshift);
175  }
176  };
177 
178 
179  // =====================================================================================
180 
181 
182  class func_z {
183 
184  private:
185  double m_Omega_matter;
186  double m_Omega_baryon;
187  double m_Omega_neutrinos;
188  double m_massless_neutrinos;
189  int m_massive_neutrinos;
190  double m_Omega_DE;
191  double m_Omega_radiation;
192  double m_hh;
193  double m_scalar_amp;
194  double m_scalar_pivot;
195  double m_n_spec;
196  double m_w0, m_wa;
197  double m_fNL;
198  int m_type_NG;
199  double m_tau;
200  std::string m_model;
201  bool m_unit;
202  double m_dd;
203 
204  public:
205  func_z (double Omega_matter, double Omega_baryon, double Omega_neutrinos, double massless_neutrinos, int massive_neutrinos, double Omega_DE, double Omega_radiation, double hh, double scalar_amp, double scalar_pivot, double n_spec, double w0, double wa, double fNL, int type_NG, double tau, std::string model, bool unit, double dd)
206  : m_Omega_matter(Omega_matter), m_Omega_baryon(Omega_baryon), m_Omega_neutrinos(Omega_neutrinos), m_massless_neutrinos(massless_neutrinos), m_massive_neutrinos(massive_neutrinos), m_Omega_DE(Omega_DE), m_Omega_radiation(Omega_radiation), m_hh(hh), m_scalar_amp(scalar_amp), m_scalar_pivot(scalar_pivot), m_n_spec(n_spec), m_w0(w0), m_wa(wa), m_fNL(fNL), m_type_NG(type_NG), m_tau(tau), m_model(model), m_unit(unit), m_dd(dd) {}
207 
208  double operator() (double redshift)
209  {
210  cosmology::Cosmology cosm(m_Omega_matter, m_Omega_baryon, m_Omega_neutrinos, m_massless_neutrinos, m_massive_neutrinos, m_Omega_DE, m_Omega_radiation, m_hh, m_scalar_amp, m_scalar_pivot, m_n_spec, m_w0, m_wa, m_fNL, m_type_NG, m_tau, m_model, m_unit);
211 
212  return cosm.D_C(redshift)-m_dd;
213  }
214  };
215 
216 
217  // =====================================================================================
218 
219 
220  class func_V {
221 
222  private:
223  double m_Omega_matter;
224  double m_Omega_baryon;
225  double m_Omega_neutrinos;
226  double m_massless_neutrinos;
227  int m_massive_neutrinos;
228  double m_Omega_DE;
229  double m_Omega_radiation;
230  double m_hh;
231  double m_scalar_amp;
232  double m_scalar_pivot;
233  double m_n_spec;
234  double m_w0, m_wa;
235  double m_fNL;
236  int m_type_NG;
237  double m_tau;
238  std::string m_model;
239  bool m_unit;
240  double m_z_min;
241  double m_Area;
242  double m_VV;
243 
244  public:
245  func_V (double Omega_matter, double Omega_baryon, double Omega_neutrinos, double massless_neutrinos, int massive_neutrinos, double Omega_DE, double Omega_radiation, double hh, double scalar_amp, double scalar_pivot, double n_spec, double w0, double wa, double fNL, int type_NG, double tau, std::string model, bool unit, double z_min, double Area, double VV)
246  : m_Omega_matter(Omega_matter), m_Omega_baryon(Omega_baryon), m_Omega_neutrinos(Omega_neutrinos), m_massless_neutrinos(massless_neutrinos), m_massive_neutrinos(massive_neutrinos), m_Omega_DE(Omega_DE), m_Omega_radiation(Omega_radiation), m_hh(hh), m_scalar_amp(scalar_amp), m_scalar_pivot(scalar_pivot), m_n_spec(n_spec), m_w0(w0), m_wa(wa), m_fNL(fNL), m_type_NG(type_NG), m_tau(tau), m_model(model), m_unit(unit), m_z_min(z_min), m_Area(Area), m_VV(VV) {}
247 
248  double operator() (double z_max)
249  {
250  cosmology::Cosmology cosm (m_Omega_matter, m_Omega_baryon, m_Omega_neutrinos, m_massless_neutrinos, m_massive_neutrinos, m_Omega_DE, m_Omega_radiation, m_hh, m_scalar_amp, m_scalar_pivot, m_n_spec, m_w0, m_wa, m_fNL, m_type_NG, m_tau, m_model, m_unit);
251 
252  return cosm.Volume(m_z_min, z_max, m_Area)-m_VV;
253  }
254  };
255 
256 
257  // =====================================================================================
258 
259 
260  class func_zt {
261 
262  private:
263  double m_Omega_matter;
264  double m_Omega_baryon;
265  double m_Omega_neutrinos;
266  double m_massless_neutrinos;
267  int m_massive_neutrinos;
268  double m_Omega_DE;
269  double m_Omega_radiation;
270  double m_hh;
271  double m_scalar_amp;
272  double m_scalar_pivot;
273  double m_n_spec;
274  double m_w0;
275  double m_wa;
276  double m_fNL;
277  int m_type_NG;
278  double m_tau;
279  std::string m_model;
280  bool m_unit;
281  double m_tt;
282 
283  public:
284  func_zt (double Omega_matter, double Omega_baryon, double Omega_neutrinos, double massless_neutrinos, int massive_neutrinos, double Omega_DE, double Omega_radiation, double hh, double scalar_amp, double scalar_pivot, double n_spec, double w0, double wa, double fNL, int type_NG, double tau, std::string model, bool unit, double tt)
285  : m_Omega_matter(Omega_matter), m_Omega_baryon(Omega_baryon), m_Omega_neutrinos(Omega_neutrinos), m_massless_neutrinos(massless_neutrinos), m_massive_neutrinos(massive_neutrinos), m_Omega_DE(Omega_DE), m_Omega_radiation(Omega_radiation), m_hh(hh), m_scalar_amp(scalar_amp), m_scalar_pivot(scalar_pivot), m_n_spec(n_spec), m_w0(w0), m_wa(wa), m_fNL(fNL), m_type_NG(type_NG), m_tau(tau), m_model(model), m_unit(unit), m_tt(tt) {}
286 
287  double operator() (double redshift)
288  {
289  cosmology::Cosmology cosm (m_Omega_matter, m_Omega_baryon, m_Omega_neutrinos, m_massless_neutrinos, m_massive_neutrinos, m_Omega_DE, m_Omega_radiation, m_hh, m_scalar_amp, m_scalar_pivot, m_n_spec, m_w0, m_wa, m_fNL, m_type_NG, m_tau, m_model, m_unit);
290 
291  return cosm.cosmic_time(redshift)-m_tt;
292  }
293  };
294 
295 
296  // =====================================================================================
297 
298 
299  class func_xistar {
300 
301  private:
302  double m_Omega_matter;
303  double m_Omega_baryon;
304  double m_Omega_neutrinos;
305  double m_massless_neutrinos;
306  int m_massive_neutrinos;
307  double m_Omega_DE;
308  double m_Omega_radiation;
309  double m_hh;
310  double m_scalar_amp;
311  double m_scalar_pivot;
312  double m_n_spec;
313  double m_w0;
314  double m_wa;
315  double m_fNL;
316  int m_type_NG;
317  double m_tau;
318  std::string m_model;
319  bool m_unit;
320  double m_rr;
321  double m_redshift;
322  bool m_store_output;
323  std::string m_output_root;
324  double m_kmax;
325  double m_k_star;
326 
327  public:
328  func_xistar (double Omega_matter, double Omega_baryon, double Omega_neutrinos, double massless_neutrinos, int massive_neutrinos, double Omega_DE, double Omega_radiation, double hh, double scalar_amp, double scalar_pivot, double n_spec, double w0, double wa, double fNL, int type_NG, double tau, std::string model, bool unit, double rr, double redshift, bool store_output, std::string output_root, double kmax, double k_star)
329  : m_Omega_matter(Omega_matter), m_Omega_baryon(Omega_baryon), m_Omega_neutrinos(Omega_neutrinos), m_massless_neutrinos(massless_neutrinos), m_massive_neutrinos(massive_neutrinos), m_Omega_DE(Omega_DE), m_Omega_radiation(Omega_radiation), m_hh(hh), m_scalar_amp(scalar_amp), m_scalar_pivot(scalar_pivot), m_n_spec(n_spec), m_w0(w0), m_wa(wa), m_fNL(fNL), m_type_NG(type_NG), m_tau(tau), m_model(model), m_unit(unit), m_rr(rr), m_redshift(redshift), m_store_output(store_output), m_output_root(output_root), m_kmax(kmax), m_k_star(k_star) {}
330 
331  double operator() (double kk)
332  {
333  cosmology::Cosmology cosm(m_Omega_matter, m_Omega_baryon, m_Omega_neutrinos, m_massless_neutrinos, m_massive_neutrinos, m_Omega_DE, m_Omega_radiation, m_hh, m_scalar_amp, m_scalar_pivot, m_n_spec, m_w0, m_wa, m_fNL, m_type_NG, m_tau, m_model, m_unit);
334 
335  std::string method_PkC = "CAMB";
336  std::string method_PkEH = "EisensteinHu";
337  bool NL = 0;
338  int norm = 0;
339 
340  double Plin_BAO = cosm.Pk_matter({kk}, method_PkC, NL, m_redshift, m_store_output, m_output_root, norm, m_kmax)[0]-cosm.Pk_matter({kk}, method_PkEH, NL, m_redshift, m_store_output)[0];
341  Plin_BAO *= exp(-kk*kk*0.5/(m_k_star*m_k_star));
342 
343  return Plin_BAO*sin(kk*m_rr)*kk/m_rr;
344  }
345  };
346 
347 
348  // =====================================================================================
349 
350 
351  class func_V2 {
352 
353  private:
354  double m_Omega_matter;
355  double m_Omega_baryon;
356  double m_Omega_neutrinos;
357  double m_massless_neutrinos;
358  int m_massive_neutrinos;
359  double m_Omega_DE;
360  double m_Omega_radiation;
361  double m_hh;
362  double m_scalar_amp;
363  double m_scalar_pivot;
364  double m_n_spec;
365  double m_w0, m_wa;
366  double m_fNL;
367  int m_type_NG;
368  double m_tau;
369  std::string m_model;
370  bool m_unit;
371  std::string m_method_Pk;
372  double m_rr;
373  double m_redshift;
374  bool m_store_output;
375 
376  public:
377  func_V2 (double Omega_matter, double Omega_baryon, double Omega_neutrinos, double massless_neutrinos, int massive_neutrinos, double Omega_DE, double Omega_radiation, double hh, double scalar_amp, double scalar_pivot, double n_spec, double w0, double wa, double fNL, int type_NG, double tau, std::string model, bool unit, std::string method_Pk, double rr, double redshift, bool store_output)
378  : m_Omega_matter(Omega_matter), m_Omega_baryon(Omega_baryon), m_Omega_neutrinos(Omega_neutrinos), m_massless_neutrinos(massless_neutrinos), m_massive_neutrinos(massive_neutrinos), m_Omega_DE(Omega_DE), m_Omega_radiation(Omega_radiation), m_hh(hh), m_scalar_amp(scalar_amp), m_scalar_pivot(scalar_pivot), m_n_spec(n_spec), m_w0(w0), m_wa(wa), m_fNL(fNL), m_type_NG(type_NG), m_tau(tau), m_model(model), m_unit(unit), m_method_Pk(method_Pk), m_rr(rr), m_redshift(redshift), m_store_output(store_output) {}
379 
380  double operator() (double kk)
381  {
382  cosmology::Cosmology cosm (m_Omega_matter, m_Omega_baryon, m_Omega_neutrinos, m_massless_neutrinos, m_massive_neutrinos, m_Omega_DE, m_Omega_radiation, m_hh, m_scalar_amp, m_scalar_pivot, m_n_spec, m_w0, m_wa, m_fNL, m_type_NG, m_tau, m_model, m_unit);
383 
384  if (m_method_Pk=="EisensteinHu")
385  return pow(cosm.linear_growth_rate(m_redshift, kk),2)*cosm.Pk_matter({kk}, m_method_Pk, false, m_redshift, m_store_output)[0]*pow(cbl::TopHat_WF(kk*m_rr),2);
386 
387  else return cbl::ErrorCBL("", "func_V2", "CosmClassFunc.h");
388  }
389  };
390 
391 
392  // =====================================================================================
393 
394 
395  class func_V2_Table {
396 
397  private:
398  double m_Omega_matter;
399  double m_Omega_baryon;
400  double m_Omega_neutrinos;
401  double m_massless_neutrinos;
402  int m_massive_neutrinos;
403  double m_Omega_DE;
404  double m_Omega_radiation;
405  double m_hh;
406  double m_scalar_amp;
407  double m_scalar_pivot;
408  double m_n_spec;
409  double m_w0;
410  double m_wa;
411  double m_fNL;
412  int m_type_NG;
413  double m_tau;
414  std::string m_model;
415  bool m_unit;
416  std::vector<double> m_lgkk, m_lgPk;
417  double m_rr;
418  double m_redshift;
419 
420  public:
421  func_V2_Table (double Omega_matter, double Omega_baryon, double Omega_neutrinos, double massless_neutrinos, int massive_neutrinos, double Omega_DE, double Omega_radiation, double hh, double scalar_amp, double scalar_pivot, double n_spec, double w0, double wa, double fNL, int type_NG, double tau, std::string model, bool unit, std::vector<double> lgkk, std::vector<double> lgPk, double rr, double redshift)
422  : m_Omega_matter(Omega_matter), m_Omega_baryon(Omega_baryon), m_Omega_neutrinos(Omega_neutrinos), m_massless_neutrinos(massless_neutrinos), m_massive_neutrinos(massive_neutrinos), m_Omega_DE(Omega_DE), m_Omega_radiation(Omega_radiation), m_hh(hh), m_scalar_amp(scalar_amp), m_scalar_pivot(scalar_pivot), m_n_spec(n_spec), m_w0(w0), m_wa(wa), m_fNL(fNL), m_type_NG(type_NG), m_tau(tau), m_model(model), m_unit(unit), m_lgkk(lgkk), m_lgPk(lgPk), m_rr(rr), m_redshift(redshift) {}
423 
424  double operator() (double kk)
425  {
426  double fact = (m_unit) ? 1. : m_hh;
427  double lgk = log10(kk/fact);
428 
429  cosmology::Cosmology cosm (m_Omega_matter, m_Omega_baryon, m_Omega_neutrinos, m_massless_neutrinos, m_massive_neutrinos, m_Omega_DE, m_Omega_radiation, m_hh, m_scalar_amp, m_scalar_pivot, m_n_spec, m_w0, m_wa, m_fNL, m_type_NG, m_tau, m_model, m_unit);
430 
431  double lgPkK = cbl::interpolated(lgk, m_lgkk, m_lgPk, "Linear");
432 
433  return pow(cosm.linear_growth_rate(m_redshift, kk),2)*pow(10.,lgPkK)/pow(fact, m_n_spec)*pow(cbl::TopHat_WF(kk*m_rr),2);
434  }
435  };
436 
437 
438  // =====================================================================================
439 
440 
441  class func_sigma2 {
442 
443  private:
444  double m_Omega_matter;
445  double m_Omega_baryon;
446  double m_Omega_neutrinos;
447  double m_massless_neutrinos;
448  int m_massive_neutrinos;
449  double m_Omega_DE;
450  double m_Omega_radiation;
451  double m_hh;
452  double m_scalar_amp;
453  double m_scalar_pivot;
454  double m_n_spec;
455  double m_w0;
456  double m_wa;
457  double m_fNL;
458  int m_type_NG;
459  double m_tau;
460  std::string m_model;
461  bool m_unit;
462  std::string m_method_Pk;
463  double m_rr;
464  double m_redshift;
465  bool m_store_output;
466 
467  public:
468  func_sigma2 (double Omega_matter, double Omega_baryon, double Omega_neutrinos, double massless_neutrinos, int massive_neutrinos, double Omega_DE, double Omega_radiation, double hh, double scalar_amp, double scalar_pivot, double n_spec, double w0, double wa, double fNL, int type_NG, double tau, std::string model, bool unit, std::string method_Pk, double rr, double redshift, bool store_output)
469  : m_Omega_matter(Omega_matter), m_Omega_baryon(Omega_baryon), m_Omega_neutrinos(Omega_neutrinos), m_massless_neutrinos(massless_neutrinos), m_massive_neutrinos(massive_neutrinos), m_Omega_DE(Omega_DE), m_Omega_radiation(Omega_radiation), m_hh(hh), m_scalar_amp(scalar_amp), m_scalar_pivot(scalar_pivot), m_n_spec(n_spec), m_w0(w0), m_wa(wa), m_fNL(fNL), m_type_NG(type_NG), m_tau(tau), m_model(model), m_unit(unit), m_method_Pk(method_Pk), m_rr(rr), m_redshift(redshift), m_store_output(store_output) {}
470 
471  double operator() (double kk)
472  {
473  cosmology::Cosmology cosm (m_Omega_matter, m_Omega_baryon, m_Omega_neutrinos, m_massless_neutrinos, m_massive_neutrinos, m_Omega_DE, m_Omega_radiation, m_hh, m_scalar_amp, m_scalar_pivot, m_n_spec, m_w0, m_wa, m_fNL, m_type_NG, m_tau, m_model, m_unit);
474 
475  if (m_method_Pk=="EisensteinHu")
476  return pow(cosm.linear_growth_rate(m_redshift, kk),2)*cosm.Pk_matter({kk}, m_method_Pk, false, m_redshift, m_store_output)[0]*(1.-pow(cbl::TopHat_WF(kk*m_rr),2));
477 
478  else return cbl::ErrorCBL("", "func_sigma2", "CosmClassFunc.h");
479  }
480  };
481 
482 
483  // =====================================================================================
484 
485 
486  class func_sigma2_Table {
487 
488  private:
489  double m_Omega_matter;
490  double m_Omega_baryon;
491  double m_Omega_neutrinos;
492  double m_massless_neutrinos;
493  int m_massive_neutrinos;
494  double m_Omega_DE;
495  double m_Omega_radiation;
496  double m_hh;
497  double m_scalar_amp;
498  double m_scalar_pivot;
499  double m_n_spec;
500  double m_w0;
501  double m_wa;
502  double m_fNL;
503  int m_type_NG;
504  double m_tau;
505  std::string m_model;
506  bool m_unit;
507  std::vector<double> m_lgkk, m_lgPk;
508  double m_rr;
509  double m_redshift;
510 
511  public:
512  func_sigma2_Table (double Omega_matter, double Omega_baryon, double Omega_neutrinos, double massless_neutrinos, int massive_neutrinos, double Omega_DE, double Omega_radiation, double hh, double scalar_amp, double scalar_pivot, double n_spec, double w0, double wa, double fNL, int type_NG, double tau, std::string model, bool unit, std::vector<double> lgkk, std::vector<double> lgPk, double rr, double redshift)
513  : m_Omega_matter(Omega_matter), m_Omega_baryon(Omega_baryon), m_Omega_neutrinos(Omega_neutrinos), m_massless_neutrinos(massless_neutrinos), m_massive_neutrinos(massive_neutrinos), m_Omega_DE(Omega_DE), m_Omega_radiation(Omega_radiation), m_hh(hh), m_scalar_amp(scalar_amp), m_scalar_pivot(scalar_pivot), m_n_spec(n_spec), m_w0(w0), m_wa(wa), m_fNL(fNL), m_type_NG(type_NG), m_tau(tau), m_model(model), m_unit(unit), m_lgkk(lgkk), m_lgPk(lgPk), m_rr(rr), m_redshift(redshift) {}
514 
515  double operator() (double kk)
516  {
517  double fact = (m_unit) ? 1. : m_hh;
518  double lgk = log10(kk/fact);
519 
520  cosmology::Cosmology cosm (m_Omega_matter, m_Omega_baryon, m_Omega_neutrinos, m_massless_neutrinos, m_massive_neutrinos, m_Omega_DE, m_Omega_radiation, m_hh, m_scalar_amp, m_scalar_pivot, m_n_spec, m_w0, m_wa, m_fNL, m_type_NG, m_tau, m_model, m_unit);
521 
522  double lgPkK = cbl::interpolated(lgk, m_lgkk, m_lgPk, "Linear");
523 
524  return pow(cosm.linear_growth_rate(m_redshift, kk),2)*pow(10.,lgPkK)/pow(fact, m_n_spec)*(1.-pow(cbl::TopHat_WF(kk*m_rr),2));
525  }
526  };
527 
528 
529  // =====================================================================================
530 
531 
532  class func_MhaloMin {
533 
534  private:
535  double m_Omega_matter;
536  double m_Omega_baryon;
537  double m_Omega_neutrinos;
538  double m_massless_neutrinos;
539  int m_massive_neutrinos;
540  double m_Omega_DE;
541  double m_Omega_radiation;
542  double m_hh;
543  double m_scalar_amp;
544  double m_scalar_pivot;
545  double m_n_spec;
546  double m_w0;
547  double m_wa;
548  double m_fNL;
549  int m_type_NG;
550  double m_tau;
551  std::string m_model;
552  bool m_unit;
553  bool m_angle_rad;
554  double m_n_halo, m_Mmax, m_z_min, m_z_max, m_Area;
555  std::string m_model_MF, m_method_SS;
556  bool m_store_output;
557  std::string m_output_root;
558  double m_Delta;
559  std::string m_interpType;
560  double m_kmax;
561  std::string m_input_file;
562  bool m_is_parameter_file;
563 
564  public:
565  func_MhaloMin (double Omega_matter, double Omega_baryon, double Omega_neutrinos, double massless_neutrinos, int massive_neutrinos, double Omega_DE, double Omega_radiation, double hh, double scalar_amp, double scalar_pivot, double n_spec, double w0, double wa, double fNL, int type_NG, double tau, std::string model, bool unit, double n_halo, double Area, bool angle_rad, double z_min, double z_max, double Mmax, std::string model_MF, std::string method_SS, bool store_output, std::string output_root, const double Delta, std::string interpType, double kmax, std::string input_file, bool is_parameter_file)
566  : m_Omega_matter(Omega_matter), m_Omega_baryon(Omega_baryon), m_Omega_neutrinos(Omega_neutrinos), m_massless_neutrinos(massless_neutrinos), m_massive_neutrinos(massive_neutrinos), m_Omega_DE(Omega_DE), m_Omega_radiation(Omega_radiation), m_hh(hh), m_scalar_amp(scalar_amp), m_scalar_pivot(scalar_pivot), m_n_spec(n_spec), m_w0(w0), m_wa(wa), m_fNL(fNL), m_type_NG(type_NG), m_tau(tau), m_model(model), m_unit(unit), m_angle_rad(angle_rad), m_n_halo(n_halo), m_Mmax(Mmax), m_z_min(z_min), m_z_max(z_max), m_Area(Area), m_model_MF(model_MF), m_method_SS(method_SS), m_store_output(store_output), m_output_root(output_root), m_Delta(Delta), m_interpType(interpType), m_kmax(kmax), m_input_file(input_file), m_is_parameter_file(is_parameter_file) {}
567 
568  double operator() (double lgMmin)
569  {
570  cosmology::Cosmology cosm (m_Omega_matter, m_Omega_baryon, m_Omega_neutrinos, m_massless_neutrinos, m_massive_neutrinos, m_Omega_DE, m_Omega_radiation, m_hh, m_scalar_amp, m_scalar_pivot, m_n_spec, m_w0, m_wa, m_fNL, m_type_NG, m_tau, m_model, m_unit);
571 
572  double Mmin = pow(10., lgMmin);
573 
574  double n_halo_expected = cosm.n_haloes(Mmin, m_Mmax, m_z_min, m_z_max, m_angle_rad, m_model_MF, m_method_SS, m_store_output, m_output_root, m_Delta, m_interpType, m_kmax, m_input_file, m_is_parameter_file)*m_Area;
575 
576  return m_n_halo-n_halo_expected;
577  }
578  };
579 
580 
581  // =====================================================================================
582 
583 
584  class func_kstar {
585 
586  private:
587  double m_hh;
588  bool m_unit;
589  std::vector<double> m_lgkk, m_lgPk;
590 
591  public:
592  func_kstar (double hh, bool unit, std::vector<double> lgkk, std::vector<double> lgPk)
593  : m_hh(hh), m_unit(unit), m_lgkk(lgkk), m_lgPk(lgPk) {}
594 
595  double operator() (double kk)
596  {
597  double fact = (m_unit) ? 1. : m_hh;
598  double lgk = log10(kk/fact);
599 
600  double lgPkK = cbl::interpolated(lgk, m_lgkk, m_lgPk, "Linear");
601 
602  return pow(10.,lgPkK);
603  }
604  };
605 
606  }
607 }
608 
609 #endif
The global namespace of the CosmoBolognaLib
Definition: CAMB.h:38
T TopHat_WF(const T kR)
the top-hat window function
Definition: Func.h:1195
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
double interpolated(const double _xx, const std::vector< double > xx, const std::vector< double > yy, const std::string type)
1D interpolation
Definition: Func.cpp:445