d88f97cc |
1 | #ifndef ALIMATH_H |
2 | #define ALIMATH_H |
3 | /////////////////////////////////////////////////////////////////////////// |
4 | // Class AliMath |
5 | // Various mathematical tools which may be very convenient while |
6 | // performing physics analysis. |
7 | // |
8 | // Example : Probability of a Chi-squared value |
9 | // ========= |
10 | // |
11 | // AliMath M; |
12 | // Float_t chi2=20 ; // The chi-squared value |
13 | // Int_t ndf=12; // The number of degrees of freedom |
14 | // Float_t p=M.Prob(chi2,ndf); // The probability that at least a Chi-squared |
15 | // // value of chi2 will be observed, even for a |
16 | // // correct model |
17 | // |
18 | //--- NvE 14-nov-1998 UU-SAP Utrecht |
19 | /////////////////////////////////////////////////////////////////////////// |
20 | |
21 | #include <iostream.h> |
22 | #include <math.h> |
23 | |
24 | #include "TObject.h" |
25 | |
26 | class AliMath : public TObject |
27 | { |
28 | public: |
29 | AliMath(); // Default constructor |
30 | ~AliMath(); // Destructor |
31 | Float_t Gamma(Float_t z); // Standard gamma function Gamma(z) |
32 | Float_t Gamma(Float_t a,Float_t x); // Incomplete gamma function P(a,x) |
33 | Float_t LnGamma(Float_t z); // Compute ln[Gamma(z)] |
34 | Float_t Erf(Float_t x); // Error function erf(x) |
35 | Float_t Erfc(Float_t x); // Complementary error function erfc(x) |
36 | Float_t Prob(Float_t chi2,Int_t ndf); // Compute Chi-squared probability |
37 | |
38 | protected: |
39 | Float_t GamSer(Float_t a,Float_t x); // Compute P(a,x) via serial representation |
40 | Float_t GamCf(Float_t a,Float_t x); // Compute P(a,x) via continued fractions |
41 | |
42 | ClassDef(AliMath,1) // Class definition to enable ROOT I/O |
43 | |
44 | }; |
45 | #endif |