CosmoBolognaLib
Free Software C++/Python libraries for cosmological calculations
Halo_occupation_distribution.cpp
1 #include "Catalogue.h"
2 #include "Cosmology.h"
3 
4 using namespace cbl;
5 using namespace std;
6 
7 int main () {
8 
9  try {
10 
11  const double OmM = 0.2711;
12  const double Omb = 0.0451;
13  const double Omn = 0.;
14  const double massless = 3.04;
15  const int massive = 0;
16  const double Omr = 0.;
17  const double OmL = 0.7289;
18  const double hh = 0.703;
19  const double As = 2.194e-9;
20  const double pivot = 0.05;
21  const double ns = 0.96;
22  const double w0 = -1.;
23  const double wa = 0.;
24 
25  cbl::cosmology::Cosmology cosm {OmM, Omb, Omn, massless, massive, OmL, Omr, hh, As, pivot, ns, w0, wa};
26  cosm.set_sigma8(0.809);
27 
29  vector<int> column = {3, 5, 6, 7};
30 
31  const string file_catalogue = "./LCDM_CoDECS_Groups_092.txt";
32  const int comments = 0;
33  const double nSub = 1.1;
34  const double fact = 0.001;
35 
36  catalogue::Catalogue catalogue_input {catalogue::ObjectType::_HostHalo_, CoordinateType::_comoving_, attributes, column, {file_catalogue}, comments, nSub, fact};
37  cout << "Catalogue read! " << endl;
38 
39  for (size_t i=0; i<catalogue_input.nObjects(); i++)
40  catalogue_input.set_var(i, catalogue::Var::_Mass_, catalogue_input.var(i, catalogue::Var::_Mass_)*1.e10);
41 
42  cout << "\n X MIN : " << catalogue_input.Min(catalogue::Var::_X_) << " -- X MAX " << catalogue_input.Max(catalogue::Var::_X_) << endl;
43  cout << " Y MIN : " << catalogue_input.Min(catalogue::Var::_Y_) << " -- Y MAX " << catalogue_input.Max(catalogue::Var::_Y_) << endl;
44  cout << " Z MIN : " << catalogue_input.Min(catalogue::Var::_Z_) << " -- Z MAX " << catalogue_input.Max(catalogue::Var::_Z_) << endl;
45  cout << " Mass MIN : " << catalogue_input.Min(catalogue::Var::_Mass_) << " -- Mass MAX " << catalogue_input.Max(catalogue::Var::_Mass_) << endl << endl;
46 
47  catalogue::Catalogue catalogue_output {catalogue_input, cosm, catalogue::HODType::_Zehavi05_, -19., false};
48 
49  }
50 
51  catch(cbl::glob::Exception &exc) { std::cerr << exc.what() << std::endl; exit(1); }
52 
53  return 0;
54 }
55 
56 
The class Catalogue
The class Cosmology.
int main()
main function to create the logo of the CosmoBolognaLib
Definition: Logo.cpp:41
The class Catalogue.
Definition: Catalogue.h:654
The class Cosmology.
Definition: Cosmology.h:277
void set_sigma8(const double sigma8=-1.)
set the value of σ8
Definition: Cosmology.h:1547
The class Exception.
Definition: Exception.h:111
const char * what() const noexcept override
the error description
Definition: Exception.h:203
@ _Z_
coordinate z
@ _Y_
coordinate y
@ _X_
coordinate x
@ _Zehavi05_
Zehavi et al. (2005)
The global namespace of the CosmoBolognaLib
Definition: CAMB.h:38
@ _comoving_
comoving coordinates (x, y, z)