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
49using namespace RooStats;
50
51////////////////////////////////////////////////////////////////////////////////
52/// LikelihoodIntervalPlot default constructor
53/// with default parameters
54
56
57////////////////////////////////////////////////////////////////////////////////
58/// LikelihoodIntervalPlot copy constructor
59
65
66////////////////////////////////////////////////////////////////////////////////
67
69{
70 fInterval = theInterval;
71 fParamsPlot = fInterval->GetParameters();
72 fNdimPlot = fParamsPlot->size();
73
74 return;
75}
76
77////////////////////////////////////////////////////////////////////////////////
78
80{
81 fNdimPlot = params->size();
82 fParamsPlot = static_cast<RooArgSet*>(params->clone((std::string(params->GetName())+"_clone").c_str()));
83
84 return;
85}
86
87
88////////////////////////////////////////////////////////////////////////////////
89/// draw the log of the profiled likelihood function in 1D with the interval or
90/// as a 2D plot with the contours.
91/// Higher dimensional intervals cannot be drawn. One needs to call
92/// SetPlotParameters to project interval in 1 or 2dim
93///
94/// ### Options for drawing 1D intervals
95///
96/// For 1D problem the log of the profiled likelihood function is drawn by default in a RooPlot as a
97/// RooCurve
98/// The plotting range (default is the full parameter range) and the precision of the RooCurve
99/// can be specified by using SetRange(x1,x2) and SetPrecision(eps).
100/// SetNPoints(npoints) can also be used (default is npoints=100)
101/// Optionally the function can be drawn as a TF1 (option="tf1") obtained by sampling the given npoints
102/// in the given range
103///
104/// ### Options for drawing 2D intervals
105///
106/// For 2D case, a contour and optionally the profiled likelihood function is drawn by sampling npoints in
107/// the given range. A 2d histogram of nbinsX=nbinsY = sqrt(npoints) is used for sampling the profiled likelihood.
108/// The contour can be obtained by using Minuit or by the sampled histogram,
109/// If using Minuit, the number of points specifies the number of contour points. If using an histogram the number of
110/// points is approximately the total number of bins of the histogram.
111/// Possible options:
112/// - minuit/nominuit: use minuit for computing the contour
113/// - hist/nohist : sample in an histogram the profiled likelihood
114///
115/// Note that one can have both a drawing of the sampled likelihood and of the contour using minuit.
116/// The default options is "minuit nohist"
117/// The sampled histogram is drawn first by default using the option "colz" and then 8 probability contours at
118/// 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
119/// option "cont3"
120///
121/// The drawn object (RooPlot or sampled histogram) is saved in the class and can be retrieved using GetPlottedObject()
122/// In this way the user can eventually customize further the plot.
123/// Note that the class does not delete the plotted object. It needs, if needed, to be deleted by the user
124
126{
127 // we need to check if parameters to plot is different than parameters of interval
128 RooArgSet* intervalParams = fInterval->GetParameters();
129 RooArgSet extraParams;
130 for (auto const *arg : *fParamsPlot) {
131 if (!intervalParams->contains(*arg) ) {
132 ccoutE(InputArguments) << "Parameter " << arg->GetName() << "is not in the list of LikelihoodInterval parameters "
133 << " - do not use for plotting " << std::endl;
134 fNdimPlot--;
135 extraParams.add(*arg);
136 }
137 }
138 if (!extraParams.empty())
139 fParamsPlot->remove(extraParams,true,true);
140
141 if(fNdimPlot > 2){
142 ccoutE(InputArguments) << "LikelihoodIntervalPlot::Draw(" << GetName()
143 << ") ERROR: contours for more than 2 dimensions not implemented!" << std::endl;
144 return;
145 }
146
147 // if the number of parameters to plot is less to the number of parameters of the LikelihoodInterval
148 // we need to re-do the profile likelihood function, otherwise those parameters will not be profiled
149 // when plotting
150 RooAbsReal* newProfile = nullptr;
151 std::unique_ptr<RooAbsReal> newProfileOwner;
152 RooAbsReal* oldProfile = fInterval->GetLikelihoodRatio();
153 if (fNdimPlot != int(intervalParams->size()) ) {
154 RooProfileLL * profilell = dynamic_cast<RooProfileLL*>(oldProfile);
155 if (!profilell) return;
156 RooAbsReal & nll = profilell->nll();
157 newProfileOwner = std::unique_ptr<RooAbsReal>{nll.createProfile(*fParamsPlot)};
158 newProfile = newProfileOwner.get();
159 }
160 else {
161 newProfile = oldProfile;
162 }
163
164 auto *myparam = static_cast<RooRealVar*>((*fParamsPlot)[0]);
165
166 // do a dummy evaluation around minimum to be sure profile has right minimum
167 if (fInterval->GetBestFitParameters() ) {
168 fParamsPlot->assign(*fInterval->GetBestFitParameters());
169 newProfile->getVal();
170 }
171
172 // analyze options
173 TString opt = options;
174 opt.ToLower();
175
176 TString title = GetTitle();
177 int nPoints = fNPoints;
178
179 if(fNdimPlot == 1) {
180
181 // 1D drawing options
182 // use RooPLot for drawing the 1D PL
183 // if option is TF1 use TF1 for drawing
184 bool useRooPlot = opt.Contains("rooplot") || ! (opt.Contains("tf1"));
185 opt.ReplaceAll("rooplot","");
186 opt.ReplaceAll("tf1","");
187
188
189 // if (title.Length() == 0)
190 // title = "- log profile likelihood ratio";
191
192 if (nPoints <=0) nPoints = 100; // default in 1D
193
194 const double xcont_min = fInterval->LowerLimit(*myparam);
195 const double xcont_max = fInterval->UpperLimit(*myparam);
196
197 std::unique_ptr<RooArgSet> vars{newProfile->getVariables()};
198 RooRealVar *myarg = static_cast<RooRealVar *>(vars->find(myparam->GetName()));
199 double x1 = myarg->getMin();
200 double x2 = myarg->getMax();
201
202 // default color values
203 if (fColor == 0) fColor = kBlue;
204 if (fLineColor == 0) fLineColor = kGreen;
205
206 RooPlot * frame = nullptr;
207
208 // use TF1 for drawing the function
209 if (!useRooPlot) {
210
211 // set a first estimate of range including 2 times upper and lower limit
212 double xmin = std::max( x1, 2*xcont_min - xcont_max);
213 double xmax = std::min( x2, 2*xcont_max - xcont_min);
214 if (fXmin < fXmax) { xmin = fXmin; xmax = fXmax; }
215
216 TF1 * tmp = newProfile->asTF(*myarg);
217 assert(tmp != nullptr);
218 tmp->SetRange(xmin, xmax);
219 tmp->SetNpx(nPoints);
220
221 // clone the function to avoid later to sample it
222 TF1 * f1 = static_cast<TF1*>(tmp->Clone());
223 delete tmp;
224
225 f1->SetTitle(title);
226 TString name = TString(GetName()) + TString("_PLL_") + TString(myarg->GetName());
227 f1->SetName(name);
228
229 // set range for displaying x values where function <= fMaximum
230 // if no range is set amd
231 // if no reasonable value found maintain first estimate
232 x1 = xmin; x2 = xmax;
233 if (fMaximum > 0 && fXmin >= fXmax ) {
234 double x0 = f1->GetX(0, xmin, xmax);
235 // check that minimum is between xmin and xmax
236 if ( x0 > x1 && x0 < x2) {
237 x1 = f1->GetX(fMaximum, xmin, x0);
238 x2 = f1->GetX(fMaximum, x0, xmax);
239 f1->SetMaximum(fMaximum);
240 //std::cout << "setting range to " << x1 << " , " << x2 << " x0 = " << x0 << std::endl;
241 }
242 }
243
244 f1->SetRange(x1,x2);
245
246
247 f1->SetLineColor(kBlue);
248 f1->GetXaxis()->SetTitle(myarg->GetName());
249 f1->GetYaxis()->SetTitle(Form("- log #lambda(%s)",myparam->GetName()));
250 f1->Draw(opt);
251 fPlotObject = f1->GetHistogram();
252
253 }
254 else {
255 // use a RooPlot for drawing the PL function
256 double xmin = myparam->getMin(); double xmax = myparam->getMax();
257 if (fXmin < fXmax) { xmin = fXmin; xmax = fXmax; }
258
259 // set nbins (must be used in combination with precision )
260 // the curve will evaluate 2 * nbins if precision is > 1
261 int prevBins = myarg->getBins();
262 myarg->setBins(fNPoints);
263
264 // want to set range on frame not function
265 frame = myarg->frame(xmin,xmax,nPoints);
266 // for ycutoff line
267 x1= xmin;
268 x2=xmax;
269 frame->SetTitle(title);
270 frame->GetYaxis()->SetTitle(Form("- log #lambda(%s)",myparam->GetName()));
271 // frame->GetYaxis()->SetTitle("- log profile likelihood ratio");
272
273
274 // plot
275 RooCmdArg cmd;
277 newProfile->plotOn(frame,cmd,RooFit::LineColor(fColor));
278
279 frame->SetMaximum(fMaximum);
280 frame->SetMinimum(0.);
281
282 myarg->setBins(prevBins);
283 fPlotObject = frame;
284 }
285
286
287 //myarg->setVal(xcont_max);
288 //const double Yat_Xmax = newProfile->getVal();
289 double Yat_Xmax = 0.5*ROOT::Math::chisquared_quantile(fInterval->ConfidenceLevel(),1);
290
291 TLine *Yline_cutoff = new TLine(x1,Yat_Xmax,x2,Yat_Xmax);
292 TLine *Yline_min = new TLine(xcont_min,0.,xcont_min,Yat_Xmax);
293 TLine *Yline_max = new TLine(xcont_max,0.,xcont_max,Yat_Xmax);
294
295 Yline_cutoff->SetLineColor(fLineColor);
296 Yline_min->SetLineColor(fLineColor);
297 Yline_max->SetLineColor(fLineColor);
298
299 if (!useRooPlot) {
300 // need to draw the line
301 Yline_cutoff->Draw();
302 Yline_min->Draw();
303 Yline_max->Draw();
304 }
305 else {
306 // add line in the RooPlot
307 frame->addObject(Yline_min);
308 frame->addObject(Yline_max);
309 frame->addObject(Yline_cutoff);
310 frame->Draw(opt);
311 }
312
313
314 return;
315 }
316
317 // case of 2 dimensions
318
319 else if(fNdimPlot == 2){
320
321 //2D drawing options
322
323 // use Minuit for drawing the contours of the PL (default case)
324 bool useMinuit = !opt.Contains("nominuit");
325 // plot histogram in 2D
326 bool plotHist = !opt.Contains("nohist");
327 opt.ReplaceAll("nominuit","");
328 opt.ReplaceAll("nohist","");
329 if (opt.Contains("minuit") ) useMinuit= true;
330 if (useMinuit) plotHist = false; // switch off hist by default in case of Minuit
331 if (opt.Contains("hist") ) plotHist= true;
332 opt.ReplaceAll("minuit","");
333 opt.ReplaceAll("hist","");
334
335 auto *myparamY = static_cast<RooRealVar*>((*fParamsPlot)[1]);
336
337 double cont_level = ROOT::Math::chisquared_quantile(fInterval->ConfidenceLevel(),fNdimPlot); // level for -2log LR
338 cont_level = cont_level/2; // since we are plotting -log LR
339
340 std::unique_ptr<RooArgSet> vars{newProfile->getVariables()};
341 RooArgList params(*vars);
342 // set values and error for the POI to the best fit values
343 for (auto *par : static_range_cast<RooRealVar *>(params)) {
344 RooRealVar * fitPar = static_cast<RooRealVar *> (fInterval->GetBestFitParameters()->find(par->GetName() ) );
345 if (fitPar) {
346 par->setVal( fitPar->getVal() );
347 }
348 }
349 // do a profile evaluation to start from the best fit values of parameters
350 newProfile->getVal();
351
352 if (title.Length() == 0)
353 title = TString("Contour of ") + TString(myparamY->GetName() ) + TString(" vs ") + TString(myparam->GetName() );
354 // add also labels
355 title = TString::Format("%s;%s;%s",title.Data(),myparam->GetName(),myparamY->GetName());
356
357 if (nPoints <=0) nPoints = 40; // default in 2D
358
359 double xmin = myparam->getMin(); double xmax = myparam->getMax();
360 double ymin = myparamY->getMin(); double ymax = myparamY->getMax();
361 if (fXmin < fXmax) { xmin = fXmin; xmax = fXmax; }
362 if (fYmin < fYmax) { ymin = fYmin; ymax = fYmax; }
363
364
365 if (!useMinuit || plotHist) {
366
367 // find contour from a scanned histogram of points
368
369 // draw directly the TH2 from the profile LL
370 TString histName = TString::Format("_hist2D__%s_%s",myparam->GetName(),myparamY->GetName() );
371 int nBins = int( std::sqrt(double(nPoints)) + 0.5 );
372 TH2* hist2D = new TH2D(histName, title, nBins, xmin, xmax, nBins, ymin, ymax );
373 newProfile->fillHistogram(hist2D, RooArgList(*myparam,*myparamY), 1, nullptr, false, nullptr, false);
374
375 hist2D->SetTitle(title);
376 hist2D->SetStats(false);
377
378 //need many color levels for drawing with option colz
379 if (plotHist) {
380
381 const int nLevels = 51;
382 double contLevels[nLevels];
383 contLevels[0] = 0.01;
384 double maxVal = (fMaximum > 0) ? fMaximum : hist2D->GetMaximum();
385 for (int k = 1; k < nLevels; ++k) {
386 contLevels[k] = k*maxVal/double(nLevels-1);
387 }
388 hist2D->SetContour(nLevels,contLevels);
389
390 if (fMaximum>0) hist2D->SetMaximum(fMaximum);
391
392 hist2D->DrawClone("COLZ");
393 }
394
395
396 //need now less contours for drawing with option cont
397
398 const int nLevels = 8;
399 double contLevels[nLevels];
400 // last 3 are the 3,4,5 sigma levels
401 double confLevels[nLevels] = { 0.1,0.3,0.5,0.683,0.95,0.9973,0.9999366575,0.9999994267};
402 for (int k = 0; k < nLevels; ++k) {
403 //contLevels[k] = 0.5*ROOT::Math::chisquared_quantile(1.-2.*ROOT::Math::normal_cdf_c(nSigmaLevels[k],1),2);
404 contLevels[k] = 0.5*ROOT::Math::chisquared_quantile(confLevels[k],2);
405 }
406 hist2D->SetContour(nLevels,contLevels);
407 if (fLineColor) hist2D->SetLineColor(fLineColor);
408
409 // default options for drawing a second histogram
410 TString tmpOpt = opt;
411 tmpOpt.ReplaceAll("same","");
412 if (tmpOpt.Length() < 3) opt += "cont3";
413 // if histo is plotted draw on top
414 if (plotHist) opt += TString(" same");
415 hist2D->Draw(opt.Data());
416 gPad->Update();
417
418 // case of plotting contours without minuit
419 if (!useMinuit) {
420
421 // set levels of contours if make contours without minuit
422 TH2 * h = static_cast<TH2*>(hist2D->Clone());
423 h->SetContour(1,&cont_level);
424
425 TVirtualPad * currentPad = gPad;
426 // o a temporary draw to get the contour graph
427 TCanvas * tmpCanvas = new TCanvas("tmpCanvas","tmpCanvas");
428 h->Draw("CONT LIST");
429 gPad->Update();
430
431 // get graphs from the contours
432 TObjArray *contoursOrig = static_cast<TObjArray*>(gROOT->GetListOfSpecials()->FindObject("contours"));
433 // CLONE THE LIST IN CASE IT GETS DELETED
434 TObjArray *contours = nullptr;
435 if (contoursOrig) contours = static_cast<TObjArray*>(contoursOrig->Clone());
436
437 delete tmpCanvas;
438 delete h;
439 gPad = currentPad;
440
441
442 // in case of option CONT4 I need to re-make the Pad
443 if (tmpOpt.Contains("cont4")) {
444 double bm = gPad->GetBottomMargin();
445 double lm = gPad->GetLeftMargin();
446 double rm = gPad->GetRightMargin();
447 double tm = gPad->GetTopMargin();
448 double x1 = hist2D->GetXaxis()->GetXmin();
449 double y1 = hist2D->GetYaxis()->GetXmin();
450 double x2 = hist2D->GetXaxis()->GetXmax();
451 double y2 = hist2D->GetYaxis()->GetXmax();
452
453 TPad *null=new TPad("null","null",0,0,1,1);
454 null->SetFillStyle(0);
455 null->SetFrameFillStyle(0);
456 null->Draw();
457 null->cd();
458 null->Range(x1-(x2-x1)*(lm/(1-rm-lm)),
459 y1-(y2-y1)*(bm/(1-tm-lm)),
460 x2+(x2-x1)*(rm/(1-rm-lm)),
461 y2+(y2-y1)*(tm/(1-tm-lm)));
462
463 gPad->Update();
464 }
465
466
467 if (contours) {
468 int ncontours = contours->GetSize();
469 for (int icont = 0; icont < ncontours; ++icont) {
470 TList * contourList = static_cast<TList*>(contours->At(icont));
471 if (contourList && contourList->GetSize() > 0) {
472 for(auto * gr : static_range_cast<TGraph*>(*contourList)) {
473 if (fLineColor) gr->SetLineColor(fLineColor);
474 gr->SetLineStyle(kDashed);
475 gr->SetLineWidth(3);
476 if (fColor) {
477 gr->SetFillColor(fColor);
478 gr->Draw("FL");
479 }
480 else
481 gr->Draw("L");
482 }
483 }
484 }
485 }
486 else {
487 ccoutE(InputArguments) << "LikelihoodIntervalPlot::Draw(" << GetName()
488 << ") ERROR: no contours found in ListOfSpecial" << std::endl;
489 }
490
491 fPlotObject = hist2D;
492
493 }
494 }
495 if (useMinuit) {
496
497 // find contours using Minuit
498 TGraph * gr = new TGraph(nPoints+1);
499
500 int ncp = fInterval->GetContourPoints(*myparam, *myparamY, gr->GetX(), gr->GetY(),nPoints);
501
502 if (int(ncp) < nPoints) {
503 coutW(Eval) << "Warning - Less points calculated in contours np = " << ncp << " / " << nPoints << std::endl;
504 for (int i = ncp; i < nPoints; ++i) gr->RemovePoint(i);
505 }
506 // add last point to same as first one to close the contour
507 gr->SetPoint(ncp, gr->GetX()[0], gr->GetY()[0] );
508 if (!opt.Contains("c")) opt.Append("L"); // use by default option L if C is not specified
509 // draw first a dummy 2d histogram gfor the axis
510 if (!opt.Contains("same") && !plotHist) {
511
512 TH2F* hist2D = new TH2F("_hist2D",title, nPoints, xmin, xmax, nPoints, ymin, ymax );
513 hist2D->GetXaxis()->SetTitle(myparam->GetName());
514 hist2D->GetYaxis()->SetTitle(myparamY->GetName());
515 hist2D->SetBit(TH1::kNoStats); // do not draw statistics
516 hist2D->SetFillStyle(fFillStyle);
517 hist2D->SetMaximum(1); // to avoid problem with subsequents draws
518 hist2D->Draw("AXIS");
519 }
520 if (fLineColor) gr->SetLineColor(fLineColor);
521 if (fColor) {
522 // draw contour as filled area (add option "F")
523 gr->SetFillColor(fColor);
524 opt.Append("F");
525 }
526 gr->SetLineWidth(3);
527 if (opt.Contains("same")) gr->SetFillStyle(fFillStyle); // put transparent
528 gr->Draw(opt);
529 TString name = TString("Graph_of_") + TString(fInterval->GetName());
530 gr->SetName(name);
531
532 if (!fPlotObject) fPlotObject = gr;
533 else if (fPlotObject->IsA() != TH2D::Class() ) fPlotObject = gr;
534
535 }
536
537 // draw also the minimum
538 const RooArgSet * bestFitParams = fInterval->GetBestFitParameters();
539 if (bestFitParams) {
540 TGraph * gr0 = new TGraph(1);
541 double x0 = bestFitParams->getRealValue(myparam->GetName());
542 double y0 = bestFitParams->getRealValue(myparamY->GetName());
543 gr0->SetPoint(0,x0,y0);
544 gr0->SetMarkerStyle(33);
545 if (fColor) {
546 if (fColor != kBlack) gr0->SetMarkerColor(fColor+4);
547 else gr0->SetMarkerColor(kGray);
548 }
549 gr0->Draw("P");
550 delete bestFitParams;
551 }
552
553
554
555 }
556
557 return;
558}
#define h(i)
Definition RSha256.hxx:106
ROOT::RRangeCast< T, false, Range_t > static_range_cast(Range_t &&coll)
#define ccoutE(a)
#define coutW(a)
const char Option_t
Option string (const char)
Definition RtypesCore.h:80
@ kGray
Definition Rtypes.h:66
@ kBlack
Definition Rtypes.h:66
@ kGreen
Definition Rtypes.h:67
@ kBlue
Definition Rtypes.h:67
@ kDashed
Definition TAttLine.h:54
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:148
float xmin
float ymin
float xmax
float ymax
#define gROOT
Definition TROOT.h:417
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
Definition TString.cxx:2570
#define gPad
RooFit::OwningPtr< RooArgSet > getVariables(bool stripDisconnected=true) const
Return RooArgSet with all variables (tree leaf nodes of expression tree)
bool contains(const char *name) const
Check if collection contains an argument with a specific name.
double getRealValue(const char *name, double defVal=0.0, bool verbose=false) const
Get value of a RooAbsReal stored in set with given name.
const char * GetName() const override
Returns name of object.
virtual bool add(const RooAbsArg &var, bool silent=false)
Add the specified argument to list.
Storage_t::size_type size() const
virtual Int_t getBins(const char *name=nullptr) const
Get number of bins of currently defined range.
RooPlot * frame(const RooCmdArg &arg1, const RooCmdArg &arg2={}, const RooCmdArg &arg3={}, const RooCmdArg &arg4={}, const RooCmdArg &arg5={}, const RooCmdArg &arg6={}, const RooCmdArg &arg7={}, const RooCmdArg &arg8={}) const
Create a new RooPlot on the heap with a drawing frame initialized for this object,...
virtual double getMax(const char *name=nullptr) const
Get maximum of currently defined range.
virtual double getMin(const char *name=nullptr) const
Get minimum of currently defined range.
Abstract base class for objects that represent a real value and implements functionality common to al...
Definition RooAbsReal.h:63
double getVal(const RooArgSet *normalisationSet=nullptr) const
Evaluate object.
Definition RooAbsReal.h:107
TH1 * fillHistogram(TH1 *hist, const RooArgList &plotVars, double scaleFactor=1, const RooArgSet *projectedVars=nullptr, bool scaling=true, const RooArgSet *condObs=nullptr, bool setError=true) const
Fill the ROOT histogram 'hist' with values sampled from this function at the bin centers.
TF1 * asTF(const RooArgList &obs, const RooArgList &pars=RooArgList(), const RooArgSet &nset=RooArgSet()) const
Return a ROOT TF1,2,3 object bound to this RooAbsReal with given definition of observables and parame...
virtual RooPlot * plotOn(RooPlot *frame, const RooCmdArg &arg1={}, const RooCmdArg &arg2={}, const RooCmdArg &arg3={}, const RooCmdArg &arg4={}, const RooCmdArg &arg5={}, const RooCmdArg &arg6={}, const RooCmdArg &arg7={}, const RooCmdArg &arg8={}, const RooCmdArg &arg9={}, const RooCmdArg &arg10={}) const
Plot (project) PDF on specified frame.
RooArgList is a container object that can hold multiple RooAbsArg objects.
Definition RooArgList.h:22
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition RooArgSet.h:24
TObject * clone(const char *newname=nullptr) const override
Definition RooArgSet.h:111
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:1209
void addObject(TObject *obj, Option_t *drawOptions="", bool invisible=false)
Add a generic object to this plot.
Definition RooPlot.cxx:326
virtual void SetMinimum(double minimum=-1111)
Set minimum value of Y axis.
Definition RooPlot.cxx:1013
virtual void SetMaximum(double maximum=-1111)
Set maximum value of Y axis.
Definition RooPlot.cxx:1003
TAxis * GetYaxis() const
Definition RooPlot.cxx:1230
void Draw(Option_t *options=nullptr) override
Draw this plot and all of the elements it contains.
Definition RooPlot.cxx:597
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 setBins(Int_t nBins, const char *name=nullptr, bool shared=true)
Create a uniform binning under name 'name' for this variable.
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.
virtual void SetFillStyle(Style_t fstyle)
Set the fill area style.
Definition TAttFill.h:42
virtual void SetLineColor(Color_t lcolor)
Set the line color.
Definition TAttLine.h:44
virtual void SetMarkerColor(Color_t mcolor=1)
Set the marker color.
Definition TAttMarker.h:41
virtual void SetMarkerStyle(Style_t mstyle=1)
Set the marker style.
Definition TAttMarker.h:43
Double_t GetXmax() const
Definition TAxis.h:142
Double_t GetXmin() const
Definition TAxis.h:141
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:182
virtual void SetRange(Double_t xmin, Double_t xmax)
Initialize the upper and lower bounds to draw the function.
Definition TF1.cxx:3583
virtual void SetNpx(Int_t npx=100)
Set the number of points used to draw the function.
Definition TF1.cxx:3488
TObject * Clone(const char *newname=nullptr) const override
Make a complete copy of the underlying object.
Definition TF1.cxx:1071
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:2389
void Draw(Option_t *chopt="") override
Draw this graph with its current attributes.
Definition TGraph.cxx:859
void SetTitle(const char *title) override
Change/set the title.
Definition TH1.cxx:6932
@ kNoStats
Don't draw stats box.
Definition TH1.h:403
TAxis * GetXaxis()
Definition TH1.h:571
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:8778
virtual void SetMaximum(Double_t maximum=-1111)
Definition TH1.h:652
TAxis * GetYaxis()
Definition TH1.h:572
void Draw(Option_t *option="") override
Draw this histogram with options.
Definition TH1.cxx:3193
virtual void SetContour(Int_t nlevels, const Double_t *levels=nullptr)
Set the number and values of contour levels.
Definition TH1.cxx:8716
TObject * Clone(const char *newname="") const override
Make a complete copy of the underlying object.
Definition TH1.cxx:2882
virtual void SetStats(Bool_t stats=kTRUE)
Set statistics option on/off.
Definition TH1.cxx:9223
2-D histogram with a double per channel (see TH1 documentation)
Definition TH2.h:400
static TClass * Class()
2-D histogram with a float per channel (see TH1 documentation)
Definition TH2.h:345
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:173
const char * GetName() const override
Returns name of object.
Definition TNamed.h:49
const char * GetTitle() const override
Returns title of object.
Definition TNamed.h:50
An array of TObjects.
Definition TObjArray.h:31
TObject * At(Int_t idx) const override
Definition TObjArray.h:170
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:319
virtual TObject * FindObject(const char *name) const
Must be redefined in derived classes.
Definition TObject.cxx:425
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Definition TObject.cxx:888
virtual void Draw(Option_t *option="")
Default Draw method for all objects.
Definition TObject.cxx:293
The most important graphics class in the ROOT system.
Definition TPad.h:28
Basic string class.
Definition TString.h:138
Ssiz_t Length() const
Definition TString.h:427
void ToLower()
Change string to lower-case.
Definition TString.cxx:1189
const char * Data() const
Definition TString.h:386
TString & ReplaceAll(const TString &s1, const TString &s2)
Definition TString.h:715
TString & Append(const char *cs)
Definition TString.h:583
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:2459
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Definition TString.h:643
TVirtualPad is an abstract base class for the Pad and Canvas classes.
Definition TVirtualPad.h:51
RooCmdArg Precision(double prec)
RooCmdArg LineColor(TColorNumber color)
double chisquared_quantile(double z, double r)
Inverse ( ) of the cumulative distribution function of the lower tail of the distribution with degr...
TGraphErrors * gr
Definition legend1.C:25
TF1 * f1
Definition legend1.C:11
Namespace for the RooStats classes.
Definition CodegenImpl.h:66