20-jan-2007 NvE AliMath extended with Nfac(), LnNfac() and LogNfac() facilities.
[u/mrichter/AliRoot.git] / RALICE / AliMath.h
d88f97cc 1#ifndef ALIMATH_H
2#define ALIMATH_H
3da30618 3/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * See cxx source for full Copyright notice */
f531a546 6// $Id$
3da30618 7
d88f97cc 8#include <math.h>
10#include "TObject.h"
a57b6095 11#include "TF1.h"
12#include "TString.h"
13#include "TMath.h"
d88f97cc 14
15class AliMath : public TObject
17 public:
261c0caf 18 AliMath(); // Default constructor
19 virtual ~AliMath(); // Destructor
20 AliMath(const AliMath& m); // Copy constructor
21 Double_t Gamma(Double_t z) const; // Standard gamma function Gamma(z)
22 Double_t Gamma(Double_t a,Double_t x) const; // Incomplete gamma function P(a,x)
23 Double_t LnGamma(Double_t z) const; // Compute ln[Gamma(z)]
24 Double_t Erf(Double_t x) const; // Error function erf(x)
25 Double_t Erfc(Double_t x) const; // Complementary error function erfc(x)
26 Double_t Prob(Double_t chi2,Int_t ndf,Int_t mode=1) const; // Compute Chi-squared probability
27 Double_t BesselI(Int_t n,Double_t x) const; // Compute integer order mod. Bessel function I_n(x)
28 Double_t BesselK(Int_t n,Double_t x) const; // Compute integer order mod. Bessel function K_n(x)
a57b6095 29 TF1 Chi2Dist(Int_t ndf) const; // Provide the Chi-squared distribution function
30 TF1 StudentDist(Double_t ndf) const; // Provide the Student's T distribution function
31 TF1 FratioDist(Int_t ndf1,Int_t ndf2) const; // Provide the Fratio distribution function
32 TF1 BinomialDist(Int_t n,Double_t p) const; // Provide the Binomial distribution function
33 TF1 NegBinomialDist(Int_t k,Double_t p) const; // Provide the Negative Binomial distribution function
34 TF1 PoissonDist(Double_t mu) const; // Provide the Poisson distribution function
35 Double_t Chi2Pvalue(Double_t chi2,Int_t ndf,Int_t sides=0,Int_t sigma=0,Int_t mode=1) const; // Chi-squared P-value
36 Double_t StudentPvalue(Double_t t,Double_t ndf,Int_t sides=0,Int_t sigma=0) const; // Student's P-value
37 Double_t FratioPvalue(Double_t f,Int_t ndf1,Int_t ndf2,Int_t sides=0,Int_t sigma=0) const; // F ratio P-value
38 Double_t BinomialPvalue(Int_t k,Int_t n,Double_t p,Int_t sides=0,Int_t sigma=0,Int_t mode=0) const; // Bin. P-value
39 Double_t PoissonPvalue(Int_t k,Double_t mu,Int_t sides=0,Int_t sigma=0) const; // Poisson P-value
40 Double_t NegBinomialPvalue(Int_t n,Int_t k,Double_t p,Int_t sides=0,Int_t sigma=0,Int_t mode=0) const; // NegBin. P-value
cf3100fa 41 Double_t Nfac(Int_t n,Int_t mode=0) const; // Compute n!
42 Double_t LnNfac(Int_t n,Int_t mode=2) const; // Compute ln(n!)
43 Double_t LogNfac(Int_t n,Int_t mode=2) const; // Compute log_10(n!)
d88f97cc 45 protected:
261c0caf 46 Double_t GamSer(Double_t a,Double_t x) const; // Compute P(a,x) via serial representation
47 Double_t GamCf(Double_t a,Double_t x) const; // Compute P(a,x) via continued fractions
48 Double_t BesselI0(Double_t x) const; // Compute modified Bessel function I_0(x)
49 Double_t BesselK0(Double_t x) const; // Compute modified Bessel function K_0(x)
50 Double_t BesselI1(Double_t x) const; // Compute modified Bessel function I_1(x)
51 Double_t BesselK1(Double_t x) const; // Compute modified Bessel function K_1(x)
d88f97cc 52
cf3100fa 53 ClassDef(AliMath,5) // Various mathematical tools for physics analysis.
d88f97cc 54