86 ConfInterval(name), fBestFitParams(0), fLikelihoodRatio(0), fConfidenceLevel(0.95)
124 std::cout <<
"parameters don't match" << std::endl;
131 std::cout <<
"likelihood ratio not set" << std::endl;
144 std::cout <<
"The likelihood ratio is < 0, indicates a bad minimum or numerical precision problems. Will return true" << std::endl;
177 std::cout <<
"size is wrong, parameters don't match" << std::endl;
181 std::cout <<
"size is ok, but parameters don't match" << std::endl;
231 if (!profilell)
return false;
246 for (
int i = 0; i < params.
getSize(); ++i) {
258 ccoutI(
InputArguments) <<
"LikelihoodInterval: using nll offset - set all RooAbsReal to hide the offset " << std::endl;
264 std::transform(minimType.begin(), minimType.end(), minimType.begin(), (int(*)(int)) tolower );
265 *minimType.begin() = toupper( *minimType.begin());
267 if (minimType !=
"Minuit" && minimType !=
"Minuit2") {
268 ccoutE(
InputArguments) << minimType <<
" is wrong type of minimizer for getting interval limits or contours - must use Minuit or Minuit2" << std::endl;
284 for (
unsigned int i = 0; i <
fMinFunc->NDim(); ++i) {
312 lower = itrl->second;
313 upper = itru->second;
322 int ix = params.
index(¶m);
324 ccoutE(
InputArguments) <<
"Error - invalid parameter " << param.
GetName() <<
" specified for finding the interval limits " << std::endl;
331 ccoutE(
Eval) <<
"Error returned from minimization of likelihood function - cannot find interval limits " << std::endl;
339 err_level = err_level/2;
342 unsigned int ivarX = ix;
346 ret =
fMinimizer->GetMinosError(ivarX, elow, eup );
386 int ix = params.
index(¶mX);
387 int iy = params.
index(¶mY);
388 if (ix < 0 || iy < 0) {
389 coutE(
InputArguments) <<
"LikelihoodInterval - Error - invalid parameters specified for finding the contours; parX = " << paramX.
GetName()
390 <<
" parY = " << paramY.
GetName() << std::endl;
397 coutE(
Eval) <<
"LikelihoodInterval - Error returned creating minimizer for likelihood function - cannot find contour points " << std::endl;
405 cont_level = cont_level/2;
408 unsigned int ncp = npoints;
409 unsigned int ivarX = ix;
410 unsigned int ivarY = iy;
411 coutI(
Minimization) <<
"LikelihoodInterval - Finding the contour of " << paramX.
GetName() <<
" ( " << ivarX <<
" ) and " << paramY.
GetName() <<
" ( " << ivarY <<
" ) " << std::endl;
412 ret =
fMinimizer->Contour(ivarX, ivarY, ncp, x, y );
417 if (
int(ncp) < npoints) {
418 coutW(
Minimization) <<
"LikelihoodInterval -Warning - Less points calculated in contours np = " << ncp <<
" / " << npoints << std::endl;
virtual Double_t getMin(const char *name=0) const
RooArgSet * getVariables(Bool_t stripDisconnected=kTRUE) const
Return RooArgSet with all variables (tree leaf nodes of expresssion tree)
virtual const char * GetName() const
Returns name of object.
RooAbsReal * fLikelihoodRatio
snapshot of the model parameters with best fit value (managed internally)
std::map< std::string, double > fLowerLimits
Requested confidence level (eg. 0.95 for 95% CL)
std::shared_ptr< ROOT::Math::Minimizer > fMinimizer
map with cached upper bound values
virtual Double_t getMax(const char *name=0) const
std::map< std::string, double > fUpperLimits
map with cached lower bound values
Class RooProfileLL implements the profile likelihood estimator for a given likelihood and set of para...
Int_t index(const RooAbsArg *arg) const
LikelihoodInterval is a concrete implementation of the RooStats::ConfInterval interface.
std::shared_ptr< ROOT::Math::IMultiGenFunction > fMinFunc
transient pointer to functor class used by the minimizer
LikelihoodInterval(const char *name=0)
default constructor
Double_t getVal(const RooArgSet *set=0) const
void SetParameters(const RooArgSet *desiredVals, RooArgSet *paramsToChange)
RooFit::MsgLevel globalKillBelow() const
static ROOT::Math::Minimizer * CreateMinimizer(const std::string &minimizerType="", const std::string &algoType="")
static method to create the corrisponding Minimizer given the string Supported Minimizers types are: ...
virtual RooArgSet * GetParameters() const
return a cloned list of parameters of interest. User manages the return object
virtual Double_t ConfidenceLevel() const
return confidence level
Bool_t equals(const RooAbsCollection &otherColl) const
Check if this and other collection have identically named contents.
Bool_t FindLimits(const RooRealVar ¶m, double &lower, double &upper)
find both lower and upper interval boundaries for a given parameter return false if the bounds have n...
static RooMsgService & instance()
Return reference to singleton instance.
RooArgSet * fBestFitParams
parameters of interest for this interval
static void setHideOffset(Bool_t flag)
Double_t LowerLimit(const RooRealVar ¶m)
return the lower bound of the interval on a given parameter
Double_t Prob(Double_t chi2, Int_t ndf)
Computation of the probability for a certain Chi-squared (chi2) and number of degrees of freedom (ndf...
Double_t ChisquareQuantile(Double_t p, Double_t ndf)
Evaluate the quantiles of the chi-squared probability distribution function.
virtual Bool_t IsInInterval(const RooArgSet &) const
check if given point is in the interval
RooRealVar represents a fundamental (non-derived) real valued object.
virtual void setVal(Double_t value)
Set value of variable to 'value'.
Double_t UpperLimit(const RooRealVar ¶m)
return the upper bound of the interval on a given parameter
bool CreateMinimizer()
internal function to create the minimizer for finding the contours
void ResetLimits()
reset the cached limit values
static const std::string & DefaultMinimizerType()
void setGlobalKillBelow(RooFit::MsgLevel level)
std::shared_ptr< RooFunctor > fFunctor
transient pointer to minimizer class used to find limits and contour
ConfInterval is an interface class for a generic interval in the RooStats framework.
Bool_t CheckParameters(const RooArgSet &) const
check if parameters are correct (i.e. they are the POI of this interval)
Namespace for the RooStats classes.
virtual ~LikelihoodInterval()
destructor
RooAbsArg * find(const char *name) const
Find object with given name in list.
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
Int_t GetContourPoints(const RooRealVar ¶mX, const RooRealVar ¶mY, Double_t *x, Double_t *y, Int_t npoints=30)
return the 2D-contour points for the given subset of parameters by default make the contour using 30 ...
Template class to wrap any C++ callable object implementing operator() (const double * x) in a multi-...
void RemoveConstantParameters(RooArgSet *set)
Lightweight interface adaptor that exports a RooAbsPdf as a functor.
Double_t fConfidenceLevel
likelihood ratio function used to make contours (managed internally)
static bool UseStaticMinuit(bool on=true)
static function to switch on/off usage of static global TMinuit instance (gMinuit) By default it is u...
Double_t getError() const
void setError(Double_t value)