59 LikelihoodIntervalPlot::LikelihoodIntervalPlot()
83 fInterval = theInterval;
85 fNdimPlot = fParamsPlot->
getSize();
103 LikelihoodIntervalPlot::~LikelihoodIntervalPlot()
111 fInterval = theInterval;
113 fNdimPlot = fParamsPlot->
getSize();
120 void LikelihoodIntervalPlot::SetPlotParameters(
const RooArgSet *params)
168 TIter it = fParamsPlot->createIterator();
170 RooArgSet* intervalParams = fInterval->GetParameters();
174 if (!intervalParams->
contains(*arg) ) {
176 <<
" - do not use for plotting " << std::endl;
178 extraParams.
add(*arg);
182 fParamsPlot->remove(extraParams,
true,
true);
186 <<
") ERROR: contours for more than 2 dimensions not implemented!" << std::endl;
194 RooAbsReal* oldProfile = fInterval->GetLikelihoodRatio();
195 if (fNdimPlot != intervalParams->
getSize() ) {
197 if (!profilell)
return;
202 newProfile = oldProfile;
209 if (fInterval->GetBestFitParameters() ) {
210 *fParamsPlot = *fInterval->GetBestFitParameters();
215 TString opt = options;
218 TString title = GetTitle();
219 int nPoints = fNPoints;
226 bool useRooPlot = opt.Contains(
"rooplot") || ! (opt.Contains(
"tf1"));
227 opt.ReplaceAll(
"rooplot",
"");
228 opt.ReplaceAll(
"tf1",
"");
234 if (nPoints <=0) nPoints = 100;
236 const Double_t xcont_min = fInterval->LowerLimit(*myparam);
237 const Double_t xcont_max = fInterval->UpperLimit(*myparam);
244 if (fColor == 0) fColor =
kBlue;
245 if (fLineColor == 0) fLineColor =
kGreen;
253 double xmin = std::max( x1, 2*xcont_min - xcont_max);
254 double xmax = std::min( x2, 2*xcont_max - xcont_min);
255 if (fXmin < fXmax) { xmin = fXmin; xmax = fXmax; }
257 TF1 * tmp = newProfile->
asTF(*myarg);
274 if (fMaximum > 0 && fXmin >= fXmax ) {
275 double x0 = f1->
GetX(0, xmin, xmax);
277 if ( x0 > x1 && x0 < x2) {
278 x1 = f1->
GetX(fMaximum, xmin, x0);
279 x2 = f1->
GetX(fMaximum, x0, xmax);
298 if (fXmin < fXmax) { xmin = fXmin; xmax = fXmax; }
302 int prevBins = myarg->
getBins();
306 frame = myarg->
frame(xmin,xmax,nPoints);
332 TLine *Yline_cutoff =
new TLine(x1,Yat_Xmax,x2,Yat_Xmax);
333 TLine *Yline_min =
new TLine(xcont_min,0.,xcont_min,Yat_Xmax);
334 TLine *Yline_max =
new TLine(xcont_max,0.,xcont_max,Yat_Xmax);
336 Yline_cutoff->SetLineColor(fLineColor);
342 Yline_cutoff->Draw();
360 else if(fNdimPlot == 2){
365 bool useMinuit = !opt.Contains(
"nominuit");
367 bool plotHist = !opt.Contains(
"nohist");
368 opt.ReplaceAll(
"nominuit",
"");
369 opt.ReplaceAll(
"nohist",
"");
370 if (opt.Contains(
"minuit") ) useMinuit=
true;
371 if (useMinuit) plotHist =
false;
372 if (opt.Contains(
"hist") ) plotHist=
true;
373 opt.ReplaceAll(
"minuit",
"");
374 opt.ReplaceAll(
"hist",
"");
379 cont_level = cont_level/2;
383 for (
int i = 0; i < params.getSize(); ++i) {
393 if (title.Length() == 0)
394 title = TString(
"Contour of ") + TString(myparamY->
GetName() ) + TString(
" vs ") + TString(myparam->
GetName() );
398 if (nPoints <=0) nPoints = 40;
402 if (fXmin < fXmax) { xmin = fXmin; xmax = fXmax; }
403 if (fYmin < fYmax) { ymin = fYmin; ymax = fYmax; }
406 if (!useMinuit || plotHist) {
412 int nBins = int(
std::sqrt(
double(nPoints)) + 0.5 );
413 TH2* hist2D =
new TH2D(histName, title, nBins, xmin, xmax, nBins, ymin, ymax );
422 const int nLevels = 51;
423 double contLevels[nLevels];
424 contLevels[0] = 0.01;
425 double maxVal = (fMaximum > 0) ? fMaximum : hist2D->
GetMaximum();
426 for (
int k = 1; k < nLevels; ++k) {
427 contLevels[k] = k*maxVal/double(nLevels-1);
439 const int nLevels = 8;
440 double contLevels[nLevels];
442 double confLevels[nLevels] = { 0.1,0.3,0.5,0.683,0.95,0.9973,0.9999366575,0.9999994267};
443 for (
int k = 0; k < nLevels; ++k) {
451 TString tmpOpt = opt;
452 tmpOpt.ReplaceAll(
"same",
"");
453 if (tmpOpt.Length() < 3) opt +=
"cont3";
455 if (plotHist) opt += TString(
" same");
456 hist2D->
Draw(opt.Data());
469 h->
Draw(
"CONT LIST");
484 if (tmpOpt.Contains(
"cont4")) {
499 null->
Range(x1-(x2-x1)*(lm/(1-rm-lm)),
500 y1-(y2-y1)*(bm/(1-tm-lm)),
501 x2+(x2-x1)*(rm/(1-rm-lm)),
502 y2+(y2-y1)*(tm/(1-tm-lm)));
509 int ncontours = contours->
GetSize();
510 for (
int icont = 0; icont < ncontours; ++icont) {
512 if (contourList && contourList->
GetSize() > 0) {
515 while( (gr = dynamic_cast<TGraph*>(itgr->
Next()) ) ){
532 <<
") ERROR: no contours found in ListOfSpecial" << std::endl;
535 fPlotObject = hist2D;
544 int ncp = fInterval->GetContourPoints(*myparam, *myparamY, gr->
GetX(), gr->
GetY(),nPoints);
546 if (
int(ncp) < nPoints) {
547 std::cout <<
"Warning - Less points calculated in contours np = " << ncp <<
" / " << nPoints << std::endl;
548 for (
int i = ncp; i < nPoints; ++i) gr->
RemovePoint(i);
552 if (!opt.Contains(
"c")) opt.Append(
"L");
554 if (!opt.Contains(
"same") && !plotHist) {
556 TH2F* hist2D =
new TH2F(
"_hist2D",title, nPoints, xmin, xmax, nPoints, ymin, ymax );
562 hist2D->
Draw(
"AXIS");
573 TString
name = TString(
"Graph_of_") + TString(fInterval->GetName());
576 if (!fPlotObject) fPlotObject =
gr;
577 else if (fPlotObject->IsA() !=
TH2D::Class() ) fPlotObject = gr;
582 const RooArgSet * bestFitParams = fInterval->GetBestFitParameters();
594 delete bestFitParams;
602 if (newProfile != oldProfile)
delete newProfile;
virtual Double_t getMin(const char *name=0) const
RooArgSet * getVariables(Bool_t stripDisconnected=kTRUE) const
Return RooArgSet with all variables (tree leaf nodes of expresssion tree)
virtual const char * GetName() const
Returns name of object.
std::string GetName(const std::string &scope_name)
virtual void SetLineWidth(Width_t lwidth)
Set the line width.
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...
virtual RooPlot * plotOn(RooPlot *frame, const RooCmdArg &arg1=RooCmdArg(), const RooCmdArg &arg2=RooCmdArg(), const RooCmdArg &arg3=RooCmdArg(), const RooCmdArg &arg4=RooCmdArg(), const RooCmdArg &arg5=RooCmdArg(), const RooCmdArg &arg6=RooCmdArg(), const RooCmdArg &arg7=RooCmdArg(), const RooCmdArg &arg8=RooCmdArg(), const RooCmdArg &arg9=RooCmdArg(), const RooCmdArg &arg10=RooCmdArg()) const
Plot (project) PDF on specified frame.
virtual void SetNpx(Int_t npx=100)
Set the number of points used to draw the function.
virtual Double_t getMax(const char *name=0) const
virtual Bool_t add(const RooAbsCollection &col, Bool_t silent=kFALSE)
Add a collection of arguments to this collection by calling add() for each element in the source coll...
virtual void SetMaximum(Double_t maximum=-1111)
virtual TObject * DrawClone(Option_t *option="") const
Draw a clone of this object in the current selected pad for instance with: gROOT->SetSelectedPad(gPad...
Class RooProfileLL implements the profile likelihood estimator for a given likelihood and set of para...
RooCmdArg LineColor(Color_t color)
LikelihoodInterval is a concrete implementation of the RooStats::ConfInterval interface.
void addObject(TObject *obj, Option_t *drawOptions="", Bool_t invisible=kFALSE)
Add a generic object to this plot.
Double_t getVal(const RooArgSet *set=0) const
virtual void SetContour(Int_t nlevels, const Double_t *levels=0)
Set the number and values of contour levels.
virtual void SetName(const char *name)
Set the name of the TNamed.
virtual void SetRange(Double_t xmin, Double_t xmax)
Initialize the upper and lower bounds to draw the function.
This class provides simple and straightforward utilities to plot a LikelihoodInterval object...
virtual RooArgSet * GetParameters() const
return a cloned list of parameters of interest. User manages the return object
TAxis * GetXaxis() const
Get x axis of the function.
virtual void Draw(Option_t *option="")
Draw this function with its current attributes.
virtual void Draw(Option_t *option="")
Default Draw method for all objects.
virtual void SetFillStyle(Style_t fstyle)
Set the fill area style.
void SetTitle(const char *name)
Set the title of the RooPlot to 'title'.
TObject * At(Int_t idx) const
virtual TObject * Clone(const char *newname="") const
Make a clone of an collection using the Streamer facility.
virtual void Draw(Option_t *chopt="")
Draw this graph with its current attributes.
Iterator abstract base class.
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
void SetFrameFillStyle(Style_t styl=0)
TAxis * GetYaxis() const
Get y axis of the function.
virtual void SetMinimum(Double_t minimum=-1111)
Set minimum value of Y axis.
TVirtualPad * cd(Int_t subpadnumber=0)
Set Current pad.
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...
virtual void SetMarkerColor(Color_t mcolor=1)
Set the marker color.
you should not use this method at all Int_t Int_t Double_t bm
void setBins(Int_t nBins, const char *name=0)
virtual Int_t RemovePoint()
Delete point close to the mouse position.
TVirtualPad is an abstract base class for the Pad and Canvas classes.
virtual void Draw(Option_t *option="")
Draw Pad in Current pad (re-parent pad if necessary).
virtual TIterator * MakeIterator(Bool_t dir=kIterForward) const
Return a list iterator.
virtual TObject * clone(const char *newname) const
RooRealVar represents a fundamental (non-derived) real valued object.
virtual void setVal(Double_t value)
Set value of variable to 'value'.
virtual void SetLineColor(Color_t lcolor)
Set the line color.
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.
Service class for 2-Dim histogram classes.
virtual void Draw(Option_t *option="")
Draw this histogram with options.
virtual void SetFillColor(Color_t fcolor)
Set the fill area color.
virtual void Range(Double_t x1, Double_t y1, Double_t x2, Double_t y2)
Set world coordinate system for the pad.
virtual void SetMaximum(Double_t maximum=-1111)
Set maximum value of Y axis.
tomato 2-D histogram with a float per channel (see TH1 documentation)}
The most important graphics class in the ROOT system.
char * Form(const char *fmt,...)
virtual void SetMarkerStyle(Style_t mstyle=1)
Set the marker style.
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
A RooPlot is a plot frame and a container for graphics objects within that frame. ...
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.
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...
Namespace for the RooStats classes.
static const double x1[5]
RooCmdArg Precision(Double_t prec)
RooAbsArg * find(const char *name) const
Find object with given name in list.
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
virtual void SetFillStyle(Style_t fstyle)
Override TAttFill::FillStyle for TPad because we want to handle style=0 as style 4000.
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).
THist< 2, double, THistStatContent, THistStatUncertainty > TH2D
virtual void SetLineStyle(Style_t lstyle)
Set the line style.
const char * GetName() const
Returns name of object.
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 TObject * Clone(const char *newname="") const
Make a clone of an object using the Streamer facility.
virtual void SetPoint(Int_t i, Double_t x, Double_t y)
Set x and y values for point number i.
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.
virtual RooAbsReal * createProfile(const RooArgSet ¶msOfInterest)
Create a RooProfileLL object that eliminates all nuisance parameters in the present function...
virtual TObject * Next()=0
A Graph is a graphics object made of two arrays X and Y with npoints each.
TObject * Clone(const char *newname=0) const
Make a complete copy of the underlying object.
virtual Int_t getBins(const char *name=0) const
virtual TH1 * GetHistogram() const
Return a pointer to the histogram used to visualise the function.
virtual void SetTitle(const char *title)
Change (i.e.
Bool_t contains(const RooAbsArg &var) const
RooAbsArg is the common abstract base class for objects that represent a value (of arbitrary type) an...
virtual Int_t GetSize() const
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
THist< 2, float, THistStatContent, THistStatUncertainty > TH2F
virtual void SetStats(Bool_t stats=kTRUE)
Set statistics option on/off.
double chisquared_quantile(double z, double r)
Inverse ( ) of the cumulative distribution function of the lower tail of the distribution with degr...
virtual void Draw(Option_t *options=0)
Draw this plot and all of the elements it contains.
RooCmdArg is a named container for two doubles, two integers two object points and three string point...