87#include "RConfigure.h"
109 fFunc.binding().resetNumCall();
116 double likelihood = std::exp(-nll);
118 if (
fPrior) likelihood *= (*fPrior)(
x);
120 int nCalls =
fFunc.binding().numCall();
121 if (nCalls > 0 && nCalls % 1000 == 0) {
122 ooccoutD(
nullptr,Eval) <<
"Likelihood evaluation ncalls = " << nCalls
123 <<
" x0 " <<
x[0] <<
" nll = " << nll+
fOffset;
125 ooccoutD(
nullptr,Eval) <<
" likelihood " << likelihood
126 <<
" max Likelihood " <<
fMaxL << std::endl;
129 if (likelihood >
fMaxL ) {
131 if ( likelihood > 1.E10) {
132 ooccoutW(
nullptr,Eval) <<
"LikelihoodFunction::() WARNING - Huge likelihood value found for parameters ";
133 for (
int i = 0; i <
fFunc.nObs(); ++i)
134 ooccoutW(
nullptr,Eval) <<
" x[" << i <<
" ] = " <<
x[i];
135 ooccoutW(
nullptr,Eval) <<
" nll = " << nll <<
" L = " << likelihood << std::endl;
145 assert(
fFunc.nObs() == 1);
147 return (*
this)(&tmp);
179 if (bindParams.
size() == 1) {
180 fIntegratorOneDim = std::make_unique<ROOT::Math::Integrator>(ROOT::Math::IntegratorOneDim::GetType(integType));
181 fIntegratorOneDim->SetFunction(fLikelihood);
183 fIntegrator = std::make_unique<ROOT::Math::IntegratorMultiDim>(ROOT::Math::IntegratorMultiDim::GetType(integType));
184 fIntegrator->SetFunction(fLikelihood, bindParams.size());
187 ooccoutD(
nullptr,NumericIntegration) <<
"PosteriorCdfFunction::Compute integral of posterior in nuisance and poi. "
188 <<
" nllMinimum is " << nllMinimum << std::endl;
190 std::vector<double> par(bindParams.
size());
191 for (
unsigned int i = 0; i <
fXmin.size(); ++i) {
196 ooccoutD(
nullptr,NumericIntegration) <<
"PosteriorFunction::Integrate" << var.
GetName()
197 <<
" in interval [ " <<
fXmin[i] <<
" , " <<
fXmax[i] <<
" ] " << std::endl;
210 if (
fError)
ooccoutE(
nullptr,NumericIntegration) <<
"PosteriorFunction::Error computing normalization - norm = " <<
fNorm << std::endl;
238 fIntegratorOneDim = std::make_unique<ROOT::Math::Integrator>(ROOT::Math::IntegratorOneDim::GetType(rhs.fIntegratorOneDim->Name().c_str()));
239 fIntegratorOneDim->SetFunction(fLikelihood);
241 fIntegrator = std::make_unique<ROOT::Math::IntegratorMultiDim>(ROOT::Math::IntegratorMultiDim::GetType(rhs.fIntegrator->Name().c_str()));
242 fIntegrator->SetFunction(fLikelihood, fXmin.size());
256 ooccoutD(
nullptr,NumericIntegration) <<
" cloning function .........." << std::endl;
285 fXmin[0] = itr->first;
286 normcdf0 = itr->second;
303 double normcdf = cdf/
fNorm;
305 ooccoutD(
nullptr,NumericIntegration) <<
"PosteriorCdfFunction: poi = [" <<
fXmin[0] <<
" , "
306 <<
fXmax[0] <<
"] integral = " << cdf <<
" +/- " << error
307 <<
" norm-integ = " << normcdf <<
" cdf(x) = " << normcdf+normcdf0
308 <<
" ncalls = " <<
fFunctor.binding().numCall() << std::endl;
310 if (
TMath::IsNaN(cdf) || cdf > std::numeric_limits<double>::max()) {
311 ooccoutE(
nullptr,NumericIntegration) <<
"PosteriorFunction::Error computing integral - cdf = "
316 if (cdf != 0 && error / cdf > 0.2) {
317 oocoutW(
nullptr, NumericIntegration)
318 <<
"PosteriorCdfFunction: integration error is larger than 20 % x0 = " <<
fXmin[0] <<
" x = " <<
x
319 <<
" cdf(x) = " << cdf <<
" +/- " << error << std::endl;
323 oocoutI(
nullptr,NumericIntegration) <<
"PosteriorCdfFunction - integral of posterior = "
324 << cdf <<
" +/- " << error << std::endl;
337 if (normcdf > 1. + 3 * errnorm) {
338 oocoutW(
nullptr,NumericIntegration) <<
"PosteriorCdfFunction: normalized cdf values is larger than 1"
339 <<
" x = " <<
x <<
" normcdf(x) = " << normcdf <<
" +/- " << error/
fNorm << std::endl;
348 mutable std::unique_ptr<ROOT::Math::IntegratorMultiDim>
fIntegrator;
373 norm = 1.0,
double nllOffset = 0,
int niter = 0) :
388 ooccoutD(
nullptr,NumericIntegration) <<
"PosteriorFunction::Evaluate the posterior function by integrating the nuisances: " << std::endl;
389 for (
unsigned int i = 0; i <
fXmin.size(); ++i) {
393 ooccoutD(
nullptr,NumericIntegration) <<
"PosteriorFunction::Integrate " << var.
GetName()
394 <<
" in interval [" <<
fXmin[i] <<
" , " <<
fXmax[i] <<
" ] " << std::endl;
396 if (
fXmin.size() == 1) {
404 else if (
fXmin.size() > 1) {
437 if (
fXmin.size() == 1) {
441 else if (
fXmin.size() > 1) {
450 ooccoutD(
nullptr,NumericIntegration) <<
"PosteriorFunction: POI value = "
451 <<
x <<
"\tf(x) = " <<
f <<
" +/- " << error
452 <<
" norm-f(x) = " <<
f/
fNorm
453 <<
" ncalls = " <<
fFunctor.binding().numCall() << std::endl;
455 if (
f != 0 && error /
f > 0.2) {
456 ooccoutW(
nullptr, NumericIntegration)
457 <<
"PosteriorFunction::DoEval - Error from integration in " <<
fXmin.size() <<
" Dim is larger than 20 % "
458 <<
"x = " <<
x <<
" p(x) = " <<
f <<
" +/- " << error << std::endl;
484 RooAbsReal *prior =
nullptr,
double nllOffset = 0,
int niter = 0,
bool redoToys =
true)
502 ooccoutI(
nullptr,InputArguments) <<
"PosteriorFunctionFromToyMC::Evaluate the posterior function by randomizing the nuisances: niter " <<
fNumIterations << std::endl;
504 ooccoutI(
nullptr,InputArguments) <<
"PosteriorFunctionFromToyMC::Pdf used for randomizing the nuisance is " <<
fPdf->GetName() << std::endl;
506 std::unique_ptr<RooArgSet> vars{
fPdf->getVariables()};
507 for (std::size_t i = 0; i <
fNuisParams.size(); ++i) {
510 <<
" is not part of sampling pdf. "
511 <<
"they will be treated as constant " << std::endl;
516 ooccoutI(
nullptr,InputArguments) <<
"PosteriorFunctionFromToyMC::Generate nuisance toys only one time (for all POI points)" << std::endl;
525 ooccoutE(
nullptr,InputArguments) <<
"PosteriorFunctionFromToyMC - failed to generate nuisance parameters" << std::endl;
562 std::vector<double> p(npar);
563 for (
int i = 0; i < npar; ++i) {
567 assert(var !=
nullptr);
579 double nuisPdfVal =
fPdf->getVal(&arg);
583 if( fval > std::numeric_limits<double>::max() ) {
584 ooccoutE(
nullptr,Eval) <<
"BayesianCalculator::EvalPosteriorFunctionFromToy : "
585 <<
"Likelihood evaluates to infinity " << std::endl;
586 ooccoutE(
nullptr,Eval) <<
"poi value = " <<
x << std::endl;
587 ooccoutE(
nullptr,Eval) <<
"Nuisance parameter values : ";
588 for (
int i = 0; i < npar; ++i)
590 ooccoutE(
nullptr,Eval) <<
" - return 0 " << std::endl;
596 ooccoutE(
nullptr,Eval) <<
"BayesianCalculator::EvalPosteriorFunctionFromToy : "
597 <<
"Likelihood is a NaN " << std::endl;
598 ooccoutE(
nullptr,Eval) <<
"poi value = " <<
x << std::endl;
599 ooccoutE(
nullptr,Eval) <<
"Nuisance parameter values : ";
600 for (
int i = 0; i < npar; ++i)
602 ooccoutE(
nullptr,Eval) <<
" - return 0 " << std::endl;
615 double dval2 = std::max( sum2/
double(
fNumIterations) - val*val, 0.0);
619 ooccoutD(
nullptr,NumericIntegration) <<
"PosteriorFunctionFromToyMC: POI value = "
620 <<
x <<
"\tp(x) = " << val <<
" +/- " <<
fError << std::endl;
623 if (val != 0 &&
fError/val > 0.2 ) {
624 ooccoutW(
nullptr,NumericIntegration) <<
"PosteriorFunctionFromToyMC::DoEval"
625 <<
" - Error in estimating posterior is larger than 20% ! "
626 <<
"x = " <<
x <<
" p(x) = " << val <<
" +/- " <<
fError << std::endl;
709 fPdf(model.GetPdf()),
761 fPdf = model.GetPdf();
768 if (model.GetParametersOfInterest())
fPOI.add( *(model.GetParametersOfInterest()) );
769 if (model.GetNuisanceParameters())
fNuisanceParameters.add( *(model.GetNuisanceParameters() ) );
770 if (model.GetConditionalObservables())
fConditionalObs.add( *(model.GetConditionalObservables() ) );
771 if (model.GetGlobalObservables())
fGlobalObs.add( *(model.GetGlobalObservables() ) );
798 coutE(InputArguments) <<
"BayesianCalculator::GetPosteriorPdf - missing pdf model" << std::endl;
802 coutE(InputArguments) <<
"BayesianCalculator::GetPosteriorPdf - missing parameter of interest" << std::endl;
805 if (
fPOI.size() > 1) {
806 coutE(InputArguments) <<
"BayesianCalculator::GetPosteriorPdf - current implementation works only on 1D intervals" << std::endl;
811 std::unique_ptr<RooArgSet> constrainedParams{
fPdf->getParameters(*
fData)};
822 ccoutD(Eval) <<
"BayesianCalculator::GetPosteriorFunction : "
823 <<
" pdf value " <<
fPdf->getVal()
824 <<
" neglogLikelihood = " <<
fLogLike->getVal() << std::endl;
827 ccoutD(Eval) <<
"\t\t\t priorPOI value " <<
fPriorPdf->getVal() << std::endl;
831 if ( nllVal > std::numeric_limits<double>::max() ) {
832 coutE(Eval) <<
"BayesianCalculator::GetPosteriorFunction : "
833 <<
" Negative log likelihood evaluates to infinity " << std::endl
834 <<
" Non-const Parameter values : ";
836 for (std::size_t i = 0; i < p.
size(); ++i) {
838 if (
v!=
nullptr)
ccoutE(Eval) <<
v->GetName() <<
" = " <<
v->getVal() <<
" ";
840 ccoutE(Eval) << std::endl;
841 ccoutE(Eval) <<
"-- Perform a full likelihood fit of the model before or set more reasonable parameter values"
843 coutE(Eval) <<
"BayesianCalculator::GetPosteriorFunction : " <<
" cannot compute posterior function " << std::endl;
863 coutI(Eval) <<
"BayesianCalculator::GetPosteriorFunction : "
864 <<
" nll value " << nllVal <<
" poi value = " << poi->
getVal() << std::endl;
873 coutI(Eval) <<
"BayesianCalculator::GetPosteriorFunction : minimum of NLL vs POI for POI = "
881 ccoutD(Eval) <<
"BayesianCalculator::GetPosteriorFunction : use ROOFIT integration "
886 std::string likeName = std::string{
"likelihood_times_prior_"} +
fPriorPdf->GetName();
887 std::stringstream formula;
888 formula <<
"std::exp(-@0+" << fNllMin <<
"+log(@1))";
902 std::string prodName = std::string{
"product_"} +
fPdf->GetName() +
"_" +
fPriorPdf->GetName();
908 std::unique_ptr<RooArgSet> constrParams{
fPdf->getParameters(*
fData)};
913 std::string likeName = std::string{
"likelihood_times_prior_"} + pdfAndPrior->
GetName();
914 std::stringstream formula;
915 formula <<
"exp(-@0+" <<
fNLLMin <<
")";
938 bool doToysEveryIteration =
true;
944 ccoutI(Eval) <<
"BayesianCalculator::GetPosteriorFunction : no nuisance pdf is provided, try using global pdf (this will be slower)"
974 <<
" errors reported in evaluating log-likelihood function " << std::endl;
992 if (!plike)
return nullptr;
1000 return posteriorPdf;
1038 if (!posterior)
return nullptr;
1047 if (!plot)
return nullptr;
1120 coutW(Eval) <<
"BayesianCalculator::GetInterval - recomputing interval for the same CL and same model" << std::endl;
1124 coutE(Eval) <<
"BayesianCalculator::GetInterval - no parameter of interest is set " << std::endl;
1156 coutW(Eval) <<
"BayesianCalculator::GetInterval - computing integral from cdf failed - do a scan in "
1167 <<
" errors reported in evaluating log-likelihood function " << std::endl;
1175 coutE(Eval) <<
"BayesianCalculator::GetInterval - cannot compute a valid interval - return a dummy [1,0] interval"
1179 coutI(Eval) <<
"BayesianCalculator::GetInterval - found a valid interval : [" <<
fLower <<
" , "
1180 <<
fUpper <<
" ]" << std::endl;
1185 interval->
SetTitle(
"SimpleInterval from BayesianCalculator");
1201 return h->GetBinCenter(
h->GetMaximumBin() );
1212 coutI(InputArguments) <<
"BayesianCalculator:GetInterval Compute the interval from the posterior cdf " << std::endl;
1217 coutE(InputArguments) <<
"BayesianCalculator::GetInterval() cannot make posterior Function " << std::endl;
1232 coutE(Eval) <<
"BayesianCalculator: Numerical error computing CDF integral - try a different method " << std::endl;
1240 ccoutD(Eval) <<
"BayesianCalculator::GetInterval - finding roots of posterior using RF " << rf.
Name()
1243 if (lowerCutOff > 0) {
1245 ccoutD(NumericIntegration) <<
"Integrating posterior to get cdf and search lower limit at p =" << lowerCutOff << std::endl;
1248 coutW(Eval) <<
"BayesianCalculator: Numerical error integrating the CDF " << std::endl;
1250 coutE(NumericIntegration) <<
"BayesianCalculator::GetInterval - Error from root finder when searching lower limit !" << std::endl;
1258 if (upperCutOff < 1.0) {
1260 ccoutD(NumericIntegration) <<
"Integrating posterior to get cdf and search upper interval limit at p =" << upperCutOff << std::endl;
1263 coutW(Eval) <<
"BayesianCalculator: Numerical error integrating the CDF " << std::endl;
1265 coutE(NumericIntegration) <<
"BayesianCalculator::GetInterval - Error from root finder when searching upper limit !" << std::endl;
1296 if (!posterior)
return;
1300 assert(tmp !=
nullptr);
1304 coutI(Eval) <<
"BayesianCalculator - scan posterior function in nbins = " << tmp->
GetNpx() << std::endl;
1331 ccoutD(Eval) <<
"BayesianCalculator: Compute interval from the approximate posterior " << std::endl;
1337 double limits[2] = {0,0};
1338 prob[0] = lowerCutOff;
1339 prob[1] = upperCutOff;
1351 coutI(Eval) <<
"BayesianCalculator - computing shortest interval with CL = " << 1.-
fSize << std::endl;
1358 assert(
h1 !=
nullptr);
1361 double * bins =
h1->GetArray();
1363 int n =
h1->GetSize()-2;
1364 std::vector<int> index(
n);
1369 double actualCL = 0;
1370 double upper =
h1->GetXaxis()->GetXmin();
1371 double lower =
h1->GetXaxis()->GetXmax();
1372 double norm =
h1->GetSumOfWeights();
1374 for (
int i = 0; i <
n; ++i) {
1376 double p = bins[ idx] / norm;
1384 if (
h1->GetBinLowEdge(idx+1) < lower)
1385 lower =
h1->GetBinLowEdge(idx+1);
1386 if (
h1->GetXaxis()->GetBinUpEdge(idx+1) > upper)
1387 upper =
h1->GetXaxis()->GetBinUpEdge(idx+1);
1390 ccoutD(Eval) <<
"BayesianCalculator::ComputeShortestInterval - actual interval CL = "
1391 << actualCL <<
" difference from requested is " << (actualCL-(1.-
fSize))/
fSize*100. <<
"% "
1392 <<
" limits are [ " << lower <<
" , " <<
" upper ] " << std::endl;
1395 if (lower < upper) {
1399 if (std::abs(actualCL - (1. -
fSize)) > 0.1 * (1. -
fSize)) {
1400 coutW(Eval) <<
"BayesianCalculator::ComputeShortestInterval - actual interval CL = " << actualCL
1401 <<
" differs more than 10% from desired CL value - must increase nbins " <<
n
1402 <<
" to an higher value " << std::endl;
1406 coutE(Eval) <<
"BayesianCalculator::ComputeShortestInterval " <<
n <<
" bins are not sufficient " << std::endl;
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
User class for performing function minimization.
void SetFunction(const ROOT::Math::IGenFunction &f, double xlow, double xup)
Sets function to be minimized.
bool Minimize(int maxIter, double absTol=1.E-8, double relTol=1.E-10) override
Find minimum position iterating until convergence specified by the absolute and relative tolerance or...
double FValMinimum() const override
Return function value at current estimate of the minimum.
Functor1D class for one-dimensional functions.
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
static IntegrationMultiDim::Type GetType(const char *name)
static function to get the enumeration from a string
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)
Solve f(x) = 0, given a derivative d.
double Root() const
Return the current and latest estimate of the Root.
Common abstract base class for objects that represent a value and a "shape" in RooFit.
virtual bool add(const RooAbsArg &var, bool silent=false)
Add the specified argument to list.
Storage_t::size_type size() const
RooAbsArg * find(const char *name) const
Find object with given name in list.
Abstract base class for binned and unbinned datasets.
Abstract interface for all probability density functions.
RooFit::OwningPtr< RooAbsReal > createNLL(RooAbsData &data, CmdArgs_t const &... cmdArgs)
Construct representation of -log(L) of PDF with given dataset.
Abstract base class for objects that represent a real value that may appear on the left hand side of ...
RooPlot * frame(const RooCmdArg &arg1, const RooCmdArg &arg2={}, const RooCmdArg &arg3={}, const RooCmdArg &arg4={}, const RooCmdArg &arg5={}, const RooCmdArg &arg6={}, const RooCmdArg &arg7={}, const RooCmdArg &arg8={}) const
Create a new RooPlot on the heap with a drawing frame initialized for this object,...
virtual double getMax(const char *name=nullptr) const
Get maximum of currently defined range.
virtual double getMin(const char *name=nullptr) const
Get minimum of currently defined range.
Abstract base class for objects that represent a real value and implements functionality common to al...
double getVal(const RooArgSet *normalisationSet=nullptr) const
Evaluate object.
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...
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.
virtual RooPlot * plotOn(RooPlot *frame, const RooCmdArg &arg1={}, const RooCmdArg &arg2={}, const RooCmdArg &arg3={}, const RooCmdArg &arg4={}, const RooCmdArg &arg5={}, const RooCmdArg &arg6={}, const RooCmdArg &arg7={}, const RooCmdArg &arg8={}, const RooCmdArg &arg9={}, const RooCmdArg &arg10={}) const
Plot (project) PDF on specified frame.
RooArgList is a container object that can hold multiple RooAbsArg objects.
RooArgSet is a container object that can hold multiple RooAbsArg objects.
RooCFunction1Binding is a templated implementation of class RooAbsReal that binds generic C(++) funct...
Lightweight interface adaptor that exports a RooAbsPdf as a functor.
Implementation of a probability density function that takes a RooArgList of servers and a C++ express...
Plot frame and a container for graphics objects within that frame.
void SetTitle(const char *name) override
Set the title of the RooPlot to 'title'.
Efficient implementation of a product of PDFs of the form.
Variable that can be changed from the outside.
ROOT::Math::IGenFunction * fPosteriorFunction
function representing the posterior
RooAbsReal * fLikelihood
internal pointer to likelihood function
double fNLLMin
minimum value of Nll
int fNumIterations
number of iterations (when using ToyMC)
RooAbsPdf * GetPosteriorPdf() const
return posterior pdf (object is managed by the user)
RooAbsData * fData
data set
RooPlot * GetPosteriorPlot(bool norm=false, double precision=0.01) const
get the plot with option to get it normalized
int fNScanBins
number of bins to scan, if = -1 no scan is done (default)
void ClearAll() const
clear all cached pdf objects
void ComputeShortestInterval() const
compute the shortest interval from the histogram representing the posterior
RooAbsPdf * fNuisancePdf
nuisance pdf (needed when using nuisance sampling technique)
RooArgSet fConditionalObs
conditional observables
double fBrfPrecision
root finder precision
RooAbsReal * fIntegratedLikelihood
integrated likelihood function, i.e - unnormalized posterior function
void ApproximatePosterior() const
approximate posterior in nbins using a TF1 scan the poi values and evaluate the posterior at each poi...
double fSize
size used for getting the interval
RooArgSet fNuisanceParameters
nuisance parameters
double fLeftSideFraction
fraction of probability content on left side of interval
RooArgSet fGlobalObs
global observables
double GetMode() const
return the mode (most probable value of the posterior function)
RooAbsPdf * fPdf
model pdf (could contain the nuisance pdf as constraint term)
SimpleInterval * GetInterval() const override
compute the interval.
RooAbsPdf * fProductPdf
internal pointer to model * prior
TF1 * fApproxPosterior
TF1 representing the scanned posterior function.
RooAbsReal * GetPosteriorFunction() const
return posterior function (object is managed by the BayesianCalculator class)
void SetIntegrationType(const char *type)
set the integration type (possible type are) :
RooAbsPdf * fPosteriorPdf
normalized (on the poi) posterior pdf
double fUpper
upper interval bound
double fLower
computer lower interval bound
TH1 * GetPosteriorHistogram() const
return the approximate posterior as histogram (TH1 object). Note the object is managed by the Bayesia...
void ComputeIntervalFromApproxPosterior(double c1, double c2) const
compute the interval using the approximate posterior function
BayesianCalculator()
constructor
void SetModel(const ModelConfig &model) override
set the model via the ModelConfig
RooAbsPdf * fPriorPdf
prior pdf (typically for the POI)
std::unique_ptr< RooAbsReal > fLogLike
internal pointer to log likelihood function
double ConfidenceLevel() const override
Get the Confidence level for the test.
~BayesianCalculator() override
destructor
void ComputeIntervalFromCdf(double c1, double c2) const
internal function compute the interval using Cdf integration
< A class that holds configuration information for a model using a workspace as a store
std::shared_ptr< RooFunctor > fPriorFunc
PosteriorCdfFunction & operator=(const PosteriorCdfFunction &)
std::unique_ptr< ROOT::Math::IntegratorMultiDim > fIntegrator
void SetOffset(double offset)
PosteriorCdfFunction(const PosteriorCdfFunction &rhs)
std::vector< double > fXmax
PosteriorCdfFunction(RooAbsReal &nll, RooArgList &bindParams, RooAbsReal *prior=nullptr, const char *integType=nullptr, double nllMinimum=0)
std::unique_ptr< ROOT::Math::Integrator > fIntegratorOneDim
double DoEval(double x) const override
implementation of the evaluation function. Must be implemented by derived classes
std::map< double, double > fNormCdfValues
std::vector< double > fXmin
ROOT::Math::IGenFunction * Clone() const override
Clone a function.
LikelihoodFunction fLikelihood
Posterior function obtaining sampling toy MC for the nuisance according to their pdf.
void GenerateToys() const
LikelihoodFunction fLikelihood
std::shared_ptr< RooFunctor > fPriorFunc
std::unique_ptr< RooDataSet > fGenParams
double DoEval(double x) const override
implementation of the evaluation function. Must be implemented by derived classes
PosteriorFunctionFromToyMC(RooAbsReal &nll, RooAbsPdf &pdf, RooRealVar &poi, RooArgList &nuisParams, RooAbsReal *prior=nullptr, double nllOffset=0, int niter=0, bool redoToys=true)
ROOT::Math::IGenFunction * Clone() const override
Clone a function.
LikelihoodFunction fLikelihood
PosteriorFunction(RooAbsReal &nll, RooRealVar &poi, RooArgList &nuisParams, RooAbsReal *prior=nullptr, const char *integType=nullptr, double norm=1.0, double nllOffset=0, int niter=0)
std::shared_ptr< RooFunctor > fPriorFunc
std::unique_ptr< ROOT::Math::IntegratorMultiDim > fIntegratorMultiDim
ROOT::Math::IGenFunction * Clone() const override
Clone a function.
std::vector< double > fXmin
std::vector< double > fXmax
double DoEval(double x) const override
implementation of the evaluation function. Must be implemented by derived classes
std::unique_ptr< ROOT::Math::Integrator > fIntegratorOneDim
SimpleInterval is a concrete implementation of the ConfInterval interface.
Use TF1, TF2, TF3 functions as RooFit objects.
virtual void SetNpx(Int_t npx=100)
TObject * Clone(const char *newname=nullptr) const override
Make a clone of an object using the Streamer facility.
virtual Int_t GetNpx() const
1-D histogram with a double per channel (see TH1 documentation)
TH1 is the base class of all histogram classes in ROOT.
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
const char * GetName() const override
Returns name of object.
const char * GetTitle() const override
Returns title of object.
RooCmdArg Constrain(const RooArgSet ¶ms)
RooCmdArg GlobalObservables(Args_t &&... argsOrArgSet)
RooCmdArg ConditionalObservables(Args_t &&... argsOrArgSet)
Create a RooCmdArg to declare conditional observables.
RooCmdArg FillColor(TColorNumber color)
RooCmdArg Precision(double prec)
RooCmdArg DrawOption(const char *opt)
RooCmdArg Range(const char *rangeName, bool adjustNorm=true)
Namespace for new Math classes and functions.
IBaseFunctionOneDim IGenFunction
Namespace for the RooStats classes.
void RemoveConstantParameters(RooArgSet *set)
const ROOT::Math::RootFinder::EType kRootFinderType
void Sort(Index n, const Element *a, Index *index, Bool_t down=kTRUE)
Sort the n elements of the array a of generic templated type Element.
void SetPrior(RooFunctor *prior)
LikelihoodFunction(RooFunctor &f, RooFunctor *prior=nullptr, double offset=0)
double operator()(const double *x) const
static uint64_t sum(uint64_t i)