173 if (!intervalParams->
contains(*arg) ) {
174 ccoutE(InputArguments) <<
"Parameter " << arg->
GetName() <<
"is not in the list of LikelihoodInterval parameters "
175 <<
" - do not use for plotting " << std::endl;
177 extraParams.
add(*arg);
184 ccoutE(InputArguments) <<
"LikelihoodIntervalPlot::Draw(" <<
GetName()
185 <<
") ERROR: contours for more than 2 dimensions not implemented!" << std::endl;
196 if (!profilell)
return;
201 newProfile = oldProfile;
204 auto *myparam =
static_cast<RooRealVar*
>((*fParamsPlot)[0]);
232 if (nPoints <=0) nPoints = 100;
251 double xmin = std::max(
x1, 2*xcont_min - xcont_max);
252 double xmax = std::min(
x2, 2*xcont_max - xcont_min);
255 TF1 * tmp = newProfile->
asTF(*myarg);
275 if ( x0 >
x1 && x0 <
x2) {
295 double xmin = myparam->getMin();
double xmax = myparam->getMax();
300 int prevBins = myarg->
getBins();
331 TLine *Yline_min =
new TLine(xcont_min,0.,xcont_min,Yat_Xmax);
332 TLine *Yline_max =
new TLine(xcont_max,0.,xcont_max,Yat_Xmax);
340 Yline_cutoff->
Draw();
363 bool useMinuit = !opt.
Contains(
"nominuit");
365 bool plotHist = !opt.
Contains(
"nohist");
368 if (opt.
Contains(
"minuit") ) useMinuit=
true;
369 if (useMinuit) plotHist =
false;
370 if (opt.
Contains(
"hist") ) plotHist=
true;
374 auto *myparamY =
static_cast<RooRealVar*
>((*fParamsPlot)[1]);
377 cont_level = cont_level/2;
381 for (
int i = 0; i < params.
getSize(); ++i) {
396 if (nPoints <=0) nPoints = 40;
398 double xmin = myparam->getMin();
double xmax = myparam->getMax();
399 double ymin = myparamY->getMin();
double ymax = myparamY->getMax();
404 if (!useMinuit || plotHist) {
410 int nBins =
int( std::sqrt(
double(nPoints)) + 0.5 );
420 const int nLevels = 51;
421 double contLevels[nLevels];
422 contLevels[0] = 0.01;
424 for (
int k = 1; k < nLevels; ++k) {
425 contLevels[k] = k*maxVal/
double(nLevels-1);
437 const int nLevels = 8;
438 double contLevels[nLevels];
440 double confLevels[nLevels] = { 0.1,0.3,0.5,0.683,0.95,0.9973,0.9999366575,0.9999994267};
441 for (
int k = 0; k < nLevels; ++k) {
451 if (tmpOpt.
Length() < 3) opt +=
"cont3";
453 if (plotHist) opt +=
TString(
" same");
462 h->SetContour(1,&cont_level);
467 h->Draw(
"CONT LIST");
484 double lm =
gPad->GetLeftMargin();
485 double rm =
gPad->GetRightMargin();
486 double tm =
gPad->GetTopMargin();
492 TPad *null=
new TPad(
"null",
"null",0,0,1,1);
493 null->SetFillStyle(0);
494 null->SetFrameFillStyle(0);
497 null->Range(
x1-(
x2-
x1)*(lm/(1-rm-lm)),
498 y1-(
y2-
y1)*(bm/(1-tm-lm)),
499 x2+(
x2-
x1)*(rm/(1-rm-lm)),
500 y2+(
y2-
y1)*(tm/(1-tm-lm)));
507 int ncontours = contours->
GetSize();
508 for (
int icont = 0; icont < ncontours; ++icont) {
510 if (contourList && contourList->
GetSize() > 0) {
511 for(
auto *
gr : static_range_cast<TGraph*>(*contourList)) {
526 ccoutE(InputArguments) <<
"LikelihoodIntervalPlot::Draw(" <<
GetName()
527 <<
") ERROR: no contours found in ListOfSpecial" << std::endl;
541 if (
int(ncp) < nPoints) {
542 std::cout <<
"Warning - Less points calculated in contours np = " << ncp <<
" / " << nPoints << std::endl;
549 if (!opt.
Contains(
"same") && !plotHist) {
557 hist2D->
Draw(
"AXIS");
580 double x0 = bestFitParams->
getRealValue(myparam->GetName());
581 double y0 = bestFitParams->
getRealValue(myparamY->GetName());
589 delete bestFitParams;
597 if (newProfile != oldProfile)
delete newProfile;
Option_t Option_t TPoint TPoint const char x2
Option_t Option_t TPoint TPoint const char x1
Option_t Option_t TPoint TPoint const char y2
Option_t Option_t TPoint TPoint const char y1
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
RooFit::OwningPtr< RooArgSet > getVariables(bool stripDisconnected=true) const
Return RooArgSet with all variables (tree leaf nodes of expresssion tree)
double getRealValue(const char *name, double defVal=0.0, bool verbose=false) const
Get value of a RooAbsReal stored in set with given name.
virtual bool remove(const RooAbsArg &var, bool silent=false, bool matchByNameOnly=false)
Remove the specified argument from our list.
bool contains(const RooAbsArg &var) const
Check if collection contains an argument with the same name as var.
Int_t getSize() const
Return the number of elements in the collection.
const char * GetName() const override
Returns name of object.
virtual bool add(const RooAbsArg &var, bool silent=false)
Add the specified argument to list.
void assign(const RooAbsCollection &other) const
Sets the value, cache and constant attribute of any argument in our set that also appears in the othe...
RooAbsArg * find(const char *name) const
Find object with given name in list.
virtual Int_t getBins(const char *name=nullptr) const
Get number of bins of currently defined range.
virtual double getMax(const char *name=nullptr) const
Get maximum of currently defined range.
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 getMin(const char *name=nullptr) const
Get minimum of currently defined range.
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
double getVal(const RooArgSet *normalisationSet=nullptr) const
Evaluate object.
virtual RooAbsReal * createProfile(const RooArgSet ¶msOfInterest)
Create a RooProfileLL object that eliminates all nuisance parameters in the present function.
TH1 * fillHistogram(TH1 *hist, const RooArgList &plotVars, double scaleFactor=1, const RooArgSet *projectedVars=nullptr, bool scaling=true, const RooArgSet *condObs=nullptr, bool setError=true) const
Fill the ROOT histogram 'hist' with values sampled from this function at the bin centers.
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...
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.
RooArgList is a container object that can hold multiple RooAbsArg objects.
RooArgSet is a container object that can hold multiple RooAbsArg objects.
TObject * clone(const char *newname) const override
RooCmdArg is a named container for two doubles, two integers two object points and three string point...
A RooPlot is a 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'.
void addObject(TObject *obj, Option_t *drawOptions="", bool invisible=false)
Add a generic object to this plot.
virtual void SetMinimum(double minimum=-1111)
Set minimum value of Y axis.
virtual void SetMaximum(double maximum=-1111)
Set maximum value of Y axis.
void Draw(Option_t *options=nullptr) override
Draw this plot and all of the elements it contains.
Class RooProfileLL implements the profile likelihood estimator for a given likelihood and set of para...
RooRealVar represents a variable that can be changed from the outside.
void setVal(double value) override
Set value of variable to 'value'.
void setBins(Int_t nBins, const char *name=nullptr)
Create a uniform binning under name 'name' for this variable.
This class provides simple and straightforward utilities to plot a LikelihoodInterval object.
TObject * fPlotObject
plotted object
Color_t fColor
color for the contour (for 2D) or function (in 1D)
void SetPlotParameters(const RooArgSet *params)
Int_t fNPoints
number of points used to scan the PL
Style_t fFillStyle
fill style for contours
void Draw(const Option_t *options=nullptr) override
draw the likelihood interval or contour for the 1D case a RooPlot is drawn by default of the profiled...
LikelihoodIntervalPlot()
LikelihoodIntervalPlot default constructor with default parameters.
double fPrecision
RooCurve precision.
double fMaximum
function maximum
LikelihoodInterval * fInterval
void SetLikelihoodInterval(LikelihoodInterval *theInterval)
Color_t fLineColor
line color for the interval (1D) or for other contours (2D)
~LikelihoodIntervalPlot() override
Destructor of SamplingDistribution.
LikelihoodInterval is a concrete implementation of the RooStats::ConfInterval interface.
double ConfidenceLevel() const override
return confidence level
double UpperLimit(const RooRealVar ¶m)
return the upper bound of the interval on a given parameter
Int_t GetContourPoints(const RooRealVar ¶mX, const RooRealVar ¶mY, double *x, double *y, Int_t npoints=30)
return the 2D-contour points for the given subset of parameters by default make the contour using 30 ...
RooArgSet * GetParameters() const override
return a cloned list of parameters of interest. User manages the return object
double LowerLimit(const RooRealVar ¶m)
return the lower bound of the interval on a given parameter
RooAbsReal * GetLikelihoodRatio()
return the profile log-likelihood ratio function
const RooArgSet * GetBestFitParameters() const
return a pointer to a snapshot with best fit parameter of interest
virtual void SetFillColor(Color_t fcolor)
Set the fill area color.
virtual void SetFillStyle(Style_t fstyle)
Set the fill area style.
virtual void SetLineStyle(Style_t lstyle)
Set the line style.
virtual void SetLineWidth(Width_t lwidth)
Set the line width.
virtual void SetLineColor(Color_t lcolor)
Set the line color.
virtual void SetMarkerColor(Color_t mcolor=1)
Set the marker color.
virtual void SetMarkerStyle(Style_t mstyle=1)
Set the marker style.
Float_t GetBottomMargin() const
TObject * Clone(const char *newname="") const override
Make a clone of an collection using the Streamer facility.
virtual Int_t GetSize() const
Return the capacity of the collection, i.e.
virtual TH1 * GetHistogram() const
Return a pointer to the histogram used to visualise the function Note that this histogram is managed ...
TAxis * GetYaxis() const
Get y axis of the function.
virtual void SetMaximum(Double_t maximum=-1111)
Set the maximum value along Y for this function In case the function is already drawn,...
virtual void SetRange(Double_t xmin, Double_t xmax)
Initialize the upper and lower bounds to draw the function.
void SetTitle(const char *title="") override
Set function title if title has the form "fffffff;xxxx;yyyy", it is assumed that the function title i...
virtual void SetNpx(Int_t npx=100)
Set the number of points used to draw the function.
void Draw(Option_t *option="") override
Draw this function with its current attributes.
virtual Double_t GetX(Double_t y, Double_t xmin=0, Double_t xmax=0, Double_t epsilon=1.E-10, Int_t maxiter=100, Bool_t logx=false) const
Returns the X value corresponding to the function value fy for (xmin<x<xmax).
TObject * Clone(const char *newname=nullptr) const override
Make a complete copy of the underlying object.
TAxis * GetXaxis() const
Get x axis of the function.
A TGraph is an object made of two arrays X and Y with npoints each.
virtual void SetPoint(Int_t i, Double_t x, Double_t y)
Set x and y values for point number i.
virtual Int_t RemovePoint()
Delete point close to the mouse position Returns index of removed point (or -1 if nothing was changed...
void SetName(const char *name="") override
Set graph name.
void Draw(Option_t *chopt="") override
Draw this graph with its current attributes.
void SetTitle(const char *title) override
Change (i.e.
@ kNoStats
Don't draw stats box.
virtual Double_t GetMaximum(Double_t maxval=FLT_MAX) const
Return maximum value smaller than maxval of bins in the range, unless the value has been overridden b...
virtual void SetMaximum(Double_t maximum=-1111)
void Draw(Option_t *option="") override
Draw this histogram with options.
virtual void SetContour(Int_t nlevels, const Double_t *levels=nullptr)
Set the number and values of contour levels.
TObject * Clone(const char *newname="") const override
Make a complete copy of the underlying object.
virtual void SetStats(Bool_t stats=kTRUE)
Set statistics option on/off.
2-D histogram with a double per channel (see TH1 documentation)}
2-D histogram with a float per channel (see TH1 documentation)}
Service class for 2-D histogram classes.
Use the TLine constructor to create a simple line.
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.
virtual void SetName(const char *name)
Set the name of the TNamed.
TObject * At(Int_t idx) const override
TObject * FindObject(const char *name) const override
Find an object in this collection using its name.
virtual TObject * DrawClone(Option_t *option="") const
Draw a clone of this object in the current selected pad with: gROOT->SetSelectedPad(c1).
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
virtual TClass * IsA() const
virtual void Draw(Option_t *option="")
Default Draw method for all objects.
The most important graphics class in the ROOT system.
void ToLower()
Change string to lower-case.
const char * Data() const
TString & ReplaceAll(const TString &s1, const TString &s2)
TString & Append(const char *cs)
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
TVirtualPad is an abstract base class for the Pad and Canvas classes.
RooCmdArg Precision(double prec)
RooCmdArg LineColor(Color_t color)
double chisquared_quantile(double z, double r)
Inverse ( ) of the cumulative distribution function of the lower tail of the distribution with degr...
Namespace for the RooStats classes.