00001 #ifndef __BCMATH__H
00002 #define __BCMATH__H
00003
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #define BCMATH_NFACT_ALIMIT 20
00026
00027
00028
00029 #include <vector>
00030
00031 namespace BCMath
00032 {
00033
00040 double LogGaus(double x, double mean = 0, double sigma = 1, bool norm = false);
00041
00045 double LogPoisson(double x, double par);
00046
00052 double ApproxBinomial(int n, int k, double p);
00053
00060 double LogApproxBinomial(int n, int k, double p);
00061
00069 double LogBinomFactor(int n, int k);
00070
00078 double ApproxLogFact(double x);
00079
00083 double LogNoverK(int n, int k);
00084
00088 double LogFact(int n);
00089
00093 inline int Max(int x, int y)
00094 { return x >= y ? x : y; }
00095
00096 inline double Max(double x, double y)
00097 { return x >= y ? x : y; }
00098
00102 inline int Min(int x, int y)
00103 { return x <= y ? x : y; }
00104
00105 inline double Min(double x, double y)
00106 { return x <= y ? x : y; }
00107
00111 int Nint(double x);
00112
00116 double rms(int n, const double * a);
00117
00122 double LogBreitWignerNonRel(double x, double mean, double Gamma, bool norm = false);
00123 double LogBreitWignerRel(double x, double mean, double Gamma);
00124
00129 double LogChi2(double x, int n);
00130
00144 double LogVoigtian(double x, double sigma, double gamma);
00145
00150 void RandomChi2(std::vector<double> &randoms, int K);
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161 }
00162
00163
00164
00165 #endif
00166