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