1 | #ifndef SCHECHTER_SEEN
|
---|
2 | #define SCHECHTER_SEEN
|
---|
3 |
|
---|
4 | #include "machdefs.h"
|
---|
5 | #include "genericfunc.h"
|
---|
6 |
|
---|
7 | namespace SOPHYA {
|
---|
8 |
|
---|
9 | class Histo;
|
---|
10 | class FunRan;
|
---|
11 |
|
---|
12 | //-----------------------------------------------------------------------------------
|
---|
13 | class Schechter : public GenericFunc {
|
---|
14 | public:
|
---|
15 | Schechter(double nstar,double mstar,double alpha);
|
---|
16 | Schechter(Schechter& f);
|
---|
17 | Schechter(void);
|
---|
18 | virtual ~Schechter(void);
|
---|
19 |
|
---|
20 | void SetOutValue(unsigned short outvalue=0);
|
---|
21 | unsigned short GetOutValue(void);
|
---|
22 | void SetParam(double nstar,double mstar,double alpha);
|
---|
23 | void GetParam(double& nstar,double& mstar,double& alpha);
|
---|
24 |
|
---|
25 | virtual double operator() (double m);
|
---|
26 |
|
---|
27 | double Integrate(double massmin,double massmax,int npt=100);
|
---|
28 |
|
---|
29 | virtual void Print(void);
|
---|
30 |
|
---|
31 | protected:
|
---|
32 | double nstar_,mstar_,alpha_;
|
---|
33 | unsigned short outvalue_;
|
---|
34 | };
|
---|
35 |
|
---|
36 | //-----------------------------------------------------------------------------------
|
---|
37 | class SchechterMassDist : public AnyDataObj {
|
---|
38 | friend class ObjFileIO<SchechterMassDist>;
|
---|
39 | public:
|
---|
40 | SchechterMassDist(Schechter sch,double massmin,double massmax,int nbinmass);
|
---|
41 | SchechterMassDist(void);
|
---|
42 | virtual ~SchechterMassDist(void);
|
---|
43 |
|
---|
44 | int GetMassLim(double& massmin,double& massmax);
|
---|
45 | int SetNgalLim(int ngalmax,int ngalmin=1,unsigned long nalea=10000);
|
---|
46 | int GetNgalLim(int& ngalmax,int& ngalmin);
|
---|
47 | int GetNgalLim(void) {return nvalngal_;}
|
---|
48 | Schechter GetSchechter(void) {return sch_;}
|
---|
49 |
|
---|
50 | inline int IndexFrNGal(int ngal) {
|
---|
51 | int i = ngal-ngalmin_;
|
---|
52 | if(nvalngal_<1 || i<0) return -1;
|
---|
53 | if(i>=nvalngal_) return -2; else return i;
|
---|
54 | }
|
---|
55 | inline int NGalFrIndex(int i) {
|
---|
56 | if(nvalngal_<1 || i<0 || i>=nvalngal_) return -1;
|
---|
57 | return ngalmin_+i;
|
---|
58 | }
|
---|
59 |
|
---|
60 | Histo GetHmDnDm(void) const;
|
---|
61 | FunRan GetTmDnDm(void) const;
|
---|
62 |
|
---|
63 | Histo GetHisto(int i) const;
|
---|
64 | FunRan GetFunRan(int i) const;
|
---|
65 |
|
---|
66 | double TirMass(int ngal);
|
---|
67 |
|
---|
68 | void Print(void);
|
---|
69 | void PrintStatus(void);
|
---|
70 |
|
---|
71 | void WritePPF(string ppfname);
|
---|
72 | void ReadPPF(string ppfname);
|
---|
73 |
|
---|
74 | protected:
|
---|
75 | void Delete(void);
|
---|
76 |
|
---|
77 | Schechter sch_;
|
---|
78 | unsigned short sch_outvalue_;
|
---|
79 |
|
---|
80 | double massmin_,massmax_; int nbinmass_;
|
---|
81 | int ngalmin_,ngalmax_,nvalngal_;
|
---|
82 | unsigned long ntrial_dir, ntrial_tab;
|
---|
83 |
|
---|
84 | Histo* hmdndm_;
|
---|
85 | FunRan* tirhmdndm_;
|
---|
86 |
|
---|
87 | vector<Histo> hmass_;
|
---|
88 | vector<FunRan> tmass_;
|
---|
89 | };
|
---|
90 |
|
---|
91 | //-----------------------------------------------------------------------------------
|
---|
92 | bool IsCompatible(Schechter& sch1,Schechter& sch2,double eps=1.e-4);
|
---|
93 |
|
---|
94 | //-----------------------------------------------------------------------------------
|
---|
95 | double Msol2FluxHI(double m,double d);
|
---|
96 | double FluxHI2Msol(double f,double d);
|
---|
97 |
|
---|
98 | } // Fin du namespace SOPHYA
|
---|
99 |
|
---|
100 | #endif
|
---|