Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
LikelihoodIntervalPlot.cxx
Go to the documentation of this file.
1// @(#)root/roostats:$Id$
2
3/*************************************************************************
4 * Project: RooStats *
5 * Package: RooFit/RooStats *
6 * Authors: *
7 * Kyle Cranmer, Lorenzo Moneta, Gregory Schott, Wouter Verkerke *
8 *************************************************************************
9 * Copyright (C) 1995-2008, Rene Brun and Fons Rademakers. *
10 * All rights reserved. *
11 * *
12 * For the licensing terms see $ROOTSYS/LICENSE. *
13 * For the list of contributors see $ROOTSYS/README/CREDITS. *
14 *************************************************************************/
15
16
17/** \class RooStats::LikelihoodIntervalPlot
18 \ingroup Roostats
19
20 This class provides simple and straightforward utilities to plot a LikelihoodInterval
21 object.
22
23*/
24
26
27#include <algorithm>
28#include <iostream>
29#include <cmath>
30
31#include "TROOT.h"
32#include "TLine.h"
33#include "TObjArray.h"
34#include "TList.h"
35#include "TGraph.h"
36#include "TPad.h"
37#include "TCanvas.h"
38// need chisquare_quantile function - can use mathcore implementation
39// for plotting not crucial that is less precise
41
42
43#include "RooRealVar.h"
44#include "RooPlot.h"
45#include "RooMsgService.h"
46#include "RooProfileLL.h"
47#include "TF1.h"
48
49/// ClassImp for building the THtml documentation of the class
50using namespace std;
51
53
54using namespace RooStats;
55
56////////////////////////////////////////////////////////////////////////////////
57/// LikelihoodIntervalPlot default constructor
58/// with default parameters
59
61
62////////////////////////////////////////////////////////////////////////////////
63/// LikelihoodIntervalPlot copy constructor
64
66 : fInterval(theInterval), fParamsPlot(fInterval->GetParameters())
67{
69}
70
71////////////////////////////////////////////////////////////////////////////////
72
74{
75 fInterval = theInterval;
78
79 return;
80}
81
82////////////////////////////////////////////////////////////////////////////////
83
85{
86 fNdimPlot = params->size();
87 fParamsPlot = static_cast<RooArgSet*>(params->clone((std::string(params->GetName())+"_clone").c_str()));
88
89 return;
90}
91
92
93////////////////////////////////////////////////////////////////////////////////
94/// draw the log of the profiled likelihood function in 1D with the interval or
95/// as a 2D plot with the contours.
96/// Higher dimensional intervals cannot be drawn. One needs to call
97/// SetPlotParameters to project interval in 1 or 2dim
98///
99/// ### Options for drawing 1D intervals
100///
101/// For 1D problem the log of the profiled likelihood function is drawn by default in a RooPlot as a
102/// RooCurve
103/// The plotting range (default is the full parameter range) and the precision of the RooCurve
104/// can be specified by using SetRange(x1,x2) and SetPrecision(eps).
105/// SetNPoints(npoints) can also be used (default is npoints=100)
106/// Optionally the function can be drawn as a TF1 (option="tf1") obtained by sampling the given npoints
107/// in the given range
108///
109/// ### Options for drawing 2D intervals
110///
111/// For 2D case, a contour and optionally the profiled likelihood function is drawn by sampling npoints in
112/// the given range. A 2d histogram of nbinsX=nbinsY = sqrt(npoints) is used for sampling the profiled likelihood.
113/// The contour can be obtained by using Minuit or by the sampled histogram,
114/// If using Minuit, the number of points specifies the number of contour points. If using an histogram the number of
115/// points is approximately the total number of bins of the histogram.
116/// Possible options:
117/// - minuit/nominuit: use minuit for computing the contour
118/// - hist/nohist : sample in an histogram the profiled likelihood
119///
120/// Note that one can have both a drawing of the sampled likelihood and of the contour using minuit.
121/// The default options is "minuit nohist"
122/// The sampled histogram is drawn first by default using the option "colz" and then 8 probability contours at
123/// these CL are drawn: { 0.1,0.3,0.5,0.683,0.95,0.9973,0.9999366575,0.9999994267} re-drawing the histogram with the
124/// option "cont3"
125///
126/// The drawn object (RooPlot or sampled histogram) is saved in the class and can be retrieved using GetPlottedObject()
127/// In this way the user can eventually customize further the plot.
128/// Note that the class does not delete the plotted object. It needs, if needed, to be deleted by the user
129
131{
132 // we need to check if parameters to plot is different than parameters of interval
133 RooArgSet* intervalParams = fInterval->GetParameters();
134 RooArgSet extraParams;
135 for (auto const *arg : *fParamsPlot) {
136 if (!intervalParams->contains(*arg) ) {
137 ccoutE(InputArguments) << "Parameter " << arg->GetName() << "is not in the list of LikelihoodInterval parameters "
138 << " - do not use for plotting " << std::endl;
139 fNdimPlot--;
140 extraParams.add(*arg);
141 }
142 }
143 if (!extraParams.empty())
144 fParamsPlot->remove(extraParams,true,true);
145
146 if(fNdimPlot > 2){
147 ccoutE(InputArguments) << "LikelihoodIntervalPlot::Draw(" << GetName()
148 << ") ERROR: contours for more than 2 dimensions not implemented!" << std::endl;
149 return;
150 }
151
152 // if the number of parameters to plot is less to the number of parameters of the LikelihoodInterval
153 // we need to re-do the profile likelihood function, otherwise those parameters will not be profiled
154 // when plotting
155 RooAbsReal* newProfile = nullptr;
156 std::unique_ptr<RooAbsReal> newProfileOwner;
157 RooAbsReal* oldProfile = fInterval->GetLikelihoodRatio();
158 if (fNdimPlot != int(intervalParams->size()) ) {
159 RooProfileLL * profilell = dynamic_cast<RooProfileLL*>(oldProfile);
160 if (!profilell) return;
161 RooAbsReal & nll = profilell->nll();
162 newProfileOwner = std::unique_ptr<RooAbsReal>{nll.createProfile(*fParamsPlot)};
163 newProfile = newProfileOwner.get();
164 }
165 else {
166 newProfile = oldProfile;
167 }
168
169 auto *myparam = static_cast<RooRealVar*>((*fParamsPlot)[0]);
170
171 // do a dummy evaluation around minimum to be sure profile has right minimum
174 newProfile->getVal();
175 }
176
177 // analyze options
178 TString opt = options;
179 opt.ToLower();
180
181 TString title = GetTitle();
182 int nPoints = fNPoints;
183
184 if(fNdimPlot == 1) {
185
186 // 1D drawing options
187 // use RooPLot for drawing the 1D PL
188 // if option is TF1 use TF1 for drawing
189 bool useRooPlot = opt.Contains("rooplot") || ! (opt.Contains("tf1"));
190 opt.ReplaceAll("rooplot","");
191 opt.ReplaceAll("tf1","");
192
193
194 // if (title.Length() == 0)
195 // title = "- log profile likelihood ratio";
196
197 if (nPoints <=0) nPoints = 100; // default in 1D
198
199 const double xcont_min = fInterval->LowerLimit(*myparam);
200 const double xcont_max = fInterval->UpperLimit(*myparam);
201
202 RooRealVar* myarg = static_cast<RooRealVar *>(newProfile->getVariables()->find(myparam->GetName()));
203 double x1 = myarg->getMin();
204 double x2 = myarg->getMax();
205
206 // default color values
207 if (fColor == 0) fColor = kBlue;
208 if (fLineColor == 0) fLineColor = kGreen;
209
210 RooPlot * frame = nullptr;
211
212 // use TF1 for drawing the function
213 if (!useRooPlot) {
214
215 // set a first estimate of range including 2 times upper and lower limit
216 double xmin = std::max( x1, 2*xcont_min - xcont_max);
217 double xmax = std::min( x2, 2*xcont_max - xcont_min);
218 if (fXmin < fXmax) { xmin = fXmin; xmax = fXmax; }
219
220 TF1 * tmp = newProfile->asTF(*myarg);
221 assert(tmp != nullptr);
222 tmp->SetRange(xmin, xmax);
223 tmp->SetNpx(nPoints);
224
225 // clone the function to avoid later to sample it
226 TF1 * f1 = static_cast<TF1*>(tmp->Clone());
227 delete tmp;
228
229 f1->SetTitle(title);
230 TString name = TString(GetName()) + TString("_PLL_") + TString(myarg->GetName());
231 f1->SetName(name);
232
233 // set range for displaying x values where function <= fMaximum
234 // if no range is set amd
235 // if no reasonable value found maintain first estimate
236 x1 = xmin; x2 = xmax;
237 if (fMaximum > 0 && fXmin >= fXmax ) {
238 double x0 = f1->GetX(0, xmin, xmax);
239 // check that minimum is between xmin and xmax
240 if ( x0 > x1 && x0 < x2) {
241 x1 = f1->GetX(fMaximum, xmin, x0);
242 x2 = f1->GetX(fMaximum, x0, xmax);
244 //std::cout << "setting range to " << x1 << " , " << x2 << " x0 = " << x0 << std::endl;
245 }
246 }
247
248 f1->SetRange(x1,x2);
249
250
252 f1->GetXaxis()->SetTitle(myarg->GetName());
253 f1->GetYaxis()->SetTitle(Form("- log #lambda(%s)",myparam->GetName()));
254 f1->Draw(opt);
256
257 }
258 else {
259 // use a RooPlot for drawing the PL function
260 double xmin = myparam->getMin(); double xmax = myparam->getMax();
261 if (fXmin < fXmax) { xmin = fXmin; xmax = fXmax; }
262
263 // set nbins (must be used in combination with precision )
264 // the curve will evaluate 2 * nbins if precision is > 1
265 int prevBins = myarg->getBins();
266 myarg->setBins(fNPoints);
267
268 // want to set range on frame not function
269 frame = myarg->frame(xmin,xmax,nPoints);
270 // for ycutoff line
271 x1= xmin;
272 x2=xmax;
273 frame->SetTitle(title);
274 frame->GetYaxis()->SetTitle(Form("- log #lambda(%s)",myparam->GetName()));
275 // frame->GetYaxis()->SetTitle("- log profile likelihood ratio");
276
277
278 // plot
279 RooCmdArg cmd;
281 newProfile->plotOn(frame,cmd,RooFit::LineColor(fColor));
282
283 frame->SetMaximum(fMaximum);
284 frame->SetMinimum(0.);
285
286 myarg->setBins(prevBins);
287 fPlotObject = frame;
288 }
289
290
291 //myarg->setVal(xcont_max);
292 //const double Yat_Xmax = newProfile->getVal();
294
295 TLine *Yline_cutoff = new TLine(x1,Yat_Xmax,x2,Yat_Xmax);
296 TLine *Yline_min = new TLine(xcont_min,0.,xcont_min,Yat_Xmax);
297 TLine *Yline_max = new TLine(xcont_max,0.,xcont_max,Yat_Xmax);
298
299 Yline_cutoff->SetLineColor(fLineColor);
300 Yline_min->SetLineColor(fLineColor);
301 Yline_max->SetLineColor(fLineColor);
302
303 if (!useRooPlot) {
304 // need to draw the line
305 Yline_cutoff->Draw();
306 Yline_min->Draw();
307 Yline_max->Draw();
308 }
309 else {
310 // add line in the RooPlot
311 frame->addObject(Yline_min);
312 frame->addObject(Yline_max);
313 frame->addObject(Yline_cutoff);
314 frame->Draw(opt);
315 }
316
317
318 return;
319 }
320
321 // case of 2 dimensions
322
323 else if(fNdimPlot == 2){
324
325 //2D drawing options
326
327 // use Minuit for drawing the contours of the PL (default case)
328 bool useMinuit = !opt.Contains("nominuit");
329 // plot histogram in 2D
330 bool plotHist = !opt.Contains("nohist");
331 opt.ReplaceAll("nominuit","");
332 opt.ReplaceAll("nohist","");
333 if (opt.Contains("minuit") ) useMinuit= true;
334 if (useMinuit) plotHist = false; // switch off hist by default in case of Minuit
335 if (opt.Contains("hist") ) plotHist= true;
336 opt.ReplaceAll("minuit","");
337 opt.ReplaceAll("hist","");
338
339 auto *myparamY = static_cast<RooRealVar*>((*fParamsPlot)[1]);
340
341 double cont_level = ROOT::Math::chisquared_quantile(fInterval->ConfidenceLevel(),fNdimPlot); // level for -2log LR
342 cont_level = cont_level/2; // since we are plotting -log LR
343
344 RooArgList params(*newProfile->getVariables());
345 // set values and error for the POI to the best fit values
346 for (std::size_t i = 0; i < params.size(); ++i) {
347 RooRealVar & par = static_cast<RooRealVar &>( params[i]);
348 RooRealVar * fitPar = static_cast<RooRealVar *> (fInterval->GetBestFitParameters()->find(par.GetName() ) );
349 if (fitPar) {
350 par.setVal( fitPar->getVal() );
351 }
352 }
353 // do a profile evaluation to start from the best fit values of parameters
354 newProfile->getVal();
355
356 if (title.Length() == 0)
357 title = TString("Contour of ") + TString(myparamY->GetName() ) + TString(" vs ") + TString(myparam->GetName() );
358 // add also labels
359 title = TString::Format("%s;%s;%s",title.Data(),myparam->GetName(),myparamY->GetName());
360
361 if (nPoints <=0) nPoints = 40; // default in 2D
362
363 double xmin = myparam->getMin(); double xmax = myparam->getMax();
364 double ymin = myparamY->getMin(); double ymax = myparamY->getMax();
365 if (fXmin < fXmax) { xmin = fXmin; xmax = fXmax; }
366 if (fYmin < fYmax) { ymin = fYmin; ymax = fYmax; }
367
368
369 if (!useMinuit || plotHist) {
370
371 // find contour from a scanned histogram of points
372
373 // draw directly the TH2 from the profile LL
374 TString histName = TString::Format("_hist2D__%s_%s",myparam->GetName(),myparamY->GetName() );
375 int nBins = int( std::sqrt(double(nPoints)) + 0.5 );
376 TH2* hist2D = new TH2D(histName, title, nBins, xmin, xmax, nBins, ymin, ymax );
377 newProfile->fillHistogram(hist2D, RooArgList(*myparam,*myparamY), 1, nullptr, false, nullptr, false);
378
379 hist2D->SetTitle(title);
380 hist2D->SetStats(false);
381
382 //need many color levels for drawing with option colz
383 if (plotHist) {
384
385 const int nLevels = 51;
386 double contLevels[nLevels];
387 contLevels[0] = 0.01;
388 double maxVal = (fMaximum > 0) ? fMaximum : hist2D->GetMaximum();
389 for (int k = 1; k < nLevels; ++k) {
390 contLevels[k] = k*maxVal/double(nLevels-1);
391 }
392 hist2D->SetContour(nLevels,contLevels);
393
394 if (fMaximum>0) hist2D->SetMaximum(fMaximum);
395
396 hist2D->DrawClone("COLZ");
397 }
398
399
400 //need now less contours for drawing with option cont
401
402 const int nLevels = 8;
403 double contLevels[nLevels];
404 // last 3 are the 3,4,5 sigma levels
405 double confLevels[nLevels] = { 0.1,0.3,0.5,0.683,0.95,0.9973,0.9999366575,0.9999994267};
406 for (int k = 0; k < nLevels; ++k) {
407 //contLevels[k] = 0.5*ROOT::Math::chisquared_quantile(1.-2.*ROOT::Math::normal_cdf_c(nSigmaLevels[k],1),2);
408 contLevels[k] = 0.5*ROOT::Math::chisquared_quantile(confLevels[k],2);
409 }
410 hist2D->SetContour(nLevels,contLevels);
411 if (fLineColor) hist2D->SetLineColor(fLineColor);
412
413 // default options for drawing a second histogram
414 TString tmpOpt = opt;
415 tmpOpt.ReplaceAll("same","");
416 if (tmpOpt.Length() < 3) opt += "cont3";
417 // if histo is plotted draw on top
418 if (plotHist) opt += TString(" same");
419 hist2D->Draw(opt.Data());
420 gPad->Update();
421
422 // case of plotting contours without minuit
423 if (!useMinuit) {
424
425 // set levels of contours if make contours without minuit
426 TH2 * h = static_cast<TH2*>(hist2D->Clone());
427 h->SetContour(1,&cont_level);
428
429 TVirtualPad * currentPad = gPad;
430 // o a temporary draw to get the contour graph
431 TCanvas * tmpCanvas = new TCanvas("tmpCanvas","tmpCanvas");
432 h->Draw("CONT LIST");
433 gPad->Update();
434
435 // get graphs from the contours
436 TObjArray *contoursOrig = static_cast<TObjArray*>(gROOT->GetListOfSpecials()->FindObject("contours"));
437 // CLONE THE LIST IN CASE IT GETS DELETED
438 TObjArray *contours = nullptr;
439 if (contoursOrig) contours = static_cast<TObjArray*>(contoursOrig->Clone());
440
441 delete tmpCanvas;
442 delete h;
443 gPad = currentPad;
444
445
446 // in case of option CONT4 I need to re-make the Pad
447 if (tmpOpt.Contains("cont4")) {
448 double bm = gPad->GetBottomMargin();
449 double lm = gPad->GetLeftMargin();
450 double rm = gPad->GetRightMargin();
451 double tm = gPad->GetTopMargin();
452 double x1 = hist2D->GetXaxis()->GetXmin();
453 double y1 = hist2D->GetYaxis()->GetXmin();
454 double x2 = hist2D->GetXaxis()->GetXmax();
455 double y2 = hist2D->GetYaxis()->GetXmax();
456
457 TPad *null=new TPad("null","null",0,0,1,1);
458 null->SetFillStyle(0);
459 null->SetFrameFillStyle(0);
460 null->Draw();
461 null->cd();
462 null->Range(x1-(x2-x1)*(lm/(1-rm-lm)),
463 y1-(y2-y1)*(bm/(1-tm-lm)),
464 x2+(x2-x1)*(rm/(1-rm-lm)),
465 y2+(y2-y1)*(tm/(1-tm-lm)));
466
467 gPad->Update();
468 }
469
470
471 if (contours) {
472 int ncontours = contours->GetSize();
473 for (int icont = 0; icont < ncontours; ++icont) {
474 TList * contourList = static_cast<TList*>(contours->At(icont));
475 if (contourList && contourList->GetSize() > 0) {
476 for(auto * gr : static_range_cast<TGraph*>(*contourList)) {
479 gr->SetLineWidth(3);
480 if (fColor) {
482 gr->Draw("FL");
483 }
484 else
485 gr->Draw("L");
486 }
487 }
488 }
489 }
490 else {
491 ccoutE(InputArguments) << "LikelihoodIntervalPlot::Draw(" << GetName()
492 << ") ERROR: no contours found in ListOfSpecial" << std::endl;
493 }
494
495 fPlotObject = hist2D;
496
497 }
498 }
499 if (useMinuit) {
500
501 // find contours using Minuit
502 TGraph * gr = new TGraph(nPoints+1);
503
504 int ncp = fInterval->GetContourPoints(*myparam, *myparamY, gr->GetX(), gr->GetY(),nPoints);
505
506 if (int(ncp) < nPoints) {
507 std::cout << "Warning - Less points calculated in contours np = " << ncp << " / " << nPoints << std::endl;
508 for (int i = ncp; i < nPoints; ++i) gr->RemovePoint(i);
509 }
510 // add last point to same as first one to close the contour
511 gr->SetPoint(ncp, gr->GetX()[0], gr->GetY()[0] );
512 if (!opt.Contains("c")) opt.Append("L"); // use by default option L if C is not specified
513 // draw first a dummy 2d histogram gfor the axis
514 if (!opt.Contains("same") && !plotHist) {
515
516 TH2F* hist2D = new TH2F("_hist2D",title, nPoints, xmin, xmax, nPoints, ymin, ymax );
517 hist2D->GetXaxis()->SetTitle(myparam->GetName());
518 hist2D->GetYaxis()->SetTitle(myparamY->GetName());
519 hist2D->SetBit(TH1::kNoStats); // do not draw statistics
520 hist2D->SetFillStyle(fFillStyle);
521 hist2D->SetMaximum(1); // to avoid problem with subsequents draws
522 hist2D->Draw("AXIS");
523 }
525 if (fColor) {
526 // draw contour as filled area (add option "F")
528 opt.Append("F");
529 }
530 gr->SetLineWidth(3);
531 if (opt.Contains("same")) gr->SetFillStyle(fFillStyle); // put transparent
532 gr->Draw(opt);
533 TString name = TString("Graph_of_") + TString(fInterval->GetName());
534 gr->SetName(name);
535
536 if (!fPlotObject) fPlotObject = gr;
537 else if (fPlotObject->IsA() != TH2D::Class() ) fPlotObject = gr;
538
539 }
540
541 // draw also the minimum
542 const RooArgSet * bestFitParams = fInterval->GetBestFitParameters();
543 if (bestFitParams) {
544 TGraph * gr0 = new TGraph(1);
545 double x0 = bestFitParams->getRealValue(myparam->GetName());
546 double y0 = bestFitParams->getRealValue(myparamY->GetName());
547 gr0->SetPoint(0,x0,y0);
548 gr0->SetMarkerStyle(33);
549 if (fColor) {
550 if (fColor != kBlack) gr0->SetMarkerColor(fColor+4);
551 else gr0->SetMarkerColor(kGray);
552 }
553 gr0->Draw("P");
554 delete bestFitParams;
555 }
556
557
558
559 }
560
561 return;
562}
#define h(i)
Definition RSha256.hxx:106
#define ccoutE(a)
const char Option_t
Definition RtypesCore.h:66
#define ClassImp(name)
Definition Rtypes.h:377
@ kGray
Definition Rtypes.h:65
@ kBlack
Definition Rtypes.h:65
@ kGreen
Definition Rtypes.h:66
@ kBlue
Definition Rtypes.h:66
@ kDashed
Definition TAttLine.h:48
void GetParameters(TFitEditor::FuncParams_t &pars, TF1 *func)
Stores the parameters of the given function into pars.
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 name[80]
Definition TGX11.cxx:110
float xmin
float ymin
float xmax
float ymax
#define gROOT
Definition TROOT.h:406
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
Definition TString.cxx:2468
#define gPad
RooFit::OwningPtr< RooArgSet > getVariables(bool stripDisconnected=true) const
Return RooArgSet with all variables (tree leaf nodes of expression 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.
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...
Storage_t::size_type size() const
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.
virtual double getMin(const char *name=nullptr) const
Get minimum 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,...
Abstract base class for objects that represent a real value and implements functionality common to al...
Definition RooAbsReal.h:59
double getVal(const RooArgSet *normalisationSet=nullptr) const
Evaluate object.
Definition RooAbsReal.h:103
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 RooFit::OwningPtr< RooAbsReal > createProfile(const RooArgSet &paramsOfInterest)
Create a RooProfileLL object that eliminates all nuisance parameters in the present function.
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.
Definition RooArgList.h:22
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition RooArgSet.h:55
TObject * clone(const char *newname) const override
Definition RooArgSet.h:148
Named container for two doubles, two integers two object points and three string pointers that can be...
Definition RooCmdArg.h:26
Plot frame and a container for graphics objects within that frame.
Definition RooPlot.h:43
void SetTitle(const char *name) override
Set the title of the RooPlot to 'title'.
Definition RooPlot.cxx:1255
void addObject(TObject *obj, Option_t *drawOptions="", bool invisible=false)
Add a generic object to this plot.
Definition RooPlot.cxx:378
virtual void SetMinimum(double minimum=-1111)
Set minimum value of Y axis.
Definition RooPlot.cxx:1059
virtual void SetMaximum(double maximum=-1111)
Set maximum value of Y axis.
Definition RooPlot.cxx:1049
TAxis * GetYaxis() const
Definition RooPlot.cxx:1276
void Draw(Option_t *options=nullptr) override
Draw this plot and all of the elements it contains.
Definition RooPlot.cxx:649
Implements the profile likelihood estimator for a given likelihood and set of parameters of interest.
RooAbsReal & nll()
Variable that can be changed from the outside.
Definition RooRealVar.h:37
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.
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.
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.
double ConfidenceLevel() const override
return confidence level
double UpperLimit(const RooRealVar &param)
return the upper bound of the interval on a given parameter
Int_t GetContourPoints(const RooRealVar &paramX, const RooRealVar &paramY, 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 &param)
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.
Definition TAttFill.h:37
virtual void SetFillStyle(Style_t fstyle)
Set the fill area style.
Definition TAttFill.h:39
virtual void SetLineStyle(Style_t lstyle)
Set the line style.
Definition TAttLine.h:42
virtual void SetLineWidth(Width_t lwidth)
Set the line width.
Definition TAttLine.h:43
virtual void SetLineColor(Color_t lcolor)
Set the line color.
Definition TAttLine.h:40
virtual void SetMarkerColor(Color_t mcolor=1)
Set the marker color.
Definition TAttMarker.h:38
virtual void SetMarkerStyle(Style_t mstyle=1)
Set the marker style.
Definition TAttMarker.h:40
Float_t GetBottomMargin() const
Definition TAttPad.h:43
Double_t GetXmax() const
Definition TAxis.h:140
Double_t GetXmin() const
Definition TAxis.h:139
The Canvas class.
Definition TCanvas.h:23
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.
1-Dim function class
Definition TF1.h:233
virtual TH1 * GetHistogram() const
Return a pointer to the histogram used to visualise the function Note that this histogram is managed ...
Definition TF1.cxx:1586
TAxis * GetYaxis() const
Get y axis of the function.
Definition TF1.cxx:2411
virtual void SetMaximum(Double_t maximum=-1111)
Set the maximum value along Y for this function In case the function is already drawn,...
Definition TF1.cxx:3394
virtual void SetRange(Double_t xmin, Double_t xmax)
Initialize the upper and lower bounds to draw the function.
Definition TF1.cxx:3528
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...
Definition TF1.cxx:3558
virtual void SetNpx(Int_t npx=100)
Set the number of points used to draw the function.
Definition TF1.cxx:3433
void Draw(Option_t *option="") override
Draw this function with its current attributes.
Definition TF1.cxx:1335
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).
Definition TF1.cxx:1865
TObject * Clone(const char *newname=nullptr) const override
Make a complete copy of the underlying object.
Definition TF1.cxx:1066
TAxis * GetXaxis() const
Get x axis of the function.
Definition TF1.cxx:2400
A TGraph is an object made of two arrays X and Y with npoints each.
Definition TGraph.h:41
virtual void SetPoint(Int_t i, Double_t x, Double_t y)
Set x and y values for point number i.
Definition TGraph.cxx:2315
Double_t * GetY() const
Definition TGraph.h:138
Double_t * GetX() const
Definition TGraph.h:137
virtual Int_t RemovePoint()
Delete point close to the mouse position Returns index of removed point (or -1 if nothing was changed...
Definition TGraph.cxx:2011
void SetName(const char *name="") override
Set graph name.
Definition TGraph.cxx:2354
void Draw(Option_t *chopt="") override
Draw this graph with its current attributes.
Definition TGraph.cxx:809
void SetTitle(const char *title) override
Change/set the title.
Definition TH1.cxx:6667
@ kNoStats
Don't draw stats box.
Definition TH1.h:164
TAxis * GetXaxis()
Definition TH1.h:323
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...
Definition TH1.cxx:8372
virtual void SetMaximum(Double_t maximum=-1111)
Definition TH1.h:401
TAxis * GetYaxis()
Definition TH1.h:324
void Draw(Option_t *option="") override
Draw this histogram with options.
Definition TH1.cxx:3047
virtual void SetContour(Int_t nlevels, const Double_t *levels=nullptr)
Set the number and values of contour levels.
Definition TH1.cxx:8310
TObject * Clone(const char *newname="") const override
Make a complete copy of the underlying object.
Definition TH1.cxx:2733
virtual void SetStats(Bool_t stats=kTRUE)
Set statistics option on/off.
Definition TH1.cxx:8817
2-D histogram with a double per channel (see TH1 documentation)}
Definition TH2.h:301
static TClass * Class()
2-D histogram with a float per channel (see TH1 documentation)}
Definition TH2.h:258
Service class for 2-D histogram classes.
Definition TH2.h:30
Use the TLine constructor to create a simple line.
Definition TLine.h:22
A doubly linked list.
Definition TList.h:38
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
Definition TNamed.cxx:164
const char * GetName() const override
Returns name of object.
Definition TNamed.h:47
const char * GetTitle() const override
Returns title of object.
Definition TNamed.h:48
virtual void SetName(const char *name)
Set the name of the TNamed.
Definition TNamed.cxx:140
An array of TObjects.
Definition TObjArray.h:31
TObject * At(Int_t idx) const override
Definition TObjArray.h:164
virtual TObject * DrawClone(Option_t *option="") const
Draw a clone of this object in the current selected pad with: gROOT->SetSelectedPad(c1).
Definition TObject.cxx:299
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Definition TObject.cxx:780
virtual TClass * IsA() const
Definition TObject.h:245
virtual void Draw(Option_t *option="")
Default Draw method for all objects.
Definition TObject.cxx:274
The most important graphics class in the ROOT system.
Definition TPad.h:28
Basic string class.
Definition TString.h:139
Ssiz_t Length() const
Definition TString.h:418
void ToLower()
Change string to lower-case.
Definition TString.cxx:1171
const char * Data() const
Definition TString.h:377
TString & ReplaceAll(const TString &s1, const TString &s2)
Definition TString.h:701
TString & Append(const char *cs)
Definition TString.h:573
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
Definition TString.cxx:2357
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Definition TString.h:633
TVirtualPad is an abstract base class for the Pad and Canvas classes.
Definition TVirtualPad.h:51
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...
TGraphErrors * gr
Definition legend1.C:25
TF1 * f1
Definition legend1.C:11
Namespace for the RooStats classes.
Definition Asimov.h:19