63 for (i=0 ; i<1000 ; i++) {
82 if (
n<1000 && nSigma==1.) {
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;
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)) {
156 asym1 = asym-nSigma*approxErr ;
157 asym2 = asym+nSigma*approxErr ;
201 oocoutE((
TObject*)0,Plotting) <<
"RooHistError::getPoissonInterval: cannot calculate interval for n,m = " <<
n <<
"," <<
m << endl;
206 if(
n == 0 &&
m == 0) {
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);
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);
303 if(!ok)
oocoutE((
TObject*)0,Plotting) <<
"RooHistError::getInterval: failed to find root(s)" << endl;
316 Double_t min(
f.getMinLimit(1)),max(
f.getMaxLimit(1));
321 while(steps-- && (f0*(
f(&
x)-value) >= 0) && ((
x-min)*(max-
x) >= 0));
Abstract interface for evaluating a real-valued function of one real variable and performing numerica...
Implement the abstract 1-dimensional root finding interface using the Brent-Decker method.
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.
RooHistError is a singleton class used to calculate the error bars for each bin of a RooHist object.
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.
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).
static const RooHistError & instance()
Return a reference to a singleton object that is created the first time this method is called.
static RooAbsFunc * createBinomialSum(Int_t n, Int_t m, Bool_t eff)
Create and return a BinomialSum function binding.
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).
Double_t _poissonLoLUT[1000]
Double_t seek(const RooAbsFunc &f, Double_t startAt, Double_t step, Double_t value) const
Scan f(x)-value until it changes sign.
static RooAbsFunc * createPoissonSum(Int_t n)
Create and return a PoissonSum function binding.
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.
RooHistError()
Construct our singleton object.
Double_t _poissonHiLUT[1000]
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...
Mother of all ROOT objects.
Double_t Erf(Double_t x)
Computation of the error function erf(x).