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();
67 bool neyman(
const int ntot,
const int nrho,
double*
rho,
double* x_l,
double* x_r)
override {
69 for (
int i = 0;
i < nrho; ++
i) {
70 rho[
i] = double(
i) / nrho;
83 const double tol = 1
e-9;
84 double rho_min, rho_max,
rho;
91 while (std::fabs(rho_max - rho_min) > tol) {
92 rho = (rho_min + rho_max) / 2;
105 while (std::fabs(rho_max - rho_min) > tol) {
106 rho = (rho_min + rho_max) / 2;
119 #if (defined(STANDALONE) or defined(__CINT__))
bool find_rho_set(const double rho, const int ntot, int &x_l, int &x_r) const
void calculate(const double X, const double n) override
bool neyman(const int ntot, const int nrho, double *rho, double *x_l, double *x_r) override