1 #ifndef PhysicsTools_RooStatsCms_BinomialNoncentralinterval_h
2 #define PhysicsTools_RooStatsCms_BinomialNoncentralinterval_h
15 #include "Math/PdfFuncMathCore.h"
17 #if (defined (STANDALONE) or defined (__CINT__) )
30 template <
typename Sorter>
38 std::vector<BinomialProbHelper> probs;
39 for (
int i = 0;
i <= ntot; ++
i)
41 std::sort(probs.begin(), probs.end(),
sorter_);
53 for (
int i = 0;
i <= ntot && sum <
target; ++
i) {
54 sum += probs[
i].prob();
55 const int&
x = probs[
i].x();
65 bool neyman(
const int ntot,
const int nrho,
double*
rho,
double* x_l,
double* x_r) {
67 for (
int i = 0;
i < nrho; ++
i) {
68 rho[
i] = double(
i)/nrho;
81 const double tol = 1
e-9;
82 double rho_min, rho_max,
rho;
87 rho_min = 0; rho_max = 1;
88 while (std::fabs(rho_max - rho_min) > tol) {
89 rho = (rho_min + rho_max)/2;
100 rho_min = 0; rho_max = 1;
101 while (std::fabs(rho_max - rho_min) > tol) {
102 rho = (rho_min + rho_max)/2;
115 #if (defined (STANDALONE) or defined (__CINT__) )
bool neyman(const int ntot, const int nrho, double *rho, double *x_l, double *x_r)
bool find_rho_set(const double rho, const int ntot, int &x_l, int &x_r) const
void set(double l, double u)
void calculate(const double X, const double n)