]> git.uio.no Git - u/mrichter/AliRoot.git/blob - FMD/flow/AliFMDFlowEfficiency.h
Removed generated files@
[u/mrichter/AliRoot.git] / FMD / flow / AliFMDFlowEfficiency.h
1 // -*- mode: C++ -*-
2 /* Copyright (C) 2007 Christian Holm Christensen <cholm@nbi.dk>
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 2.1 of
7  * the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful, but
10  * WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
17  * USA
18  */
19 #ifndef ALIFMDFLOWEFFICIENCY_H
20 #define ALIFMDFLOWEFFICIENCY_H
21 #include <Rtypes.h>
22
23 /** @defgroup z_eff Efficiency calculations 
24     @brief Functions to do efficiency calculations based on a
25     Baysian analysis. 
26
27     @ingroup FMD_flow
28 */
29 /** Namespace for efficency calculations 
30     @ingroup z_eff */
31 namespace AliFMDFlowEfficiency 
32 {
33   /** @{ 
34       @ingroup z_eff */
35   /** Calculate @f$ \log(\Gamma(z))\ \forall z>0@f$ 
36       @param z Argument. 
37       @return  @f$ \log(\Gamma(z))@f$ */ 
38   Double_t LnGamma(Double_t z);
39   
40   /** Continued fraction evaluation by modified Lentz's method 
41       used in calculation of incomplete  Beta function. 
42       @param x argument. 
43       @param a lower limit
44       @param b upper limit
45       @return incomplete Beta function evaluated at x */ 
46   Double_t BetaCf(Double_t x, Double_t a, Double_t b);
47   
48   /** Calculates the incomplete Beta function @f$ I_x(a,b)@f$;
49       this is the incomplete Beta function divided by the
50       complete Beta function. 
51       @param a Lower bound 
52       @param b Upper bound 
53       @param x Order 
54       @return  @f$ I_x(a,b)@f$ */
55   Double_t IBetaI(Double_t a, Double_t b, Double_t x);
56
57   /** Calculates the fraction of the area under the curve 
58       @f$ x^k (1-x)^{n-k}@f$ between @f$ x=a@f$ and @f$ x=b@f$ 
59       @param a lower limit 
60       @param b upper limit 
61       @param k Parameter @f$ k@f$ 
62       @param n Parameter @f$ n@f$ 
63       @return The fraction under the curve */ 
64   Double_t BetaAB(Double_t a, Double_t b, Int_t k, Int_t n);
65   
66   /** Integrates the Binomial distribution with parameters @a k and @a
67       n, and determines the upper edge of the integration region, 
68       starting at @a low, which contains probability content @a c.  If
69       an upper limit is found, the value is returned. If no solution
70       is found, -1 is returned. Check to see if there is any solution
71       by verifying that the integral up to the maximum upper limit (1)
72       is greater than c 
73       @param low Where to start the integration from. 
74       @param k   @a k parameter of the Binomial distribution. 
75       @param n   @a N parameter of the Binomial distribution. 
76       @param c   Wanted confidence limit (defaults to 68% - similar to
77       @f$ 1\sigma@f$ of a Gaussian distribution)
78       @return the upper limit of the confidence interval, or -1 in
79       case of failure */
80   Double_t SearchUpper(Double_t low, Int_t k, Int_t n, Double_t c=0.683);
81
82   /** Integrates the Binomial distribution with parameters @a k and @a
83       n, and determines the lower edge of the integration region, 
84       ending at @a high, which contains probability content @a c.  If
85       a lower limit is found, the value is returned. If no solution
86       is found, -1 is returned. Check to see if there is any solution
87       by verifying that the integral up to the maximum upper limit (1)
88       is greater than c 
89       @param high Where to end the integration at. 
90       @param k    @a k parameter of the Binomial distribution. 
91       @param n    @a N parameter of the Binomial distribution. 
92       @param c    Wanted confidence limit (defaults to 68% - similar to
93       @f$ 1\sigma@f$ of a Gaussian distribution) 
94       @return the upper limit of the confidence interval, or -1 in
95       case of failure */
96   Double_t SearchLower(Double_t high, Int_t k, Int_t n, Double_t c=0.683);
97
98   /** Numerical equation solver.  This includes root finding and
99       minimum finding algorithms. Adapted from Numerical Recipes in
100       C, 2nd edition. Translated to C++ by Marc Paterno
101       @param ax   Left side of interval 
102       @param bx   Middle of interval 
103       @param cx   Right side of interval 
104       @param tol  Tolerance 
105       @param xmin On return, the value of @f$ x@f$ such that @f$
106       f(x)@f$ i minimal. 
107       @param k    Parameter of the Binomial distribution 
108       @param n    Parameter of the Binomial distribution 
109       @param c    Confidence level. 
110       @return Minimum of @f$ f = f(x)@f$. */
111   Double_t Brent(Double_t ax, Double_t bx, Double_t cx, Double_t& xmin, 
112                Int_t k, Int_t n, Double_t c=.683, Double_t tol=1e-9);
113   
114   /** Return the length of the interval starting at @a l that contains
115       @a c of the @f$ x^k (1-x)^{n-k}@f$ distribution. If there is no
116       sufficient interval starting at @a l, we return 2.0 
117       @param l Lower bound 
118       @param k Binomial parameter k 
119       @param n Binomial parameter n 
120       @param c Condifience level 
121       @return Legnth of interval */
122   Double_t Length(Double_t l, Int_t k, Int_t n, Double_t c=0.683);
123     
124
125   /** Calculate the shortest central confidence interval containing
126       the required probability content @a c. Interval(low) returns the
127       length of the interval starting at low that contains @a c
128       probability. We use Brent's method, except in two special cases:
129       when @a k=0, or when @a k=n 
130       @author Marc Paterno
131       @param k    Binomial parameter @a k 
132       @param n    Binomial parameter @a n 
133       @param low  On return, the lower limit
134       @param high On return, the upper limit 
135       @param c    Required confidence level (defaults to 68% - similar
136       to @f$ 1\sigma@f$ of a Gaussian distribution)
137       @return The mode */ 
138   Double_t Interval(Int_t k, Int_t n, Double_t& low, Double_t& high, Double_t c=0.683);
139   /** @} */
140 }
141
142
143 #endif
144 //
145 // EOF
146 //
147