Logo ROOT  
Reference Guide
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 "TMath.h"
33#include "TLine.h"
34#include "TObjArray.h"
35#include "TList.h"
36#include "TGraph.h"
37#include "TPad.h"
38#include "TCanvas.h"
39// need chisquare_quantile function - can use mathcore implementation
40// for plotting not crucial that is less precise
42
43
44#include "RooRealVar.h"
45#include "RooPlot.h"
46#include "RooMsgService.h"
47#include "RooProfileLL.h"
48#include "TF1.h"
49
50/// ClassImp for building the THtml documentation of the class
51using namespace std;
52
54
55using namespace RooStats;
56
57////////////////////////////////////////////////////////////////////////////////
58/// LikelihoodIntervalPlot default constructor
59/// with default parameters
60
61LikelihoodIntervalPlot::LikelihoodIntervalPlot()
62{
63 fInterval = 0;
64 fNdimPlot = 0;
65 fParamsPlot = 0;
66 fColor = 0;
67 fFillStyle = 4050; // half transparent
68 fLineColor = 0;
69 fMaximum = -1;
70 fNPoints = 0; // default depends if 1D or 2D
71 // default is variable range
72 fXmin = 0;
73 fXmax = -1;
74 fYmin = 0;
75 fYmax = -1;
76 fPrecision = -1; // use default
77 fPlotObject = 0;
78}
79
80////////////////////////////////////////////////////////////////////////////////
81/// LikelihoodIntervalPlot copy constructor
82
84{
85 fInterval = theInterval;
88 fColor = 0;
89 fLineColor = 0;
90 fFillStyle = 4050; // half transparent
91 fMaximum = -1;
92 fNPoints = 0; // default depends if 1D or 2D
93 // default is variable range
94 fXmin = 0;
95 fXmax = -1;
96 fYmin = 0;
97 fYmax = -1;
98 fPrecision = -1; // use default
99 fPlotObject = 0;
100}
101
102////////////////////////////////////////////////////////////////////////////////
103/// LikelihoodIntervalPlot destructor
104
106{
107}
108
109////////////////////////////////////////////////////////////////////////////////
110
112{
113 fInterval = theInterval;
116
117 return;
118}
119
120////////////////////////////////////////////////////////////////////////////////
121
123{
124 fNdimPlot = params->getSize();
125 fParamsPlot = (RooArgSet*) params->clone((std::string(params->GetName())+"_clone").c_str());
126
127 return;
128}
129
130
131////////////////////////////////////////////////////////////////////////////////
132/// draw the log of the profiled likelihood function in 1D with the interval or
133/// as a 2D plot with the contours.
134/// Higher dimensional intervals cannot be drawn. One needs to call
135/// SetPlotParameters to project interval in 1 or 2dim
136///
137/// ### Options for drawing 1D intervals
138///
139/// For 1D problem the log of the profiled likelihood function is drawn by default in a RooPlot as a
140/// RooCurve
141/// The plotting range (default is the full parameter range) and the precision of the RooCurve
142/// can be specified by using SetRange(x1,x2) and SetPrecision(eps).
143/// SetNPoints(npoints) can also be used (default is npoints=100)
144/// Optionally the function can be drawn as a TF1 (option="tf1") obtained by sampling the given npoints
145/// in the given range
146///
147/// ### Options for drawing 2D intervals
148///
149/// For 2D case, a contour and optionally the profiled likelihood function is drawn by sampling npoints in
150/// the given range. A 2d histogram of nbinsX=nbinsY = sqrt(npoints) is used for sampling the profiled likelihood.
151/// The contour can be obtained by using Minuit or by the sampled histogram,
152/// If using Minuit, the number of points specifies the number of contour points. If using an histogram the number of
153/// points is approximately the total number of bins of the histogram.
154/// Possible options:
155/// - minuit/nominuit: use minuit for computing the contour
156/// - hist/nohist : sample in an histogram the profiled likelihood
157///
158/// Note that one can have both a drawing of the sampled likelihood and of the contour using minuit.
159/// The default options is "minuit nohist"
160/// The sampled histogram is drawn first by default using the option "colz" and then 8 probability contours at
161/// 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
162/// option "cont3"
163///
164/// The drawn object (RooPlot or sampled histogram) is saved in the class and can be retrieved using GetPlottedObject()
165/// In this way the user can eventually customize further the plot.
166/// Note that the class does not delete the plotted object. It needs, if needed, to be deleted by the user
167
169{
171 // we need to check if parameters to plot is different than parameters of interval
172 RooArgSet* intervalParams = fInterval->GetParameters();
173 RooAbsArg * arg = 0;
174 RooArgSet extraParams;
175 while((arg=(RooAbsArg*)it.Next())) {
176 if (!intervalParams->contains(*arg) ) {
177 ccoutE(InputArguments) << "Parameter " << arg->GetName() << "is not in the list of LikelihoodInterval parameters "
178 << " - do not use for plotting " << std::endl;
179 fNdimPlot--;
180 extraParams.add(*arg);
181 }
182 }
183 if (extraParams.getSize() > 0)
184 fParamsPlot->remove(extraParams,true,true);
185
186 if(fNdimPlot > 2){
187 ccoutE(InputArguments) << "LikelihoodIntervalPlot::Draw(" << GetName()
188 << ") ERROR: contours for more than 2 dimensions not implemented!" << std::endl;
189 return;
190 }
191
192 // if the number of parameters to plot is less to the number of parameters of the LikelihoodInterval
193 // we need to re-do the profile likelihood function, otherwise those parameters will not be profiled
194 // when plotting
195 RooAbsReal* newProfile = 0;
196 RooAbsReal* oldProfile = fInterval->GetLikelihoodRatio();
197 if (fNdimPlot != intervalParams->getSize() ) {
198 RooProfileLL * profilell = dynamic_cast<RooProfileLL*>(oldProfile);
199 if (!profilell) return;
200 RooAbsReal & nll = profilell->nll();
201 newProfile = nll.createProfile(*fParamsPlot);
202 }
203 else {
204 newProfile = oldProfile;
205 }
206
207 it.Reset();
208 RooRealVar *myparam = (RooRealVar*) it.Next();
209
210 // do a dummy evaluation around minimum to be sure profile has right minimum
213 newProfile->getVal();
214 }
215
216 // analyze options
217 TString opt = options;
218 opt.ToLower();
219
220 TString title = GetTitle();
221 int nPoints = fNPoints;
222
223 if(fNdimPlot == 1) {
224
225 // 1D drawing options
226 // use RooPLot for drawing the 1D PL
227 // if option is TF1 use TF1 for drawing
228 bool useRooPlot = opt.Contains("rooplot") || ! (opt.Contains("tf1"));
229 opt.ReplaceAll("rooplot","");
230 opt.ReplaceAll("tf1","");
231
232
233 // if (title.Length() == 0)
234 // title = "- log profile likelihood ratio";
235
236 if (nPoints <=0) nPoints = 100; // default in 1D
237
238 const Double_t xcont_min = fInterval->LowerLimit(*myparam);
239 const Double_t xcont_max = fInterval->UpperLimit(*myparam);
240
241 RooRealVar* myarg = (RooRealVar *) newProfile->getVariables()->find(myparam->GetName());
242 double x1 = myarg->getMin();
243 double x2 = myarg->getMax();
244
245 // default color values
246 if (fColor == 0) fColor = kBlue;
247 if (fLineColor == 0) fLineColor = kGreen;
248
249 RooPlot * frame = 0;
250
251 // use TF1 for drawing the function
252 if (!useRooPlot) {
253
254 // set a first estimate of range including 2 times upper and lower limit
255 double xmin = std::max( x1, 2*xcont_min - xcont_max);
256 double xmax = std::min( x2, 2*xcont_max - xcont_min);
257 if (fXmin < fXmax) { xmin = fXmin; xmax = fXmax; }
258
259 TF1 * tmp = newProfile->asTF(*myarg);
260 assert(tmp != 0);
261 tmp->SetRange(xmin, xmax);
262 tmp->SetNpx(nPoints);
263
264 // clone the function to avoid later to sample it
265 TF1 * f1 = (TF1*) tmp->Clone();
266 delete tmp;
267
268 f1->SetTitle(title);
269 TString name = TString(GetName()) + TString("_PLL_") + TString(myarg->GetName());
270 f1->SetName(name);
271
272 // set range for displaying x values where function <= fMaximum
273 // if no range is set amd
274 // if no reasonable value found maintain first estimate
275 x1 = xmin; x2 = xmax;
276 if (fMaximum > 0 && fXmin >= fXmax ) {
277 double x0 = f1->GetX(0, xmin, xmax);
278 // check that minimum is between xmin and xmax
279 if ( x0 > x1 && x0 < x2) {
280 x1 = f1->GetX(fMaximum, xmin, x0);
281 x2 = f1->GetX(fMaximum, x0, xmax);
283 //std::cout << "setting range to " << x1 << " , " << x2 << " x0 = " << x0 << std::endl;
284 }
285 }
286
287 f1->SetRange(x1,x2);
288
289
291 f1->GetXaxis()->SetTitle(myarg->GetName());
292 f1->GetYaxis()->SetTitle(Form("- log #lambda(%s)",myparam->GetName()));
293 f1->Draw(opt);
295
296 }
297 else {
298 // use a RooPlot for drawing the PL function
299 double xmin = myparam->getMin(); double xmax = myparam->getMax();
300 if (fXmin < fXmax) { xmin = fXmin; xmax = fXmax; }
301
302 // set nbins (must be used in combination with precision )
303 // the curve will evaluate 2 * nbins if precision is > 1
304 int prevBins = myarg->getBins();
305 myarg->setBins(fNPoints);
306
307 // want to set range on frame not function
308 frame = myarg->frame(xmin,xmax,nPoints);
309 // for ycutoff line
310 x1= xmin;
311 x2=xmax;
312 frame->SetTitle(title);
313 frame->GetYaxis()->SetTitle(Form("- log #lambda(%s)",myparam->GetName()));
314 // frame->GetYaxis()->SetTitle("- log profile likelihood ratio");
315
316
317 // plot
318 RooCmdArg cmd;
320 newProfile->plotOn(frame,cmd,RooFit::LineColor(fColor));
321
322 frame->SetMaximum(fMaximum);
323 frame->SetMinimum(0.);
324
325 myarg->setBins(prevBins);
326 fPlotObject = frame;
327 }
328
329
330 //myarg->setVal(xcont_max);
331 //const Double_t Yat_Xmax = newProfile->getVal();
333
334 TLine *Yline_cutoff = new TLine(x1,Yat_Xmax,x2,Yat_Xmax);
335 TLine *Yline_min = new TLine(xcont_min,0.,xcont_min,Yat_Xmax);
336 TLine *Yline_max = new TLine(xcont_max,0.,xcont_max,Yat_Xmax);
337
338 Yline_cutoff->SetLineColor(fLineColor);
339 Yline_min->SetLineColor(fLineColor);
340 Yline_max->SetLineColor(fLineColor);
341
342 if (!useRooPlot) {
343 // need to draw the line
344 Yline_cutoff->Draw();
345 Yline_min->Draw();
346 Yline_max->Draw();
347 }
348 else {
349 // add line in the RooPlot
350 frame->addObject(Yline_min);
351 frame->addObject(Yline_max);
352 frame->addObject(Yline_cutoff);
353 frame->Draw(opt);
354 }
355
356
357 return;
358 }
359
360 // case of 2 dimensions
361
362 else if(fNdimPlot == 2){
363
364 //2D drawing options
365
366 // use Minuit for drawing the contours of the PL (default case)
367 bool useMinuit = !opt.Contains("nominuit");
368 // plot histogram in 2D
369 bool plotHist = !opt.Contains("nohist");
370 opt.ReplaceAll("nominuit","");
371 opt.ReplaceAll("nohist","");
372 if (opt.Contains("minuit") ) useMinuit= true;
373 if (useMinuit) plotHist = false; // switch off hist by default in case of Minuit
374 if (opt.Contains("hist") ) plotHist= true;
375 opt.ReplaceAll("minuit","");
376 opt.ReplaceAll("hist","");
377
378 RooRealVar *myparamY = (RooRealVar*)it.Next();
379
380 Double_t cont_level = ROOT::Math::chisquared_quantile(fInterval->ConfidenceLevel(),fNdimPlot); // level for -2log LR
381 cont_level = cont_level/2; // since we are plotting -log LR
382
383 RooArgList params(*newProfile->getVariables());
384 // set values and error for the POI to the best fit values
385 for (int i = 0; i < params.getSize(); ++i) {
386 RooRealVar & par = (RooRealVar &) params[i];
387 RooRealVar * fitPar = (RooRealVar *) (fInterval->GetBestFitParameters()->find(par.GetName() ) );
388 if (fitPar) {
389 par.setVal( fitPar->getVal() );
390 }
391 }
392 // do a profile evaluation to start from the best fit values of parameters
393 newProfile->getVal();
394
395 if (title.Length() == 0)
396 title = TString("Contour of ") + TString(myparamY->GetName() ) + TString(" vs ") + TString(myparam->GetName() );
397 // add also labels
398 title = TString::Format("%s;%s;%s",title.Data(),myparam->GetName(),myparamY->GetName());
399
400 if (nPoints <=0) nPoints = 40; // default in 2D
401
402 double xmin = myparam->getMin(); double xmax = myparam->getMax();
403 double ymin = myparamY->getMin(); double ymax = myparamY->getMax();
404 if (fXmin < fXmax) { xmin = fXmin; xmax = fXmax; }
405 if (fYmin < fYmax) { ymin = fYmin; ymax = fYmax; }
406
407
408 if (!useMinuit || plotHist) {
409
410 // find contour from a scanned histogram of points
411
412 // draw directly the TH2 from the profile LL
413 TString histName = TString::Format("_hist2D__%s_%s",myparam->GetName(),myparamY->GetName() );
414 int nBins = int( std::sqrt(double(nPoints)) + 0.5 );
415 TH2* hist2D = new TH2D(histName, title, nBins, xmin, xmax, nBins, ymin, ymax );
416 newProfile->fillHistogram(hist2D, RooArgList(*myparam,*myparamY), 1, 0, false, 0, false);
417
418 hist2D->SetTitle(title);
419 hist2D->SetStats(kFALSE);
420
421 //need many color levels for drawing with option colz
422 if (plotHist) {
423
424 const int nLevels = 51;
425 double contLevels[nLevels];
426 contLevels[0] = 0.01;
427 double maxVal = (fMaximum > 0) ? fMaximum : hist2D->GetMaximum();
428 for (int k = 1; k < nLevels; ++k) {
429 contLevels[k] = k*maxVal/double(nLevels-1);
430 }
431 hist2D->SetContour(nLevels,contLevels);
432
433 if (fMaximum>0) hist2D->SetMaximum(fMaximum);
434
435 hist2D->DrawClone("COLZ");
436 }
437
438
439 //need now less contours for drawing with option cont
440
441 const int nLevels = 8;
442 double contLevels[nLevels];
443 // last 3 are the 3,4,5 sigma levels
444 double confLevels[nLevels] = { 0.1,0.3,0.5,0.683,0.95,0.9973,0.9999366575,0.9999994267};
445 for (int k = 0; k < nLevels; ++k) {
446 //contLevels[k] = 0.5*ROOT::Math::chisquared_quantile(1.-2.*ROOT::Math::normal_cdf_c(nSigmaLevels[k],1),2);
447 contLevels[k] = 0.5*ROOT::Math::chisquared_quantile(confLevels[k],2);
448 }
449 hist2D->SetContour(nLevels,contLevels);
450 if (fLineColor) hist2D->SetLineColor(fLineColor);
451
452 // default options for drawing a second histogram
453 TString tmpOpt = opt;
454 tmpOpt.ReplaceAll("same","");
455 if (tmpOpt.Length() < 3) opt += "cont3";
456 // if histo is plotted draw on top
457 if (plotHist) opt += TString(" same");
458 hist2D->Draw(opt.Data());
459 gPad->Update();
460
461 // case of plotting contours without minuit
462 if (!useMinuit) {
463
464 // set levels of contours if make contours without minuit
465 TH2 * h = (TH2*) hist2D->Clone();
466 h->SetContour(1,&cont_level);
467
468 TVirtualPad * currentPad = gPad;
469 // o a temporary draw to get the contour graph
470 TCanvas * tmpCanvas = new TCanvas("tmpCanvas","tmpCanvas");
471 h->Draw("CONT LIST");
472 gPad->Update();
473
474 // get graphs from the contours
475 TObjArray *contoursOrig = (TObjArray*) gROOT->GetListOfSpecials()->FindObject("contours");
476 // CLONE THE LIST IN CASE IT GETS DELETED
477 TObjArray *contours = 0;
478 if (contoursOrig) contours = (TObjArray*) contoursOrig->Clone();
479
480 delete tmpCanvas;
481 delete h;
482 gPad = currentPad;
483
484
485 // in case of option CONT4 I need to re-make the Pad
486 if (tmpOpt.Contains("cont4")) {
487 Double_t bm = gPad->GetBottomMargin();
488 Double_t lm = gPad->GetLeftMargin();
489 Double_t rm = gPad->GetRightMargin();
490 Double_t tm = gPad->GetTopMargin();
491 Double_t x1 = hist2D->GetXaxis()->GetXmin();
492 Double_t y1 = hist2D->GetYaxis()->GetXmin();
493 Double_t x2 = hist2D->GetXaxis()->GetXmax();
494 Double_t y2 = hist2D->GetYaxis()->GetXmax();
495
496 TPad *null=new TPad("null","null",0,0,1,1);
497 null->SetFillStyle(0);
498 null->SetFrameFillStyle(0);
499 null->Draw();
500 null->cd();
501 null->Range(x1-(x2-x1)*(lm/(1-rm-lm)),
502 y1-(y2-y1)*(bm/(1-tm-lm)),
503 x2+(x2-x1)*(rm/(1-rm-lm)),
504 y2+(y2-y1)*(tm/(1-tm-lm)));
505
506 gPad->Update();
507 }
508
509
510 if (contours) {
511 int ncontours = contours->GetSize();
512 for (int icont = 0; icont < ncontours; ++icont) {
513 TList * contourList = (TList*)contours->At(icont);
514 if (contourList && contourList->GetSize() > 0) {
515 TIterator * itgr = contourList->MakeIterator();
516 TGraph * gr = 0;
517 while( (gr = dynamic_cast<TGraph*>(itgr->Next()) ) ){
520 gr->SetLineWidth(3);
521 if (fColor) {
523 gr->Draw("FL");
524 }
525 else
526 gr->Draw("L");
527 }
528 delete itgr;
529 }
530 }
531 }
532 else {
533 ccoutE(InputArguments) << "LikelihoodIntervalPlot::Draw(" << GetName()
534 << ") ERROR: no contours found in ListOfSpecial" << std::endl;
535 }
536
537 fPlotObject = hist2D;
538
539 }
540 }
541 if (useMinuit) {
542
543 // find contours using Minuit
544 TGraph * gr = new TGraph(nPoints+1);
545
546 int ncp = fInterval->GetContourPoints(*myparam, *myparamY, gr->GetX(), gr->GetY(),nPoints);
547
548 if (int(ncp) < nPoints) {
549 std::cout << "Warning - Less points calculated in contours np = " << ncp << " / " << nPoints << std::endl;
550 for (int i = ncp; i < nPoints; ++i) gr->RemovePoint(i);
551 }
552 // add last point to same as first one to close the contour
553 gr->SetPoint(ncp, gr->GetX()[0], gr->GetY()[0] );
554 if (!opt.Contains("c")) opt.Append("L"); // use by default option L if C is not specified
555 // draw first a dummy 2d histogram gfor the axis
556 if (!opt.Contains("same") && !plotHist) {
557
558 TH2F* hist2D = new TH2F("_hist2D",title, nPoints, xmin, xmax, nPoints, ymin, ymax );
559 hist2D->GetXaxis()->SetTitle(myparam->GetName());
560 hist2D->GetYaxis()->SetTitle(myparamY->GetName());
561 hist2D->SetBit(TH1::kNoStats); // do not draw statistics
562 hist2D->SetFillStyle(fFillStyle);
563 hist2D->SetMaximum(1); // to avoid problem with subsequents draws
564 hist2D->Draw("AXIS");
565 }
567 if (fColor) {
568 // draw contour as filled area (add option "F")
570 opt.Append("F");
571 }
572 gr->SetLineWidth(3);
573 if (opt.Contains("same")) gr->SetFillStyle(fFillStyle); // put transparent
574 gr->Draw(opt);
575 TString name = TString("Graph_of_") + TString(fInterval->GetName());
576 gr->SetName(name);
577
578 if (!fPlotObject) fPlotObject = gr;
579 else if (fPlotObject->IsA() != TH2D::Class() ) fPlotObject = gr;
580
581 }
582
583 // draw also the minimum
584 const RooArgSet * bestFitParams = fInterval->GetBestFitParameters();
585 if (bestFitParams) {
586 TGraph * gr0 = new TGraph(1);
587 double x0 = bestFitParams->getRealValue(myparam->GetName());
588 double y0 = bestFitParams->getRealValue(myparamY->GetName());
589 gr0->SetPoint(0,x0,y0);
590 gr0->SetMarkerStyle(33);
591 if (fColor) {
592 if (fColor != kBlack) gr0->SetMarkerColor(fColor+4);
593 else gr0->SetMarkerColor(kGray);
594 }
595 gr0->Draw("P");
596 delete bestFitParams;
597 }
598
599
600
601 }
602
603 // need to delete if a new profileLL was made
604 if (newProfile != oldProfile) delete newProfile;
605
606 return;
607}
void Class()
Definition: Class.C:29
double
Definition: Converters.cxx:921
#define h(i)
Definition: RSha256.hxx:106
static const double x2[5]
static const double x1[5]
#define ccoutE(a)
Definition: RooMsgService.h:41
const Bool_t kFALSE
Definition: RtypesCore.h:90
const char Option_t
Definition: RtypesCore.h:64
#define ClassImp(name)
Definition: Rtypes.h:361
@ kGray
Definition: Rtypes.h:63
@ kBlack
Definition: Rtypes.h:63
@ kGreen
Definition: Rtypes.h:64
@ kBlue
Definition: Rtypes.h:64
@ kDashed
Definition: TAttLine.h:48
char name[80]
Definition: TGX11.cxx:109
float xmin
Definition: THbookFile.cxx:93
float ymin
Definition: THbookFile.cxx:93
float xmax
Definition: THbookFile.cxx:93
float ymax
Definition: THbookFile.cxx:93
double sqrt(double)
#define gROOT
Definition: TROOT.h:406
char * Form(const char *fmt,...)
#define gPad
Definition: TVirtualPad.h:287
RooAbsArg is the common abstract base class for objects that represent a value (of arbitrary type) an...
Definition: RooAbsArg.h:73
RooArgSet * getVariables(Bool_t stripDisconnected=kTRUE) const
Return RooArgSet with all variables (tree leaf nodes of expresssion tree)
Definition: RooAbsArg.cxx:1909
Int_t getSize() const
Bool_t contains(const RooAbsArg &var) const
Check if collection contains an argument with the same name as var.
Double_t getRealValue(const char *name, Double_t defVal=0, Bool_t verbose=kFALSE) const
Get value of a RooAbsReal stored in set with given name.
const char * GetName() const
Returns name of object.
virtual Bool_t remove(const RooAbsArg &var, Bool_t silent=kFALSE, Bool_t matchByNameOnly=kFALSE)
Remove the specified argument from our list.
TIterator * createIterator(Bool_t dir=kIterForward) const
TIterator-style iteration over contained elements.
RooAbsArg * find(const char *name) const
Find object with given name in list.
virtual Double_t getMax(const char *name=0) 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 Int_t getBins(const char *name=0) const
Get number of bins of currently defined range.
virtual Double_t getMin(const char *name=0) const
Get miniminum of currently defined range.
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
Definition: RooAbsReal.h:60
TH1 * fillHistogram(TH1 *hist, const RooArgList &plotVars, Double_t scaleFactor=1, const RooArgSet *projectedVars=0, Bool_t scaling=kTRUE, const RooArgSet *condObs=0, Bool_t setError=kTRUE) const
Fill the ROOT histogram 'hist' with values sampled from this function at the bin centers.
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.
virtual RooAbsReal * createProfile(const RooArgSet &paramsOfInterest)
Create a RooProfileLL object that eliminates all nuisance parameters in the present function.
Definition: RooAbsReal.cxx:515
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...
Double_t getVal(const RooArgSet *normalisationSet=nullptr) const
Evaluate object.
Definition: RooAbsReal.h:90
RooArgList is a container object that can hold multiple RooAbsArg objects.
Definition: RooArgList.h:21
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition: RooArgSet.h:28
virtual TObject * clone(const char *newname) const
Definition: RooArgSet.h:84
virtual Bool_t add(const RooAbsCollection &col, Bool_t silent=kFALSE)
Add a collection of arguments to this collection by calling add() for each element in the source coll...
Definition: RooArgSet.h:88
RooCmdArg is a named container for two doubles, two integers two object points and three string point...
Definition: RooCmdArg.h:28
A RooPlot is a plot frame and a container for graphics objects within that frame.
Definition: RooPlot.h:44
void addObject(TObject *obj, Option_t *drawOptions="", Bool_t invisible=kFALSE)
Add a generic object to this plot.
Definition: RooPlot.cxx:443
void SetTitle(const char *name)
Set the title of the RooPlot to 'title'.
Definition: RooPlot.cxx:1258
virtual void SetMinimum(Double_t minimum=-1111)
Set minimum value of Y axis.
Definition: RooPlot.cxx:1112
TAxis * GetYaxis() const
Definition: RooPlot.cxx:1277
virtual void SetMaximum(Double_t maximum=-1111)
Set maximum value of Y axis.
Definition: RooPlot.cxx:1102
virtual void Draw(Option_t *options=0)
Draw this plot and all of the elements it contains.
Definition: RooPlot.cxx:712
Class RooProfileLL implements the profile likelihood estimator for a given likelihood and set of para...
Definition: RooProfileLL.h:26
RooAbsReal & nll()
Definition: RooProfileLL.h:39
RooRealVar represents a variable that can be changed from the outside.
Definition: RooRealVar.h:35
void setBins(Int_t nBins, const char *name=0)
Create a uniform binning under name 'name' for this variable.
Definition: RooRealVar.cxx:418
virtual void setVal(Double_t value)
Set value of variable to 'value'.
Definition: RooRealVar.cxx:261
This class provides simple and straightforward utilities to plot a LikelihoodInterval object.
Double_t fMaximum
number of points used to scan the PL
virtual ~LikelihoodIntervalPlot()
Destructor of SamplingDistribution.
Int_t fNdimPlot
line color for the interval (1D) or for other contours (2D)
void SetPlotParameters(const RooArgSet *params)
Style_t fFillStyle
color for the contour (for 2D) or function (in 1D)
LikelihoodIntervalPlot()
LikelihoodIntervalPlot default constructor with default parameters.
void Draw(const Option_t *options=0)
draw the likelihood interval or contour for the 1D case a RooPlot is drawn by default of the profiled...
LikelihoodInterval * fInterval
RooCurve precision.
void SetLikelihoodInterval(LikelihoodInterval *theInterval)
Color_t fLineColor
fill style for contours
LikelihoodInterval is a concrete implementation of the RooStats::ConfInterval interface.
virtual RooArgSet * GetParameters() const
return a cloned list of parameters of interest. User manages the return object
Double_t LowerLimit(const RooRealVar &param)
return the lower bound of the interval on a given parameter
Int_t GetContourPoints(const RooRealVar &paramX, const RooRealVar &paramY, 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 ...
virtual Double_t ConfidenceLevel() const
return confidence level
RooAbsReal * GetLikelihoodRatio()
return the profile log-likelihood ratio function
Double_t UpperLimit(const RooRealVar &param)
return the upper bound of the interval on a given parameter
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
Double_t GetXmax() const
Definition: TAxis.h:134
Double_t GetXmin() const
Definition: TAxis.h:133
The Canvas class.
Definition: TCanvas.h:27
virtual TObject * Clone(const char *newname="") const
Make a clone of an collection using the Streamer facility.
virtual Int_t GetSize() const
Return the capacity of the collection, i.e.
Definition: TCollection.h:182
1-Dim function class
Definition: TF1.h:210
virtual TH1 * GetHistogram() const
Return a pointer to the histogram used to visualise the function.
Definition: TF1.cxx:1567
TAxis * GetYaxis() const
Get y axis of the function.
Definition: TF1.cxx:2396
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:3396
virtual void SetTitle(const char *title="")
Set function title if title has the form "fffffff;xxxx;yyyy", it is assumed that the function title i...
Definition: TF1.cxx:3551
virtual void SetRange(Double_t xmin, Double_t xmax)
Initialize the upper and lower bounds to draw the function.
Definition: TF1.cxx:3521
virtual void SetNpx(Int_t npx=100)
Set the number of points used to draw the function.
Definition: TF1.cxx:3435
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:1846
virtual void Draw(Option_t *option="")
Draw this function with its current attributes.
Definition: TF1.cxx:1320
TObject * Clone(const char *newname=0) const
Make a complete copy of the underlying object.
Definition: TF1.cxx:1051
TAxis * GetXaxis() const
Get x axis of the function.
Definition: TF1.cxx:2385
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:2269
Double_t * GetY() const
Definition: TGraph.h:131
virtual void SetName(const char *name="")
Set graph name.
Definition: TGraph.cxx:2308
virtual void Draw(Option_t *chopt="")
Draw this graph with its current attributes.
Definition: TGraph.cxx:760
Double_t * GetX() const
Definition: TGraph.h:130
virtual Int_t RemovePoint()
Delete point close to the mouse position.
Definition: TGraph.cxx:2087
virtual void SetTitle(const char *title)
See GetStatOverflows for more information.
Definition: TH1.cxx:6345
@ kNoStats
don't draw stats box
Definition: TH1.h:160
TAxis * GetXaxis()
Get the behaviour adopted by the object about the statoverflows. See EStatOverflows for more informat...
Definition: TH1.h:316
TObject * Clone(const char *newname=0) const
Make a complete copy of the underlying object.
Definition: TH1.cxx:2665
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:8006
virtual void SetMaximum(Double_t maximum=-1111)
Definition: TH1.h:394
TAxis * GetYaxis()
Definition: TH1.h:317
virtual void SetContour(Int_t nlevels, const Double_t *levels=0)
Set the number and values of contour levels.
Definition: TH1.cxx:7947
virtual void Draw(Option_t *option="")
Draw this histogram with options.
Definition: TH1.cxx:2998
virtual void SetStats(Bool_t stats=kTRUE)
Set statistics option on/off.
Definition: TH1.cxx:8446
2-D histogram with a double per channel (see TH1 documentation)}
Definition: TH2.h:292
2-D histogram with a float per channel (see TH1 documentation)}
Definition: TH2.h:251
Service class for 2-Dim histogram classes.
Definition: TH2.h:30
TObject * Next()
Definition: TCollection.h:249
void Reset()
Definition: TCollection.h:252
Iterator abstract base class.
Definition: TIterator.h:30
virtual TObject * Next()=0
A simple line.
Definition: TLine.h:23
A doubly linked list.
Definition: TList.h:44
virtual TIterator * MakeIterator(Bool_t dir=kIterForward) const
Return a list iterator.
Definition: TList.cxx:721
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
Definition: TNamed.cxx:164
virtual void SetName(const char *name)
Set the name of the TNamed.
Definition: TNamed.cxx:140
virtual const char * GetTitle() const
Returns title of object.
Definition: TNamed.h:48
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:47
An array of TObjects.
Definition: TObjArray.h:37
TObject * At(Int_t idx) const
Definition: TObjArray.h:166
virtual TObject * DrawClone(Option_t *option="") const
Draw a clone of this object in the current selected pad for instance with: gROOT->SetSelectedPad(gPad...
Definition: TObject.cxx:219
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Definition: TObject.cxx:694
virtual void Draw(Option_t *option="")
Default Draw method for all objects.
Definition: TObject.cxx:195
The most important graphics class in the ROOT system.
Definition: TPad.h:29
Basic string class.
Definition: TString.h:131
Ssiz_t Length() const
Definition: TString.h:405
void ToLower()
Change string to lower-case.
Definition: TString.cxx:1125
const char * Data() const
Definition: TString.h:364
TString & ReplaceAll(const TString &s1, const TString &s2)
Definition: TString.h:687
TString & Append(const char *cs)
Definition: TString.h:559
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:2311
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Definition: TString.h:619
TVirtualPad is an abstract base class for the Pad and Canvas classes.
Definition: TVirtualPad.h:51
RooCmdArg Precision(Double_t 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
@ InputArguments
Definition: RooGlobalFunc.h:68
Namespace for the RooStats classes.
Definition: Asimov.h:19
null_t< F > null()