[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:
|
---|
| 25 | TransfertEisenstein(double h100,double OmegaCDM0,double OmegaBaryon0,double tcmb,bool nobaryon=false);
|
---|
| 26 | TransfertEisenstein(TransfertEisenstein& tf);
|
---|
| 27 | virtual ~TransfertEisenstein(void);
|
---|
| 28 | virtual double operator() (double k);
|
---|
| 29 | double KPeak(void);
|
---|
| 30 | void SetNoOscEnv(unsigned short nooscenv=0);
|
---|
| 31 | protected:
|
---|
| 32 | double O0_,Oc_,Ob_,h_,tcmb_,th2p7_;
|
---|
| 33 | double zeq_,keq_,zd_,Req_,Rd_,s_,ksilk_,alphac_,betac_,bnode_,alphab_,betab_;
|
---|
| 34 | double alphag_;
|
---|
| 35 | double kpeak_;
|
---|
| 36 |
|
---|
| 37 | bool nobaryon_;
|
---|
| 38 | unsigned short nooscenv_;
|
---|
| 39 | double T0tild(double k,double alphac,double betac);
|
---|
| 40 | void Init_With_Baryons(void);
|
---|
| 41 | void Init_Without_Baryon(void);
|
---|
| 42 | };
|
---|
| 43 |
|
---|
| 44 |
|
---|
| 45 | //-----------------------------------------------------------------------------------
|
---|
| 46 | class GrowthFactor : public GenericFunc {
|
---|
| 47 | public:
|
---|
| 48 | GrowthFactor(double OmegaMatter0,double OmegaLambda0);
|
---|
| 49 | GrowthFactor(GrowthFactor& d1);
|
---|
| 50 | virtual ~GrowthFactor(void);
|
---|
| 51 | virtual double operator() (double z);
|
---|
| 52 | protected:
|
---|
| 53 | double O0_,Ol_,Ok_;
|
---|
| 54 | double norm_;
|
---|
| 55 | };
|
---|
| 56 |
|
---|
| 57 |
|
---|
| 58 | //-----------------------------------------------------------------------------------
|
---|
| 59 | class PkSpectrum0 : public GenericFunc {
|
---|
| 60 | public:
|
---|
| 61 | PkSpectrum0(InitialSpectrum& pkinf,TransfertEisenstein& tf);
|
---|
| 62 | PkSpectrum0(PkSpectrum0& pk0);
|
---|
| 63 | virtual ~PkSpectrum0(void);
|
---|
| 64 | virtual double operator() (double z);
|
---|
| 65 | InitialSpectrum& GetPkIni(void) {return pkinf_;}
|
---|
| 66 | TransfertEisenstein& GetTransfert(void) {return tf_;}
|
---|
| 67 | protected:
|
---|
| 68 | InitialSpectrum& pkinf_;
|
---|
| 69 | TransfertEisenstein& tf_;
|
---|
| 70 | };
|
---|
| 71 |
|
---|
| 72 | //-----------------------------------------------------------------------------------
|
---|
| 73 | class PkSpectrumZ : public GenericFunc {
|
---|
| 74 | public:
|
---|
| 75 | PkSpectrumZ(PkSpectrum0& pk0,GrowthFactor& d1,double zref=0.);
|
---|
| 76 | PkSpectrumZ(PkSpectrumZ& pkz);
|
---|
| 77 | virtual ~PkSpectrumZ(void);
|
---|
| 78 | virtual double operator() (double k);
|
---|
| 79 | virtual double operator() (double k,double z);
|
---|
| 80 | inline void SetZ(double z) {zref_ = z;}
|
---|
| 81 | inline double GetZ(void) {return zref_;}
|
---|
| 82 | void SetTypSpec(unsigned short typspec=0);
|
---|
| 83 | inline void SetScale(double scale=1.) {scale_=scale; zold_=-1.;}
|
---|
| 84 | inline double GetScale(void) {return scale_;}
|
---|
| 85 | PkSpectrum0& GetPk0(void) {return pk0_;}
|
---|
| 86 | GrowthFactor& GetGrowthFactor(void) {return d1_;}
|
---|
| 87 | protected:
|
---|
| 88 | PkSpectrum0& pk0_;
|
---|
| 89 | GrowthFactor& d1_;
|
---|
| 90 | double zref_, scale_;
|
---|
| 91 | unsigned short typspec_;
|
---|
| 92 | mutable double zold_, d1old_;
|
---|
| 93 | };
|
---|
| 94 |
|
---|
| 95 | //-----------------------------------------------------------------------------------
|
---|
| 96 | class VarianceSpectrum : public GenericFunc {
|
---|
| 97 | public:
|
---|
| 98 | VarianceSpectrum(GenericFunc& pk,unsigned short typfilter);
|
---|
| 99 | VarianceSpectrum(VarianceSpectrum& pkinf);
|
---|
| 100 | virtual ~VarianceSpectrum(void);
|
---|
| 101 |
|
---|
| 102 | void SetFilter(unsigned short typfilter=0);
|
---|
| 103 | void SetInteg(double dperc=0.1,double dlogkinc=-1.,double dlogkmax=-1.,unsigned short glorder=4);
|
---|
| 104 |
|
---|
| 105 | double Variance(double R,double kmin,double kmax);
|
---|
| 106 |
|
---|
| 107 | // ATTENTION: La fonction a integrer est : f(k)dk = k^3*Pk(k)/(2Pi^2) *filter2(k*R) *dk/k
|
---|
| 108 | virtual double operator() (double k) {return k*k*pk_(k)*Filter2(k*R_)/(2.*M_PI*M_PI);}
|
---|
| 109 | double Filter2(double x);
|
---|
| 110 |
|
---|
| 111 | // Aide a l'integration
|
---|
| 112 | double FindMaximum(double R,double kmin,double kmax,double eps=1.e-3);
|
---|
| 113 | int FindLimits(double R,double high,double &kmin,double &kmax,double eps=1.e-3);
|
---|
| 114 |
|
---|
| 115 | protected:
|
---|
| 116 |
|
---|
| 117 | GenericFunc& pk_;
|
---|
| 118 | unsigned short typfilter_;
|
---|
| 119 | double R_;
|
---|
| 120 |
|
---|
| 121 | double dperc_,dlogkinc_,dlogkmax_;
|
---|
| 122 | unsigned short glorder_;
|
---|
| 123 |
|
---|
| 124 | };
|
---|
| 125 |
|
---|
| 126 | } // Fin du namespace
|
---|
| 127 |
|
---|
| 128 | #endif
|
---|