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