1 | #include "sopnamsp.h"
|
---|
2 | #include "machdefs.h"
|
---|
3 | #include <iostream>
|
---|
4 | #include <stdlib.h>
|
---|
5 | #include <stdio.h>
|
---|
6 | #include <string.h>
|
---|
7 | #include <math.h>
|
---|
8 |
|
---|
9 | #include "pexceptions.h"
|
---|
10 |
|
---|
11 | #include "constcosmo.h"
|
---|
12 | #include "schechter.h"
|
---|
13 |
|
---|
14 | ///////////////////////////////////////////////////////////
|
---|
15 | //***************** Schechter Functions *****************//
|
---|
16 | ///////////////////////////////////////////////////////////
|
---|
17 |
|
---|
18 | // HI mass function:
|
---|
19 | // see M.Zwaan astroph-0502257 (MNRAS Letters, Volume 359, Issue 1, pp. L30-L34.)
|
---|
20 | // see M.Zwaan astroph-9707109 (ApJ, Volume 509, Issue 2, pp. 687-702.)
|
---|
21 |
|
---|
22 | Schechter::Schechter(double nstar,double mstar,double alpha)
|
---|
23 | : nstar_(nstar) , mstar_(mstar) , alpha_(alpha) , outvalue_(0)
|
---|
24 | {
|
---|
25 | }
|
---|
26 |
|
---|
27 | Schechter::Schechter(Schechter& f)
|
---|
28 | : nstar_(f.nstar_) , mstar_(f.mstar_) , alpha_(f.alpha_) , outvalue_(f.outvalue_)
|
---|
29 | {
|
---|
30 | }
|
---|
31 |
|
---|
32 | Schechter::~Schechter(void)
|
---|
33 | {
|
---|
34 | }
|
---|
35 |
|
---|
36 | void Schechter::SetOutValue(unsigned short outvalue)
|
---|
37 | // outvalue = 0 : give dn/dm
|
---|
38 | // = 1 : give m*dn/dm
|
---|
39 | {
|
---|
40 | if(outvalue>1) {
|
---|
41 | cout<<"Schechter::SetOutValue: Error bad outvalue: "<<outvalue<<endl;
|
---|
42 | throw ParmError("Schechter::SetOutValue: Error bad outvalue");
|
---|
43 | }
|
---|
44 | outvalue_ = outvalue;
|
---|
45 | }
|
---|
46 |
|
---|
47 | double Schechter::operator() (double m)
|
---|
48 | // Return : "dn/dm = f(m)" or "m*dn/dm = f(m)"
|
---|
49 | {
|
---|
50 | double x = m/mstar_;
|
---|
51 | double dndm = nstar_/mstar_ * pow(x,alpha_) * exp(-x);
|
---|
52 | if(outvalue_) dndm *= m; // on veut m*dn/dm
|
---|
53 | return dndm;
|
---|
54 | }
|
---|
55 |
|
---|
56 | ///////////////////////////////////////////////////////////
|
---|
57 | //******************* Le Flux a 21cm ********************//
|
---|
58 | ///////////////////////////////////////////////////////////
|
---|
59 |
|
---|
60 | double FluxHI(double m,double d)
|
---|
61 | // Input:
|
---|
62 | // m : masse de HI en "Msol"
|
---|
63 | // d : distance en "Mpc" (si cosmo d=DLum(z))
|
---|
64 | // Return:
|
---|
65 | // le flux total emis a 21 cm en W/m^2
|
---|
66 | // Ref: Binney & Merrifield, Galactic Astronomy p474 (ed:1998)
|
---|
67 | // J.Peterson & K.Bandura, astroph-0606104 (eq 7)
|
---|
68 | // F.Abdalla & Rawlings, astroph-0411342 (eq 7 may pb de d'unites?)
|
---|
69 | {
|
---|
70 | return m / (2.35e+5 * d*d )
|
---|
71 | * Jansky2Watt_cst
|
---|
72 | * (Fr_HyperFin_Par*1e+9)/SpeedOfLight_Cst;
|
---|
73 | }
|
---|
74 |
|
---|