63 for (i=0 ; i<1000 ; i++) {
64 getPoissonIntervalCalc(i,_poissonLoLUT[i],_poissonHiLUT[i],1.) ;
82 if (n<1000 && nSigma==1.) {
83 mu1=_poissonLoLUT[
n] ;
84 mu2=_poissonHiLUT[
n] ;
89 Bool_t ret = getPoissonIntervalCalc(n,mu1,mu2,nSigma) ;
106 oocoutE((
TObject*)0,
Plotting) <<
"RooHistError::getPoissonInterval: cannot calculate interval for n = " << n << endl;
112 mu1= n -
sqrt(n+0.25) + 0.5;
113 mu2= n +
sqrt(n+0.25) + 0.5;
121 return getInterval(&upper,&lower,(
Double_t)n,1.0,mu1,mu2,nSigma);
125 return getInterval(&upper,0,(
Double_t)n,1.0,mu1,mu2,nSigma);
138 oocoutE((
TObject*)0,
Plotting) <<
"RooHistError::getPoissonInterval: cannot calculate interval for n,m = " << n <<
"," << m << endl;
143 if(n == 0 && m == 0) {
150 if ((n>100&&m>100)) {
154 Double_t approxErr =
sqrt(4.0*n/(N+M)*(1-N/(N+M))/(N+M)) ;
156 asym1 = asym-nSigma*approxErr ;
157 asym2 = asym+nSigma*approxErr ;
175 status= getInterval(&upper,&lower,(
Double_t)(n-m)/(n+m),0.1,asym1,asym2,nSigma);
178 status= getInterval(&upper,0,(
Double_t)(n-m)/(n+m),0.1,asym1,asym2,nSigma);
201 oocoutE((
TObject*)0,
Plotting) <<
"RooHistError::getPoissonInterval: cannot calculate interval for n,m = " << n <<
"," << m << endl;
206 if(n == 0 && m == 0) {
217 Double_t approxErr =
sqrt(4.0*n/(N+M)*(1-N/(N+M))/(N+M)) ;
219 asym1 = asym-nSigma*0.5*approxErr ;
220 asym2 = asym+nSigma*0.5*approxErr ;
239 status= getInterval(&upper,&lower,eff,0.1,asym1,asym2,nSigma*0.5);
242 status= getInterval(&upper,0,eff,0.1,asym1,asym2,nSigma*0.5);
267 assert(0 != Qu || 0 != Ql);
276 if(0 != Ql) loProb= (*Ql)(&pointEstimate);
277 if(0 != Qu) hiProb= (*Qu)(&pointEstimate);
279 if (Qu && (0 == Ql || loProb > alpha + beta)) {
283 hi= seek(*Qu,lo,+stepSize,target);
285 ok= uFinder.
findRoot(hi,hi-stepSize,hi,target);
287 else if(Ql && (0 == Qu || hiProb < alpha)) {
291 lo= seek(*Ql,hi,-stepSize,target);
293 ok= lFinder.
findRoot(lo,lo,lo+stepSize,target);
297 lo= seek(*Ql,pointEstimate,-stepSize,alpha+beta);
298 hi= seek(*Qu,pointEstimate,+stepSize,alpha);
300 ok= lFinder.findRoot(lo,lo,lo+stepSize,alpha+beta);
301 ok|= uFinder.
findRoot(hi,hi-stepSize,hi,alpha);
321 while(steps-- && (f0*(
f(&
x)-value) >= 0) && ((
x-min)*(max-
x) >= 0));
static RooAbsFunc * createPoissonSum(Int_t n)
Create and return a PoissonSum function binding.
double beta(double x, double y)
Calculates the beta function.
Double_t seek(const RooAbsFunc &f, Double_t startAt, Double_t step, Double_t value) const
Scan f(x)-value until it changes sign.
Bool_t getInterval(const RooAbsFunc *Qu, const RooAbsFunc *Ql, Double_t pointEstimate, Double_t stepSize, Double_t &lo, Double_t &hi, Double_t nSigma) const
Calculate a confidence interval using the cumulative functions provided.
virtual Bool_t findRoot(Double_t &result, Double_t xlo, Double_t xhi, Double_t value=0) const
Do the root finding using the Brent-Decker method.
Double_t Erf(Double_t x)
Computation of the error function erf(x).
Implement the abstract 1-dimensional root finding interface using the Brent-Decker method...
virtual Double_t getMinLimit(UInt_t dimension) const =0
static const RooHistError & instance()
Return a reference to a singleton object that is created the first time this method is called...
RooHistError()
Construct our singleton object.
virtual Double_t getMaxLimit(UInt_t dimension) const =0
Bool_t getBinomialIntervalAsym(Int_t n, Int_t m, Double_t &a1, Double_t &a2, Double_t nSigma=1) const
Return 'nSigma' binomial confidence interval for (n,m).
Bool_t getPoissonInterval(Int_t n, Double_t &mu1, Double_t &mu2, Double_t nSigma=1) const
Return a confidence interval for the expected number of events given n observed (unweighted) events...
Mother of all ROOT objects.
static RooAbsFunc * createBinomialSum(Int_t n, Int_t m, Bool_t eff)
Create and return a BinomialSum function binding.
Bool_t getBinomialIntervalEff(Int_t n, Int_t m, Double_t &a1, Double_t &a2, Double_t nSigma=1) const
Return 'nSigma' binomial confidence interval for (n,m).
float type_of_call hi(const int &, const int &)
Bool_t getPoissonIntervalCalc(Int_t n, Double_t &mu1, Double_t &mu2, Double_t nSigma=1) const
Calculate a confidence interval for the expected number of events given n observed (unweighted) event...
Abstract interface for evaluating a real-valued function of one real variable and performing numerica...
RooHistError is a singleton class used to calculate the error bars for each bin of a RooHist object...