Main Page
Namespaces
Classes
Package Documentation
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
#include "Math/PdfFuncMathCore.h"
11
12
#include <cmath>
13
14
class
BinomialProbHelper
{
15
public
:
16
BinomialProbHelper
(
double
rho
,
int
x
,
int
n
)
17
:
rho_
(rho),
x_
(x),
n_
(n),
18
rho_hat_
(double(x)/n),
19
prob_
(
ROOT
::Math::binomial_pdf(x, rho, n)) {
20
// Cache the likelihood ratio L(\rho)/L(\hat{\rho}), too.
21
if
(x == 0)
22
lratio_
=
pow
(1 - rho, n);
23
else
if
(x == n)
24
lratio_
=
pow
(rho, n);
25
else
26
lratio_
=
pow
(rho/
rho_hat_
, x) *
pow
((1 - rho)/(1 -
rho_hat_
), n - x);
27
}
28
29
double
rho
()
const
{
return
rho_
; };
30
int
x
()
const
{
return
x_
; };
31
int
n
()
const
{
return
n_
; };
32
double
prob
()
const
{
return
prob_
; };
33
double
lratio
()
const
{
return
lratio_
; };
34
35
private
:
36
double
rho_
;
37
int
x_
;
38
int
n_
;
39
double
rho_hat_
;
40
double
prob_
;
41
double
lratio_
;
42
};
43
44
#endif
ROOT
Definition:
Transform3DPJ.h:40
BinomialProbHelper::rho_hat_
double rho_hat_
Definition:
BinomialProbHelper.h:39
BinomialProbHelper::rho
double rho() const
Definition:
BinomialProbHelper.h:29
BinomialProbHelper::n
int n() const
Definition:
BinomialProbHelper.h:31
BinomialProbHelper
Definition:
BinomialProbHelper.h:14
BinomialProbHelper::n_
int n_
Definition:
BinomialProbHelper.h:38
BinomialProbHelper::x_
int x_
Definition:
BinomialProbHelper.h:37
BinomialProbHelper::prob
double prob() const
Definition:
BinomialProbHelper.h:32
BinomialProbHelper::x
int x() const
Definition:
BinomialProbHelper.h:30
BinomialProbHelper::lratio_
double lratio_
Definition:
BinomialProbHelper.h:41
BinomialProbHelper::BinomialProbHelper
BinomialProbHelper(double rho, int x, int n)
Definition:
BinomialProbHelper.h:16
BinomialProbHelper::prob_
double prob_
Definition:
BinomialProbHelper.h:40
BinomialProbHelper::lratio
double lratio() const
Definition:
BinomialProbHelper.h:33
funct::pow
Power< A, B >::type pow(const A &a, const B &b)
Definition:
Power.h:40
BinomialProbHelper::rho_
double rho_
Definition:
BinomialProbHelper.h:33
Generated for CMSSW Reference Manual by
1.8.11