89#include "RConfigure.h"
100#ifdef R__HAS_MATHMORE
109struct LikelihoodFunction {
111 fFunc(
f), fPrior(prior),
112 fOffset(offset), fMaxL(0) {
113 fFunc.binding().resetNumCall();
116 void SetPrior(
RooFunctor * prior) { fPrior = prior; }
119 double nll = fFunc(
x) - fOffset;
122 if (fPrior) likelihood *= (*fPrior)(
x);
124 int nCalls = fFunc.binding().numCall();
125 if (nCalls > 0 && nCalls % 1000 == 0) {
127 <<
" x0 " <<
x[0] <<
" nll = " << nll+fOffset;
130 <<
" max Likelihood " << fMaxL << std::endl;
133 if (likelihood > fMaxL ) {
135 if ( likelihood > 1.E10) {
136 ooccoutW((
TObject*)0,
Eval) <<
"LikelihoodFunction::() WARNING - Huge likelihood value found for parameters ";
137 for (
int i = 0; i < fFunc.nObs(); ++i)
149 assert(fFunc.nObs() == 1);
151 return (*
this)(&tmp);
157 mutable double fMaxL;
172 fLikelihood(fFunctor, 0, nllMinimum),
174 fXmin(bindParams.getSize() ),
175 fXmax(bindParams.getSize() ),
176 fNorm(1.0), fNormErr(0.0), fOffset(0), fMaxPOI(0),
177 fHasNorm(false), fUseOldValues(true), fError(false)
181 fPriorFunc = std::make_shared<RooFunctor>(*prior, bindParams,
RooArgList());
182 fLikelihood.SetPrior(fPriorFunc.get() );
185 fIntegrator.SetFunction(fLikelihood, bindParams.
getSize() );
188 <<
" nllMinimum is " << nllMinimum << std::endl;
190 std::vector<double> par(bindParams.
getSize());
191 for (
unsigned int i = 0; i < fXmin.size(); ++i) {
197 <<
" in interval [ " << fXmin[i] <<
" , " << fXmax[i] <<
" ] " << std::endl;
206 fNorm = (*this)( fMaxPOI );
209 fNormCdfValues.insert(std::make_pair(fXmin[0], 0) );
210 fNormCdfValues.insert(std::make_pair(fXmax[0], 1.0) );
217 PosteriorCdfFunction(
const PosteriorCdfFunction & rhs) :
219 fFunctor(rhs.fFunctor),
221 fPriorFunc(rhs.fPriorFunc),
222 fLikelihood(fFunctor, fPriorFunc.get(), rhs.fLikelihood.fOffset),
227 fNormErr( rhs.fNormErr),
228 fOffset(rhs.fOffset),
229 fMaxPOI(rhs.fMaxPOI),
230 fHasNorm(rhs.fHasNorm),
231 fUseOldValues(rhs.fUseOldValues),
233 fNormCdfValues(rhs.fNormCdfValues)
235 fIntegrator.SetFunction(fLikelihood, fXmin.size() );
244 bool HasError()
const {
return fError; }
249 return new PosteriorCdfFunction(*
this);
253 void SetOffset(
double offset) { fOffset = offset; }
258 PosteriorCdfFunction&
operator=(
const PosteriorCdfFunction &) {
262 double DoEval (
double x)
const {
266 if (
x <= fXmin[0] )
return -fOffset;
268 if (
x >= fMaxPOI && fHasNorm)
return 1. - fOffset;
272 if (fHasNorm && fUseOldValues) {
274 std::map<double,double>::iterator itr = fNormCdfValues.upper_bound(
x);
276 if (itr != fNormCdfValues.end() ) {
277 fXmin[0] = itr->first;
278 normcdf0 = itr->second;
284 fFunctor.binding().resetNumCall();
286 double cdf = fIntegrator.Integral(&fXmin[0],&fXmax[0]);
287 double error = fIntegrator.Error();
288 double normcdf = cdf/fNorm;
291 << fXmax[0] <<
"] integral = " << cdf <<
" +/- " << error
292 <<
" norm-integ = " << normcdf <<
" cdf(x) = " << normcdf+normcdf0
293 <<
" ncalls = " << fFunctor.binding().numCall() << std::endl;
295 if (
TMath::IsNaN(cdf) || cdf > std::numeric_limits<double>::max()) {
301 if (cdf != 0 && error/cdf > 0.2 )
303 <<
" x = " <<
x <<
" cdf(x) = " << cdf <<
" +/- " << error << std::endl;
307 << cdf <<
" +/- " << error << std::endl;
316 fNormCdfValues.insert(std::make_pair(
x, normcdf) );
319 double errnorm =
sqrt( error*error + normcdf*normcdf * fNormErr * fNormErr )/fNorm;
320 if (normcdf > 1. + 3 * errnorm) {
322 <<
" x = " <<
x <<
" normcdf(x) = " << normcdf <<
" +/- " << error/fNorm << std::endl;
325 return normcdf - fOffset;
329 mutable std::shared_ptr<RooFunctor> fPriorFunc;
330 LikelihoodFunction fLikelihood;
332 mutable std::vector<double> fXmin;
333 mutable std::vector<double> fXmax;
335 mutable double fNormErr;
341 mutable std::map<double,double> fNormCdfValues;
355 norm = 1.0,
double nllOffset = 0,
int niter = 0) :
358 fLikelihood(fFunctor, 0, nllOffset),
360 fXmin(nuisParams.getSize() ),
361 fXmax(nuisParams.getSize() ),
367 fPriorFunc = std::make_shared<RooFunctor>(*prior, nuisParams,
RooArgList());
368 fLikelihood.SetPrior(fPriorFunc.get() );
372 for (
unsigned int i = 0; i < fXmin.size(); ++i) {
377 <<
" in interval [" << fXmin[i] <<
" , " << fXmax[i] <<
" ] " << std::endl;
379 if (fXmin.size() == 1) {
382 fIntegratorOneDim->SetFunction(fLikelihood);
387 else if (fXmin.size() > 1) {
389 fIntegratorMultiDim->SetFunction(fLikelihood, fXmin.size());
393 fIntegratorMultiDim->SetOptions(opt);
407 double Error()
const {
return fError;}
411 double DoEval (
double x)
const {
416 fFunctor.binding().resetNumCall();
420 if (fXmin.size() == 1) {
421 f = fIntegratorOneDim->Integral(fXmin[0],fXmax[0]);
422 error = fIntegratorOneDim->Error();
424 else if (fXmin.size() > 1) {
425 f = fIntegratorMultiDim->Integral(&fXmin[0],&fXmax[0]);
426 error = fIntegratorMultiDim->Error();
434 <<
x <<
"\tf(x) = " <<
f <<
" +/- " << error
435 <<
" norm-f(x) = " <<
f/fNorm
436 <<
" ncalls = " << fFunctor.binding().numCall() << std::endl;
441 if (
f != 0 && error/
f > 0.2 )
443 << fXmin.size() <<
" Dim is larger than 20 % "
444 <<
"x = " <<
x <<
" p(x) = " <<
f <<
" +/- " << error << std::endl;
446 fError = error / fNorm;
451 mutable std::shared_ptr<RooFunctor> fPriorFunc;
452 LikelihoodFunction fLikelihood;
454 std::unique_ptr<ROOT::Math::Integrator> fIntegratorOneDim;
455 std::unique_ptr<ROOT::Math::IntegratorMultiDim> fIntegratorMultiDim;
456 std::vector<double> fXmin;
457 std::vector<double> fXmax;
459 mutable double fError;
471 nllOffset = 0,
int niter = 0,
bool redoToys =
true ) :
474 fLikelihood(fFunctor, 0, nllOffset),
477 fNuisParams(nuisParams),
479 fNumIterations(niter),
483 if (niter == 0) fNumIterations = 100;
486 fPriorFunc = std::make_shared<RooFunctor>(*prior, nuisParams,
RooArgList());
487 fLikelihood.SetPrior(fPriorFunc.get() );
490 ooccoutI((
TObject*)0,
InputArguments) <<
"PosteriorFunctionFromToyMC::Evaluate the posterior function by randomizing the nuisances: niter " << fNumIterations << std::endl;
492 ooccoutI((
TObject*)0,
InputArguments) <<
"PosteriorFunctionFromToyMC::Pdf used for randomizing the nuisance is " << fPdf->GetName() << std::endl;
495 for (
int i = 0; i < fNuisParams.getSize(); ++i) {
496 if (!vars->
find( fNuisParams[i].GetName() ) ) {
498 <<
" is not part of sampling pdf. "
499 <<
"they will be treated as constant " << std::endl;
505 ooccoutI((
TObject*)0,
InputArguments) <<
"PosteriorFunctionFromToyMC::Generate nuisance toys only one time (for all POI points)" << std::endl;
510 virtual ~PosteriorFunctionFromToyMC() {
if (fGenParams)
delete fGenParams; }
513 void GenerateToys()
const {
514 if (fGenParams)
delete fGenParams;
515 fGenParams = fPdf->generate(fNuisParams, fNumIterations);
521 double Error()
const {
return fError;}
533 double DoEval(
double x)
const {
535 int npar = fNuisParams.getSize();
540 if (fRedoToys) GenerateToys();
541 if (!fGenParams)
return 0;
551 for(
int iter=0; iter<fNumIterations; ++iter) {
554 std::vector<double> p(npar);
555 for (
int i = 0; i < npar; ++i) {
556 const RooArgSet* genset=fGenParams->get(iter);
565 double fval = fLikelihood( &p.front() );
571 double nuisPdfVal = fPdf->getVal(&arg);
575 if( fval > std::numeric_limits<double>::max() ) {
577 <<
"Likelihood evaluates to infinity " << std::endl;
580 for (
int i = 0; i < npar; ++i)
589 <<
"Likelihood is a NaN " << std::endl;
592 for (
int i = 0; i < npar; ++i)
606 double val =
sum/double(fNumIterations);
607 double dval2 = std::max( sum2/
double(fNumIterations) - val*val, 0.0);
608 fError =
std::sqrt( dval2 / fNumIterations);
612 <<
x <<
"\tp(x) = " << val <<
" +/- " << fError << std::endl;
615 if (val != 0 && fError/val > 0.2 ) {
617 <<
" - Error in estimating posterior is larger than 20% ! "
618 <<
"x = " <<
x <<
" p(x) = " << val <<
" +/- " << fError << std::endl;
626 mutable std::shared_ptr<RooFunctor> fPriorFunc;
627 LikelihoodFunction fLikelihood;
633 mutable double fError;
650 fProductPdf (0), fLogLike(0), fLikelihood (0), fIntegratedLikelihood (0), fPosteriorPdf(0),
651 fPosteriorFunction(0), fApproxPosterior(0),
652 fLower(0), fUpper(0),
654 fSize(0.05), fLeftSideFraction(0.5),
655 fBrfPrecision(0.00005),
658 fValidInterval(false)
676 fPriorPdf(&priorPdf),
678 fProductPdf (0), fLogLike(0), fLikelihood (0), fIntegratedLikelihood (0), fPosteriorPdf(0),
679 fPosteriorFunction(0), fApproxPosterior(0),
680 fLower(0), fUpper(0),
682 fSize(0.05), fLeftSideFraction(0.5),
683 fBrfPrecision(0.00005),
686 fValidInterval(false)
701 fPdf(
model.GetPdf()),
702 fPriorPdf(
model.GetPriorPdf()),
704 fProductPdf (0), fLogLike(0), fLikelihood (0), fIntegratedLikelihood (0), fPosteriorPdf(0),
705 fPosteriorFunction(0), fApproxPosterior(0),
706 fLower(0), fUpper(0),
708 fSize(0.05), fLeftSideFraction(0.5),
709 fBrfPrecision(0.00005),
712 fValidInterval(false)
761 if (
model.GetParametersOfInterest())
fPOI.
add( *(
model.GetParametersOfInterest()) );
790 coutE(
InputArguments) <<
"BayesianCalculator::GetPosteriorPdf - missing pdf model" << std::endl;
794 coutE(
InputArguments) <<
"BayesianCalculator::GetPosteriorPdf - missing parameter of interest" << std::endl;
798 coutE(
InputArguments) <<
"BayesianCalculator::GetPosteriorPdf - current implementation works only on 1D intervals" << std::endl;
814 ccoutD(
Eval) <<
"BayesianCalculator::GetPosteriorFunction : "
823 if ( nllVal > std::numeric_limits<double>::max() ) {
824 coutE(
Eval) <<
"BayesianCalculator::GetPosteriorFunction : "
825 <<
" Negative log likelihood evaluates to infinity " << std::endl
826 <<
" Non-const Parameter values : ";
828 for (
int i = 0; i < p.
getSize(); ++i) {
830 if (
v!=0)
ccoutE(
Eval) <<
v->GetName() <<
" = " <<
v->getVal() <<
" ";
833 ccoutE(
Eval) <<
"-- Perform a full likelihood fit of the model before or set more reasonable parameter values"
835 coutE(
Eval) <<
"BayesianCalculator::GetPosteriorFunction : " <<
" cannot compute posterior function " << std::endl;
855 coutI(
Eval) <<
"BayesianCalculator::GetPosteriorFunction : "
856 <<
" nll value " << nllVal <<
" poi value = " << poi->
getVal() << std::endl;
861 bool ret = minim.
Minimize(100,1.E-3,1.E-3);
865 coutI(
Eval) <<
"BayesianCalculator::GetPosteriorFunction : minimum of NLL vs POI for POI = "
870 delete constrainedParams;
875 ccoutD(
Eval) <<
"BayesianCalculator::GetPosteriorFunction : use ROOFIT integration "
880 TString likeName = TString(
"likelihood_times_prior_") + TString(
fPriorPdf->
GetName());
882 formula.Form(
"exp(-@0+%f+log(@1))",
fNLLMin);
908 TString likeName = TString(
"likelihood_times_prior_") + TString(pdfAndPrior->
GetName());
910 formula.Form(
"exp(-@0+%f)",
fNLLMin);
933 bool doToysEveryIteration =
true;
939 ccoutI(
Eval) <<
"BayesianCalculator::GetPosteriorFunction : no nuisance pdf is provided, try using global pdf (this will be slower)"
945 TString
name =
"toyposteriorfunction_from_";
961 TString
name =
"posteriorfunction_from_";
987 if (!plike)
return 0;
991 TString posteriorName = this->
GetName() + TString(
"_posteriorPdf_") + plike->
GetName();
1018 if (!posterior)
return 0;
1027 if (!plot)
return 0;
1032 plot->
SetTitle(TString(
"Posterior probability of parameter \"")+TString(poi->
GetName())+TString(
"\""));
1100 coutW(
Eval) <<
"BayesianCalculator::GetInterval - recomputing interval for the same CL and same model" << std::endl;
1104 coutE(
Eval) <<
"BayesianCalculator::GetInterval - no parameter of interest is set " << std::endl;
1143 coutW(
Eval) <<
"BayesianCalculator::GetInterval - computing integral from cdf failed - do a scan in "
1161 coutE(
Eval) <<
"BayesianCalculator::GetInterval - cannot compute a valid interval - return a dummy [1,0] interval"
1165 coutI(
Eval) <<
"BayesianCalculator::GetInterval - found a valid interval : [" <<
fLower <<
" , "
1166 <<
fUpper <<
" ]" << std::endl;
1169 TString interval_name = TString(
"BayesianInterval_a") + TString(this->
GetName());
1171 interval->
SetTitle(
"SimpleInterval from BayesianCalculator");
1187 return h->GetBinCenter(
h->GetMaximumBin() );
1196 coutI(
Eval) <<
"BayesianCalculator: Compute interval using RooFit: posteriorPdf + createCdf + RooBrentRootFinder " << std::endl;
1209 if (!cdf_bind)
return;
1214 double tmpVal = poi->
getVal();
1217 if (lowerCutOff > 0) {
1218 double y = lowerCutOff;
1224 if (upperCutOff < 1.0) {
1225 double y=upperCutOff;
1230 if (!ret)
coutE(
Eval) <<
"BayesianCalculator::GetInterval "
1231 <<
"Error returned from Root finder, estimated interval is not fully correct"
1250 coutI(
InputArguments) <<
"BayesianCalculator:GetInterval Compute the interval from the posterior cdf " << std::endl;
1255 coutE(
InputArguments) <<
"BayesianCalculator::GetInterval() cannot make posterior Function " << std::endl;
1269 if( cdf.HasError() ) {
1270 coutE(
Eval) <<
"BayesianCalculator: Numerical error computing CDF integral - try a different method " << std::endl;
1278 ccoutD(
Eval) <<
"BayesianCalculator::GetInterval - finding roots of posterior using RF " << rf.
Name()
1281 if (lowerCutOff > 0) {
1282 cdf.SetOffset(lowerCutOff);
1283 ccoutD(
NumIntegration) <<
"Integrating posterior to get cdf and search lower limit at p =" << lowerCutOff << std::endl;
1285 if( cdf.HasError() )
1286 coutW(
Eval) <<
"BayesianCalculator: Numerical error integrating the CDF " << std::endl;
1288 coutE(
NumIntegration) <<
"BayesianCalculator::GetInterval - Error from root finder when searching lower limit !" << std::endl;
1296 if (upperCutOff < 1.0) {
1297 cdf.SetOffset(upperCutOff);
1298 ccoutD(
NumIntegration) <<
"Integrating posterior to get cdf and search upper interval limit at p =" << upperCutOff << std::endl;
1300 if( cdf.HasError() )
1301 coutW(
Eval) <<
"BayesianCalculator: Numerical error integrating the CDF " << std::endl;
1303 coutE(
NumIntegration) <<
"BayesianCalculator::GetInterval - Error from root finder when searching upper limit !" << std::endl;
1334 if (!posterior)
return;
1342 coutI(
Eval) <<
"BayesianCalculator - scan posterior function in nbins = " << tmp->
GetNpx() << std::endl;
1348 TString
name = posterior->
GetName() + TString(
"_approx");
1349 TString title = posterior->
GetTitle() + TString(
"_approx");
1369 ccoutD(
Eval) <<
"BayesianCalculator: Compute interval from the approximate posterior " << std::endl;
1375 double limits[2] = {0,0};
1376 prob[0] = lowerCutOff;
1377 prob[1] = upperCutOff;
1388 coutI(
Eval) <<
"BayesianCalculator - computing shortest interval with CL = " << 1.-
fSize << std::endl;
1400 std::vector<int> index(
n);
1404 double actualCL = 0;
1409 for (
int i = 0; i <
n; ++i) {
1411 double p = bins[ idx] / norm;
1424 ccoutD(
Eval) <<
"BayesianCalculator::ComputeShortestInterval - actual interval CL = "
1425 << actualCL <<
" difference from requested is " << (actualCL-(1.-
fSize))/
fSize*100. <<
"% "
1426 <<
" limits are [ " << lower <<
" , " <<
" upper ] " << std::endl;
1429 if (lower < upper) {
1435 if ( std::abs(actualCL-(1.-
fSize)) > 0.1*(1.-
fSize) )
1436 coutW(
Eval) <<
"BayesianCalculator::ComputeShortestInterval - actual interval CL = "
1437 << actualCL <<
" differs more than 10% from desired CL value - must increase nbins "
1438 <<
n <<
" to an higher value " << std::endl;
1441 coutE(
Eval) <<
"BayesianCalculator::ComputeShortestInterval " <<
n <<
" bins are not sufficient " << std::endl;
void Error(const char *location, const char *msgfmt,...)
TRObject operator()(const T1 &t1) const
Binding & operator=(OUT(*fun)(void))
User class for performing function minimization.
virtual bool Minimize(int maxIter, double absTol=1.E-8, double relTol=1.E-10)
Find minimum position iterating until convergence specified by the absolute and relative tolerance or...
void SetFunction(const ROOT::Math::IGenFunction &f, double xlow, double xup)
Sets function to be minimized.
virtual double FValMinimum() const
Return function value at current estimate of the minimum.
Functor1D class for one-dimensional functions.
Interface (abstract class) for generic functions objects of one-dimension Provides a method to evalua...
Numerical multi dimensional integration options.
void Print(std::ostream &os=std::cout) const
print all the options
void SetNCalls(unsigned int calls)
set maximum number of function calls
User class for performing multidimensional integration.
static IntegrationMultiDim::Type GetType(const char *name)
static function to get the enumeration from a string
User Class for performing numerical integration of a function in one dimension.
static IntegrationOneDim::Type GetType(const char *name)
static function to get the enumeration from a string
User Class to find the Root of one dimensional functions.
const char * Name() const
Return the current and latest estimate of the lower value of the Root-finding interval (for bracketin...
bool Solve(Function &f, Derivative &d, double start, int maxIter=100, double absTol=1E-8, double relTol=1E-10)
double Root() const
Return the current and latest estimate of the Root.
RooAbsArg is the common abstract base class for objects that represent a value (of arbitrary type) an...
RooArgSet * getParameters(const RooAbsData *data, Bool_t stripDisconnected=kTRUE) const
Create a list of leaf nodes in the arg tree starting with ourself as top node that don't match any of...
virtual void removeAll()
Remove all arguments from our set, deleting them if we own them.
virtual Bool_t add(const RooAbsArg &var, Bool_t silent=kFALSE)
Add the specified argument to list.
RooAbsArg * first() const
RooAbsArg * find(const char *name) const
Find object with given name in list.
RooAbsData is the common abstract base class for binned and unbinned datasets.
Abstract interface for evaluating a real-valued function of one real variable and performing numerica...
RooAbsPdf is the abstract interface for all probability density functions The class provides hybrid a...
virtual RooAbsReal * createNLL(RooAbsData &data, const RooLinkedList &cmdList)
Construct representation of -log(L) of PDFwith given dataset.
RooAbsReal * createCdf(const RooArgSet &iset, const RooArgSet &nset=RooArgSet())
Create a cumulative distribution function of this p.d.f in terms of the observables listed in iset.
RooAbsRealLValue is the common abstract base class for objects that represent a real value that may a...
virtual Double_t getMax(const char *name=0) const
RooPlot * frame(const RooCmdArg &arg1, const RooCmdArg &arg2=RooCmdArg::none(), const RooCmdArg &arg3=RooCmdArg::none(), const RooCmdArg &arg4=RooCmdArg::none(), const RooCmdArg &arg5=RooCmdArg::none(), const RooCmdArg &arg6=RooCmdArg::none(), const RooCmdArg &arg7=RooCmdArg::none(), const RooCmdArg &arg8=RooCmdArg::none()) const
Create a new RooPlot on the heap with a drawing frame initialized for this object,...
virtual Double_t getMin(const char *name=0) const
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
virtual RooPlot * plotOn(RooPlot *frame, const RooCmdArg &arg1=RooCmdArg(), const RooCmdArg &arg2=RooCmdArg(), const RooCmdArg &arg3=RooCmdArg(), const RooCmdArg &arg4=RooCmdArg(), const RooCmdArg &arg5=RooCmdArg(), const RooCmdArg &arg6=RooCmdArg(), const RooCmdArg &arg7=RooCmdArg(), const RooCmdArg &arg8=RooCmdArg(), const RooCmdArg &arg9=RooCmdArg(), const RooCmdArg &arg10=RooCmdArg()) const
Plot (project) PDF on specified frame.
TF1 * asTF(const RooArgList &obs, const RooArgList &pars=RooArgList(), const RooArgSet &nset=RooArgSet()) const
Return a ROOT TF1,2,3 object bound to this RooAbsReal with given definition of observables and parame...
Double_t getVal(const RooArgSet *set=0) const
Evaluate object. Returns either cached value or triggers a recalculation.
RooAbsReal * createIntegral(const RooArgSet &iset, const RooCmdArg &arg1, const RooCmdArg &arg2=RooCmdArg::none(), const RooCmdArg &arg3=RooCmdArg::none(), const RooCmdArg &arg4=RooCmdArg::none(), const RooCmdArg &arg5=RooCmdArg::none(), const RooCmdArg &arg6=RooCmdArg::none(), const RooCmdArg &arg7=RooCmdArg::none(), const RooCmdArg &arg8=RooCmdArg::none()) const
Create an object that represents the integral of the function over one or more observables listed in ...
RooAbsFunc * bindVars(const RooArgSet &vars, const RooArgSet *nset=0, Bool_t clipInvalid=kFALSE) const
Create an interface adaptor f(vars) that binds us to the specified variables (in arbitrary order).
static Int_t numEvalErrors()
Return the number of logged evaluation errors since the last clearing.
static void setEvalErrorLoggingMode(ErrorLoggingMode m)
Set evaluation error logging mode.
static void clearEvalErrorLog()
Clear the stack of evaluation error messages.
RooFunctor * functor(const RooArgList &obs, const RooArgList &pars=RooArgList(), const RooArgSet &nset=RooArgSet()) const
Return a RooFunctor object bound to this RooAbsReal with given definition of observables and paramete...
RooArgSet is a container object that can hold multiple RooAbsArg objects.
virtual Bool_t add(const RooAbsCollection &col, Bool_t silent=kFALSE)
Add a collection of arguments to this collection by calling add() for each element in the source coll...
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.
void setTol(Double_t tol)
RooDataSet is a container class to hold unbinned data.
RooCFunction1Binding is a templated implementation of class RooAbsReal that binds generic C(++) funct...
Lightweight interface adaptor that exports a RooAbsPdf as a functor.
RooGenericPdf is a concrete implementation of a probability density function, which takes a RooArgLis...
A RooPlot is a plot frame and a container for graphics objects within that frame.
void SetTitle(const char *name)
Set the title of the RooPlot to 'title'.
RooProdPdf is an efficient implementation of a product of PDFs of the form.
RooRealVar represents a fundamental (non-derived) real valued object.
virtual void setVal(Double_t value)
Set value of variable to 'value'.
BayesianCalculator is a concrete implementation of IntervalCalculator, providing the computation of a...
ROOT::Math::IGenFunction * fPosteriorFunction
RooAbsPdf * GetPosteriorPdf() const
Build and return the posterior pdf (i.e posterior function normalized to all range of poi) Note that ...
virtual SimpleInterval * GetInterval() const
Compute the interval.
RooPlot * GetPosteriorPlot(bool norm=false, double precision=0.01) const
return a RooPlot with the posterior and the credibility region NOTE: User takes ownership of the retu...
void ClearAll() const
clear all cached pdf objects
virtual Double_t ConfidenceLevel() const
Get the Confidence level for the test.
void ComputeShortestInterval() const
compute the shortest interval
RooArgSet fConditionalObs
RooAbsReal * fIntegratedLikelihood
virtual ~BayesianCalculator()
void ApproximatePosterior() const
approximate posterior in nbins using a TF1 scan the poi values and evaluate the posterior at each poi...
RooArgSet fNuisanceParameters
virtual void SetModel(const ModelConfig &model)
set the model to use The model pdf, prior pdf, parameter of interest and nuisances will be taken acco...
double GetMode() const
Returns the value of the parameter for the point in parameter-space that is the most likely.
RooAbsReal * GetPosteriorFunction() const
Build and return the posterior function (not normalized) as a RooAbsReal the posterior is obtained fr...
void SetIntegrationType(const char *type)
set the integration type (possible type are) :
RooAbsPdf * fPosteriorPdf
void ComputeIntervalFromApproxPosterior(double c1, double c2) const
compute the interval using the approximate posterior function
BayesianCalculator()
default constructor
void ComputeIntervalUsingRooFit(double c1, double c2) const
internal function compute the interval using RooFit
void ComputeIntervalFromCdf(double c1, double c2) const
internal function compute the interval using Cdf integration
ModelConfig is a simple class that holds configuration information specifying how a model should be u...
SimpleInterval is a concrete implementation of the ConfInterval interface.
const Float_t * GetArray() const
virtual Double_t GetBinUpEdge(Int_t bin) const
Return up edge of bin.
virtual TH1 * GetHistogram() const
Return a pointer to the histogram used to visualise the function.
virtual void SetNpx(Int_t npx=100)
Set the number of points used to draw the function.
virtual Int_t GetQuantiles(Int_t nprobSum, Double_t *q, const Double_t *probSum)
Compute Quantiles for density distribution of this function.
virtual Int_t GetNpx() const
1-D histogram with a double per channel (see TH1 documentation)}
TAxis * GetXaxis()
Get the behaviour adopted by the object about the statoverflows. See EStatOverflows for more informat...
virtual Double_t GetBinLowEdge(Int_t bin) const
Return bin lower edge for 1D histogram.
virtual void SetName(const char *name)
Change the name of this histogram.
virtual Double_t GetSumOfWeights() const
Return the sum of weights excluding under/overflows.
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
virtual const char * GetTitle() const
Returns title of object.
virtual TObject * Clone(const char *newname="") const
Make a clone of an object using the Streamer facility.
virtual const char * GetName() const
Returns name of object.
Mother of all ROOT objects.
std::string GetName(const std::string &scope_name)
Namespace for new Math classes and functions.
IBaseFunctionOneDim IGenFunction
Namespace for new ROOT classes and functions.
RooCmdArg Constrain(const RooArgSet ¶ms)
RooCmdArg DrawOption(const char *opt)
RooCmdArg GlobalObservables(const RooArgSet &globs)
RooCmdArg FillColor(Color_t color)
RooCmdArg Precision(Double_t prec)
RooCmdArg Range(const char *rangeName, Bool_t adjustNorm=kTRUE)
RooCmdArg ConditionalObservables(const RooArgSet &set)
Type GetType(const std::string &Name)
@(#)root/roostats:$Id$ Author: George Lewis, Kyle Cranmer
void RemoveConstantParameters(RooArgSet *set)
const ROOT::Math::RootFinder::EType kRootFinderType
void Sort(Index n, const Element *a, Index *index, Bool_t down=kTRUE)
static long int sum(long int i)