Main Page
Namespaces
Classes
Package Documentation
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Pages
src
PhysicsTools
RooStatsCms
interface
BinomialProbHelper.h
Go to the documentation of this file.
1
#ifndef PhysicsTools_RooStatsCms_BinomialProbHelper_h
2
#define PhysicsTools_RooStatsCms_BinomialProbHelper_h
3
/* \class BinomialProbHelper
4
*
5
* \author Jordan Tucker
6
* integration in CMSSW: Luca Lista
7
*
8
*/
9
10
class
BinomialProbHelper
{
11
public
:
12
BinomialProbHelper
(
double
rho
,
int
x
,
int
n
)
13
:
rho_
(rho),
x_
(x),
n_
(n),
14
rho_hat_
(double(x)/n),
15
prob_
(ROOT::Math::binomial_pdf(x, rho, n)) {
16
// Cache the likelihood ratio L(\rho)/L(\hat{\rho}), too.
17
if
(x == 0)
18
lratio_
=
pow
(1 - rho, n);
19
else
if
(x == n)
20
lratio_
=
pow
(rho, n);
21
else
22
lratio_
=
pow
(rho/
rho_hat_
, x) *
pow
((1 - rho)/(1 -
rho_hat_
), n - x);
23
}
24
25
double
rho
()
const
{
return
rho_
; };
26
int
x
()
const
{
return
x_
; };
27
int
n
()
const
{
return
n_
; };
28
double
prob
()
const
{
return
prob_
; };
29
double
lratio
()
const
{
return
lratio_
; };
30
31
private
:
32
double
rho_
;
33
int
x_
;
34
int
n_
;
35
double
rho_hat_
;
36
double
prob_
;
37
double
lratio_
;
38
};
39
40
#endif
BinomialProbHelper::rho_hat_
double rho_hat_
Definition:
BinomialProbHelper.h:35
BinomialProbHelper::rho
double rho() const
Definition:
BinomialProbHelper.h:25
BinomialProbHelper::n
int n() const
Definition:
BinomialProbHelper.h:27
BinomialProbHelper
Definition:
BinomialProbHelper.h:10
BinomialProbHelper::n_
int n_
Definition:
BinomialProbHelper.h:34
BinomialProbHelper::x_
int x_
Definition:
BinomialProbHelper.h:33
BinomialProbHelper::prob
double prob() const
Definition:
BinomialProbHelper.h:28
BinomialProbHelper::x
int x() const
Definition:
BinomialProbHelper.h:26
BinomialProbHelper::lratio_
double lratio_
Definition:
BinomialProbHelper.h:37
BinomialProbHelper::BinomialProbHelper
BinomialProbHelper(double rho, int x, int n)
Definition:
BinomialProbHelper.h:12
BinomialProbHelper::prob_
double prob_
Definition:
BinomialProbHelper.h:36
BinomialProbHelper::lratio
double lratio() const
Definition:
BinomialProbHelper.h:29
funct::pow
Power< A, B >::type pow(const A &a, const B &b)
Definition:
Power.h:40
BinomialProbHelper::rho_
double rho_
Definition:
BinomialProbHelper.h:29
Generated for CMSSW Reference Manual by
1.8.5