[3115] | 1 | #ifndef PKSPECTRUM_SEEN
|
---|
| 2 | #define PKSPECTRUM_SEEN
|
---|
| 3 |
|
---|
| 4 | #include "machdefs.h"
|
---|
| 5 | #include "genericfunc.h"
|
---|
| 6 |
|
---|
| 7 | namespace SOPHYA {
|
---|
| 8 |
|
---|
| 9 | //-----------------------------------------------------------------------------------
|
---|
| 10 | class InitialSpectrum : public GenericFunc {
|
---|
| 11 | public:
|
---|
| 12 | InitialSpectrum(double n,double a=1.);
|
---|
| 13 | InitialSpectrum(InitialSpectrum& pkinf);
|
---|
| 14 | virtual ~InitialSpectrum(void);
|
---|
| 15 | virtual double operator() (double k) {return A_ * pow(k,n_);}
|
---|
| 16 | void SetNorm(double a);
|
---|
| 17 | void SetSlope(double n);
|
---|
| 18 | protected:
|
---|
| 19 | double n_, A_;
|
---|
| 20 | };
|
---|
| 21 |
|
---|
| 22 | //-----------------------------------------------------------------------------------
|
---|
| 23 | class TransfertEisenstein : public GenericFunc {
|
---|
| 24 | public:
|
---|
[3348] | 25 |
|
---|
| 26 | typedef enum{ALL=0, CDM=1, BARYON=2} ReturnPart;
|
---|
| 27 |
|
---|
[3314] | 28 | TransfertEisenstein(double h100,double OmegaCDM0,double OmegaBaryon0,double tcmb,bool nobaryon=false,int lp=0);
|
---|
[3115] | 29 | TransfertEisenstein(TransfertEisenstein& tf);
|
---|
| 30 | virtual ~TransfertEisenstein(void);
|
---|
| 31 | virtual double operator() (double k);
|
---|
| 32 | double KPeak(void);
|
---|
| 33 | void SetNoOscEnv(unsigned short nooscenv=0);
|
---|
[3348] | 34 | void SetReturnPart(ReturnPart retpart=ALL);
|
---|
[3115] | 35 | protected:
|
---|
[3314] | 36 | int lp_;
|
---|
| 37 | double O0_,Oc_,Ob_,h_,tcmb_;
|
---|
| 38 | double th2p7_;
|
---|
[3115] | 39 | double zeq_,keq_,zd_,Req_,Rd_,s_,ksilk_,alphac_,betac_,bnode_,alphab_,betab_;
|
---|
| 40 | double alphag_;
|
---|
[3314] | 41 | double sfit_,kpeak_;
|
---|
[3115] | 42 |
|
---|
| 43 | bool nobaryon_;
|
---|
[3348] | 44 | unsigned short nooscenv_;
|
---|
| 45 | ReturnPart retpart_;
|
---|
[3314] | 46 |
|
---|
[3115] | 47 | double T0tild(double k,double alphac,double betac);
|
---|
[3314] | 48 | void Init_(void);
|
---|
[3318] | 49 | void zero_(void);
|
---|
[3115] | 50 | };
|
---|
| 51 |
|
---|
[3318] | 52 | //-----------------------------------------------------------------------------------
|
---|
| 53 | class TransfertTabulate : public GenericFunc {
|
---|
| 54 | public:
|
---|
| 55 | TransfertTabulate(double h100,double OmegaCDM0,double OmegaBaryon0);
|
---|
| 56 | TransfertTabulate(TransfertTabulate& tf);
|
---|
| 57 | virtual ~TransfertTabulate(void);
|
---|
| 58 | virtual double operator() (double k);
|
---|
| 59 | int NPoints(void) {return k_.size();}
|
---|
| 60 | void SetInterpTyp(int typ=0);
|
---|
| 61 | int ReadCMBFast(string filename);
|
---|
| 62 | protected:
|
---|
| 63 | double Oc_,Ob_,h_;
|
---|
| 64 | double kmin_,kmax_;
|
---|
| 65 | int interptyp_;
|
---|
| 66 | vector<double> k_, tf_;
|
---|
| 67 | };
|
---|
[3115] | 68 |
|
---|
[3318] | 69 |
|
---|
[3115] | 70 | //-----------------------------------------------------------------------------------
|
---|
| 71 | class GrowthFactor : public GenericFunc {
|
---|
| 72 | public:
|
---|
| 73 | GrowthFactor(double OmegaMatter0,double OmegaLambda0);
|
---|
| 74 | GrowthFactor(GrowthFactor& d1);
|
---|
| 75 | virtual ~GrowthFactor(void);
|
---|
| 76 | virtual double operator() (double z);
|
---|
| 77 | protected:
|
---|
| 78 | double O0_,Ol_,Ok_;
|
---|
| 79 | double norm_;
|
---|
| 80 | };
|
---|
| 81 |
|
---|
| 82 |
|
---|
| 83 | //-----------------------------------------------------------------------------------
|
---|
| 84 | class PkSpectrum0 : public GenericFunc {
|
---|
| 85 | public:
|
---|
| 86 | PkSpectrum0(InitialSpectrum& pkinf,TransfertEisenstein& tf);
|
---|
| 87 | PkSpectrum0(PkSpectrum0& pk0);
|
---|
| 88 | virtual ~PkSpectrum0(void);
|
---|
| 89 | virtual double operator() (double z);
|
---|
| 90 | InitialSpectrum& GetPkIni(void) {return pkinf_;}
|
---|
| 91 | TransfertEisenstein& GetTransfert(void) {return tf_;}
|
---|
| 92 | protected:
|
---|
| 93 | InitialSpectrum& pkinf_;
|
---|
| 94 | TransfertEisenstein& tf_;
|
---|
| 95 | };
|
---|
| 96 |
|
---|
| 97 | //-----------------------------------------------------------------------------------
|
---|
| 98 | class PkSpectrumZ : public GenericFunc {
|
---|
| 99 | public:
|
---|
[3348] | 100 | typedef enum {PK=0, DELTA=1} ReturnSpectrum;
|
---|
[3115] | 101 | PkSpectrumZ(PkSpectrum0& pk0,GrowthFactor& d1,double zref=0.);
|
---|
| 102 | PkSpectrumZ(PkSpectrumZ& pkz);
|
---|
| 103 | virtual ~PkSpectrumZ(void);
|
---|
| 104 | virtual double operator() (double k);
|
---|
| 105 | virtual double operator() (double k,double z);
|
---|
| 106 | inline void SetZ(double z) {zref_ = z;}
|
---|
| 107 | inline double GetZ(void) {return zref_;}
|
---|
[3348] | 108 | void SetTypSpec(ReturnSpectrum typspec=PK);
|
---|
[3115] | 109 | inline void SetScale(double scale=1.) {scale_=scale; zold_=-1.;}
|
---|
| 110 | inline double GetScale(void) {return scale_;}
|
---|
| 111 | PkSpectrum0& GetPk0(void) {return pk0_;}
|
---|
| 112 | GrowthFactor& GetGrowthFactor(void) {return d1_;}
|
---|
| 113 | protected:
|
---|
| 114 | PkSpectrum0& pk0_;
|
---|
| 115 | GrowthFactor& d1_;
|
---|
| 116 | double zref_, scale_;
|
---|
[3348] | 117 | ReturnSpectrum typspec_;
|
---|
[3115] | 118 | mutable double zold_, d1old_;
|
---|
| 119 | };
|
---|
| 120 |
|
---|
| 121 | //-----------------------------------------------------------------------------------
|
---|
| 122 | class VarianceSpectrum : public GenericFunc {
|
---|
| 123 | public:
|
---|
[3348] | 124 |
|
---|
| 125 | typedef enum {TOPHAT=0, GAUSSIAN=1, NOFILTER=2} TypeFilter;
|
---|
| 126 |
|
---|
| 127 | VarianceSpectrum(GenericFunc& pk,double R,TypeFilter typfilter);
|
---|
[3115] | 128 | VarianceSpectrum(VarianceSpectrum& pkinf);
|
---|
| 129 | virtual ~VarianceSpectrum(void);
|
---|
| 130 |
|
---|
[3348] | 131 | void SetRadius(double R);
|
---|
| 132 | void SetFilter(TypeFilter typfilter=TOPHAT);
|
---|
[3115] | 133 | void SetInteg(double dperc=0.1,double dlogkinc=-1.,double dlogkmax=-1.,unsigned short glorder=4);
|
---|
| 134 |
|
---|
[3348] | 135 | double Variance(double kmin,double kmax);
|
---|
[3115] | 136 |
|
---|
| 137 | // ATTENTION: La fonction a integrer est : f(k)dk = k^3*Pk(k)/(2Pi^2) *filter2(k*R) *dk/k
|
---|
| 138 | virtual double operator() (double k) {return k*k*pk_(k)*Filter2(k*R_)/(2.*M_PI*M_PI);}
|
---|
| 139 | double Filter2(double x);
|
---|
| 140 |
|
---|
| 141 | // Aide a l'integration
|
---|
[3348] | 142 | double FindMaximum(double kmin,double kmax,double eps=1.e-3);
|
---|
| 143 | int FindLimits(double high,double &kmin,double &kmax,double eps=1.e-3);
|
---|
[3115] | 144 |
|
---|
| 145 | protected:
|
---|
| 146 |
|
---|
| 147 | GenericFunc& pk_;
|
---|
[3348] | 148 | TypeFilter typfilter_;
|
---|
[3115] | 149 | double R_;
|
---|
| 150 |
|
---|
| 151 | double dperc_,dlogkinc_,dlogkmax_;
|
---|
| 152 | unsigned short glorder_;
|
---|
| 153 |
|
---|
| 154 | };
|
---|
| 155 |
|
---|
[3325] | 156 | } // Fin du namespace SOPHYA
|
---|
[3115] | 157 |
|
---|
| 158 | #endif
|
---|