131 if (!intervalParams->
contains(*arg) ) {
132 ccoutE(InputArguments) <<
"Parameter " << arg->GetName() <<
"is not in the list of LikelihoodInterval parameters "
133 <<
" - do not use for plotting " << std::endl;
135 extraParams.
add(*arg);
138 if (!extraParams.
empty())
142 ccoutE(InputArguments) <<
"LikelihoodIntervalPlot::Draw(" <<
GetName()
143 <<
") ERROR: contours for more than 2 dimensions not implemented!" << std::endl;
151 std::unique_ptr<RooAbsReal> newProfileOwner;
155 if (!profilell)
return;
157 newProfileOwner = std::unique_ptr<RooAbsReal>{nll.createProfile(*
fParamsPlot)};
158 newProfile = newProfileOwner.get();
161 newProfile = oldProfile;
164 auto *myparam =
static_cast<RooRealVar*
>((*fParamsPlot)[0]);
167 if (
fInterval->GetBestFitParameters() ) {
192 if (nPoints <=0) nPoints = 100;
194 const double xcont_min =
fInterval->LowerLimit(*myparam);
195 const double xcont_max =
fInterval->UpperLimit(*myparam);
198 double x1 = myarg->
getMin();
199 double x2 = myarg->
getMax();
211 double xmin = std::max( x1, 2*xcont_min - xcont_max);
212 double xmax = std::min( x2, 2*xcont_max - xcont_min);
215 TF1 * tmp = newProfile->
asTF(*myarg);
216 assert(tmp !=
nullptr);
235 if ( x0 > x1 && x0 < x2) {
247 f1->GetXaxis()->SetTitle(myarg->
GetName());
248 f1->GetYaxis()->SetTitle(
Form(
"- log #lambda(%s)",myparam->GetName()));
255 double xmin = myparam->getMin();
double xmax = myparam->getMax();
260 int prevBins = myarg->
getBins();
290 TLine *Yline_cutoff =
new TLine(x1,Yat_Xmax,x2,Yat_Xmax);
291 TLine *Yline_min =
new TLine(xcont_min,0.,xcont_min,Yat_Xmax);
292 TLine *Yline_max =
new TLine(xcont_max,0.,xcont_max,Yat_Xmax);
300 Yline_cutoff->
Draw();
323 bool useMinuit = !opt.
Contains(
"nominuit");
325 bool plotHist = !opt.
Contains(
"nohist");
328 if (opt.
Contains(
"minuit") ) useMinuit=
true;
329 if (useMinuit) plotHist =
false;
330 if (opt.
Contains(
"hist") ) plotHist=
true;
334 auto *myparamY =
static_cast<RooRealVar*
>((*fParamsPlot)[1]);
337 cont_level = cont_level/2;
341 for (std::size_t i = 0; i < params.
size(); ++i) {
351 if (title.Length() == 0)
354 title =
TString::Format(
"%s;%s;%s",title.Data(),myparam->GetName(),myparamY->GetName());
356 if (nPoints <=0) nPoints = 40;
358 double xmin = myparam->getMin();
double xmax = myparam->getMax();
359 double ymin = myparamY->getMin();
double ymax = myparamY->getMax();
364 if (!useMinuit || plotHist) {
370 int nBins =
int( std::sqrt(
double(nPoints)) + 0.5 );
380 const int nLevels = 51;
381 double contLevels[nLevels];
382 contLevels[0] = 0.01;
384 for (
int k = 1; k < nLevels; ++k) {
385 contLevels[k] = k*maxVal/
double(nLevels-1);
397 const int nLevels = 8;
398 double contLevels[nLevels];
400 double confLevels[nLevels] = { 0.1,0.3,0.5,0.683,0.95,0.9973,0.9999366575,0.9999994267};
401 for (
int k = 0; k < nLevels; ++k) {
411 if (tmpOpt.
Length() < 3) opt +=
"cont3";
413 if (plotHist) opt +=
TString(
" same");
422 h->SetContour(1,&cont_level);
427 h->Draw(
"CONT LIST");
434 if (contoursOrig) contours =
static_cast<TObjArray*
>(contoursOrig->
Clone());
443 double bm =
gPad->GetBottomMargin();
444 double lm =
gPad->GetLeftMargin();
445 double rm =
gPad->GetRightMargin();
446 double tm =
gPad->GetTopMargin();
452 TPad *null=
new TPad(
"null",
"null",0,0,1,1);
453 null->SetFillStyle(0);
454 null->SetFrameFillStyle(0);
457 null->Range(x1-(x2-x1)*(lm/(1-rm-lm)),
458 y1-(y2-y1)*(bm/(1-tm-lm)),
459 x2+(x2-x1)*(rm/(1-rm-lm)),
460 y2+(y2-y1)*(tm/(1-tm-lm)));
467 int ncontours = contours->
GetSize();
468 for (
int icont = 0; icont < ncontours; ++icont) {
469 TList * contourList =
static_cast<TList*
>(contours->
At(icont));
470 if (contourList && contourList->
GetSize() > 0) {
486 ccoutE(InputArguments) <<
"LikelihoodIntervalPlot::Draw(" <<
GetName()
487 <<
") ERROR: no contours found in ListOfSpecial" << std::endl;
499 int ncp =
fInterval->GetContourPoints(*myparam, *myparamY,
gr->GetX(),
gr->GetY(),nPoints);
501 if (
int(ncp) < nPoints) {
502 coutW(Eval) <<
"Warning - Less points calculated in contours np = " << ncp <<
" / " << nPoints << std::endl;
503 for (
int i = ncp; i < nPoints; ++i)
gr->RemovePoint(i);
506 gr->SetPoint(ncp,
gr->GetX()[0],
gr->GetY()[0] );
509 if (!opt.
Contains(
"same") && !plotHist) {
517 hist2D->
Draw(
"AXIS");
540 double x0 = bestFitParams->
getRealValue(myparam->GetName());
541 double y0 = bestFitParams->
getRealValue(myparamY->GetName());
549 delete bestFitParams;
ROOT::RRangeCast< T, false, Range_t > static_range_cast(Range_t &&coll)
const char Option_t
Option string (const char).
void GetParameters(TFitEditor::FuncParams_t &pars, TF1 *func)
Stores the parameters of the given function into pars.
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 expression tree).
bool contains(const char *name) const
Check if collection contains an argument with a specific name.
double getRealValue(const char *name, double defVal=0.0, bool verbose=false) const
Get value of a RooAbsReal stored in set with given name.
const char * GetName() const override
Returns name of object.
virtual bool add(const RooAbsArg &var, bool silent=false)
Add the specified argument to list.
Storage_t::size_type size() const
virtual Int_t getBins(const char *name=nullptr) const
Get number of bins of currently defined range.
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.
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={}, 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.
TObject * clone(const char *newname=nullptr) const override
Named container for two doubles, two integers two object points and three string pointers that can be...
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.
Implements the profile likelihood estimator for a given likelihood and set of parameters of interest.
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, bool shared=true)
Create a uniform binning under name 'name' for this variable.
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, default depends if 1D or 2D
Style_t fFillStyle
fill style for contours, half transparent by default
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, use default in case of -1.
double fMaximum
function maximum
LikelihoodInterval * fInterval
void SetLikelihoodInterval(LikelihoodInterval *theInterval)
Color_t fLineColor
line color for the interval (1D) or for other contours (2D)
LikelihoodInterval is a concrete implementation of the RooStats::ConfInterval interface.
virtual void SetFillStyle(Style_t fstyle)
Set the fill area style.
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.
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 void SetNpx(Int_t npx=100)
virtual void SetRange(Double_t xmin, Double_t xmax)
TObject * Clone(const char *newname=nullptr) const override
Make a clone of an object using the Streamer facility.
virtual void SetPoint(Int_t i, Double_t x, Double_t y)
void Draw(Option_t *chopt="") override
Default Draw method for all objects.
void SetTitle(const char *title) override
Change/set the title.
@ 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.
TObject * At(Int_t idx) const override
virtual TObject * DrawClone(Option_t *option="") const
Draw a clone of this object in the current selected pad with: gROOT->SetSelectedPad(c1).
virtual TObject * FindObject(const char *name) const
Must be redefined in derived classes.
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
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(TColorNumber 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.