CMS 3D CMS Logo

CMSSW_4_4_3_patch1/src/PhysicsTools/RooStatsCms/src/ClopperPearsonBinomialInterval.cc

Go to the documentation of this file.
00001 #include "Math/QuantFuncMathCore.h"
00002 
00003 #if (defined (STANDALONE) or defined (__CINT__) )
00004 #include "ClopperPearsonBinomialInterval.h"
00005 
00006 ClassImp(ClopperPearsonBinomialInterval)
00007 #else
00008 #include "PhysicsTools/RooStatsCms/interface/ClopperPearsonBinomialInterval.h"
00009 #endif
00010 
00011 using ROOT::Math::beta_quantile;
00012 using ROOT::Math::beta_quantile_c;
00013 
00014 // Language of Brown, Cai, DasGupta: p = binomial parameter, X = # successes, n = # trials.
00015 
00016 void ClopperPearsonBinomialInterval::calculate(const double X, const double n) {
00017   set(0, 1);
00018   if (X > 0)
00019     lower_ = beta_quantile  (alpha_min_, X,     n - X + 1);
00020   if (n - X > 0)
00021     upper_ = beta_quantile_c(alpha_min_, X + 1, n - X);
00022 }