164 const char* title,
bool scale)
170 coutE(InputArguments) <<
"MCMCIntervalPlot::DrawPosteriorHist: "
171 <<
"Couldn't get posterior histogram." << endl;
208 coutE(InputArguments) <<
"MCMCIntervalPlot::DrawPosteriorKeysPdf: "
209 <<
"Couldn't get posterior Keys PDF." << endl;
214 bool isEmpty = (title.
CompareTo(
"") == 0);
219 if (frame ==
nullptr) {
220 coutE(InputArguments) <<
"MCMCIntervalPlot::DrawPosteriorKeysPdf: "
221 <<
"Invalid parameter" << endl;
225 frame->
SetTitle((
"Posterior Keys PDF for " + std::string(
v->GetName())).c_str());
241 Form(
"MCMC histogram of posterior Keys PDF for %s, %s",
246 keysHist->
Draw(options);
265 coutE(InputArguments) <<
"MCMCIntervalPlot::DrawInterval(): " <<
266 "Interval type not supported" << endl;
286 bool isEmpty = (title.
CompareTo(
"") == 0);
324 frame->
Draw(options);
333 llLine->
Draw(options);
334 ulLine->
Draw(options);
340 coutE(InputArguments) <<
"MCMCIntervalPlot::DrawKeysPdfInterval: "
341 <<
"Couldn't get posterior Keys PDF." << endl;
372 coutE(InputArguments) <<
"MCMCIntervalPlot::DrawKeysPdfInterval: "
373 <<
" Sorry: " <<
fDimension <<
"-D plots not currently supported" << endl;
382 bool isEmpty = (title.
CompareTo(
"") == 0);
394 if (hist ==
nullptr)
return;
407 for (i = 1; i <= nBins; i++) {
410 if (
height < histCutoff) {
423 copy->
Draw(
"HIST SAME");
433 llLine->
Draw(options);
434 ulLine->
Draw(options);
441 coutE(InputArguments) <<
"MCMCIntervalPlot::DrawHistInterval: "
442 <<
"Couldn't get posterior histogram." << endl;
470 coutE(InputArguments) <<
"MCMCIntervalPlot::DrawHistInterval: "
471 <<
" Sorry: " <<
fDimension <<
"-D plots not currently supported" << endl;
480 bool isEmpty = (title.
CompareTo(
"") == 0);
490 if (hist ==
nullptr)
return;
503 for (i = 1; i <= nBins; i++) {
506 if (center < ll || center > ul) {
518 copy->
Draw(
"hist same");
527 llLine->
Draw(options);
528 ulLine->
Draw(options);
530 coutE(InputArguments) <<
"MCMCIntervalPlot::DrawTailFractionInterval: "
531 <<
" Sorry: " <<
fDimension <<
"-D plots not currently supported"
544 coutE(InputArguments) <<
"MCMCIntervalPlot::DrawPosteriorKeysProduct: "
545 <<
"Couldn't get posterior Keys product." << endl;
552 bool isEmpty = (title.
CompareTo(
"") == 0);
556 if (!frame)
return nullptr;
558 frame->
SetTitle(
Form(
"Posterior Keys PDF * Heaviside product for %s",
565 frame->
Draw(options);
574 Form(
"MCMC Posterior Keys Product Hist. for %s, %s",
578 productHist->
Draw(options);
598 double*
x =
new double[
size - burnInSteps];
599 double*
y =
new double[
size - burnInSteps];
600 double* burnInX =
nullptr;
601 double* burnInY =
nullptr;
602 if (burnInSteps > 0) {
603 burnInX =
new double[burnInSteps];
604 burnInY =
new double[burnInSteps];
609 for (
Int_t i = burnInSteps; i <
size; i++) {
614 for (
Int_t i = 0; i < burnInSteps; i++) {
623 bool isEmpty = (title.
CompareTo(
"") == 0);
627 walk->
SetTitle(
Form(
"2-D Scatter Plot of Markov chain for %s, %s",
639 walk->
Draw(
"A,L,P,same");
642 if (burnInX !=
nullptr && burnInY !=
nullptr) {
643 burnIn =
new TGraph(burnInSteps - 1, burnInX, burnInY);
647 burnIn->
Draw(
"L,P,same");
652 first->SetMarkerStyle(3);
653 first->SetMarkerSize(2);
655 first->Draw(
"L,P,same");
660 if (burnInX !=
nullptr)
delete [] burnInX;
661 if (burnInY !=
nullptr)
delete [] burnInY;
674 double*
value =
new double[numEntries];
675 double* time =
new double[numEntries];
683 value[2*i + 1] = val;
690 bool isEmpty = (title.
CompareTo(
"") == 0);
700 paramGraph->
Draw(
"A,L,same");
713 double* nllValue =
new double[numEntries];
714 double* time =
new double[numEntries];
719 nll = markovChain->
NLL(i);
722 nllValue[2*i + 1] = nll;
729 bool isEmpty = (title.
CompareTo(
"") == 0);
731 TGraph* nllGraph =
new TGraph(numEntries, time, nllValue);
733 nllGraph->
SetTitle(
"NLL value vs. time in Markov chain");
739 nllGraph->
Draw(
"A,L,same");
755 if (markovChain->
NLL(i) > maxNLL)
756 maxNLL = markovChain->
NLL(i);
758 fNLLHist =
new TH1F(
"mcmc_nll_hist",
"MCMC NLL Histogram",
761 bool isEmpty = (title.
CompareTo(
"") == 0);
778 double maxWeight = 0;
781 if (markovChain->
Weight(i) > maxWeight)
782 maxWeight = markovChain->
Weight(i);
784 (
Int_t)(maxWeight + 1), 0, maxWeight * 1.02);
793 // 3-d plot of the parameter points
795 // also plot the points in the markov chain
796 RooDataSet* markovChainData = ((MCMCInterval*)mcmcint)->GetChainAsDataSet();
798 TTree& chain = ((RooTreeDataStore*) markovChainData->store())->tree();
799 chain.SetMarkerStyle(6);
800 chain.SetMarkerColor(kRed);
801 chain.Draw("s:ratioSigEff:ratioBkgEff","","box"); // 3-d box proportional to posterior
803 // the points used in the profile construction
804 TTree& parameterScan = ((RooTreeDataStore*) fc.GetPointsToScan()->store())->tree();
805 parameterScan.SetMarkerStyle(24);
806 parameterScan.Draw("s:ratioSigEff:ratioBkgEff","","same");
808 chain.SetMarkerStyle(6);
809 chain.SetMarkerColor(kRed);
810 //chain.Draw("s:ratioSigEff:ratioBkgEff", "_MarkovChain_local_nll","box");
811 //chain.Draw("_MarkovChain_local_nll");
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t height
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
double getRealValue(const char *name, double defVal=0.0, bool verbose=false) const
Get value of a RooAbsReal stored in set with given name.
RooAbsArg * first() const
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 override
Helper calling plotOn(RooPlot*, RooLinkedList&) const.
Int_t numBins(const char *rangeName=nullptr) const override
virtual Int_t getBins(const char *name=nullptr) const
Get number of bins of currently defined range.
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.
TH1 * createHistogram(RooStringView varNameList, Int_t xbins=0, Int_t ybins=0, Int_t zbins=0) const
Create and fill a ROOT histogram TH1, TH2 or TH3 with the values of this function for the variables w...
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.
RooAbsArg * at(Int_t idx) const
Return object at given index, or nullptr if index is out of range.
A RooPlot is a plot frame and a container for graphics objects within that frame.
static RooPlot * frame(const RooAbsRealLValue &var, double xmin, double xmax, Int_t nBins)
Create a new frame for a given variable in x.
void SetTitle(const char *name) override
Set the title of the RooPlot to 'title'.
void Draw(Option_t *options=nullptr) override
Draw this plot and all of the elements it contains.
RooRealVar represents a variable that can be changed from the outside.
This class provides simple and straightforward utilities to plot a MCMCInterval object.
void DrawNLLHist(const Option_t *options=nullptr)
void Draw(const Option_t *options=nullptr) override
void * DrawPosteriorHist(const Option_t *options=nullptr, const char *title=nullptr, bool scale=true)
RooProduct * fPosteriorKeysProduct
void DrawChainScatter(RooRealVar &xVar, RooRealVar &yVar)
TH1 * fPosteriorHistTFCopy
void DrawTailFractionInterval(const Option_t *options=nullptr)
TH1 * fPosteriorHistHistCopy
void SetMCMCInterval(MCMCInterval &interval)
~MCMCIntervalPlot() override
Destructor of SamplingDistribution.
void DrawPosterior(const Option_t *options=nullptr)
void DrawHistInterval(const Option_t *options=nullptr)
void * DrawPosteriorKeysProduct(const Option_t *options=nullptr)
void DrawWeightHist(const Option_t *options=nullptr)
void DrawInterval(const Option_t *options=nullptr)
void DrawParameterVsTime(RooRealVar ¶m)
void * DrawPosteriorKeysPdf(const Option_t *options=nullptr)
void DrawShortestInterval(const Option_t *options=nullptr)
void DrawKeysPdfInterval(const Option_t *options=nullptr)
RooNDKeysPdf * fPosteriorKeysPdf
MCMCInterval is a concrete implementation of the RooStats::ConfInterval interface.
virtual bool GetUseKeys()
get whether we used kernel estimation to determine the interval
virtual enum IntervalType GetIntervalType()
Return the type of this interval.
double GetKeysMax()
Determine the approximate maximum value of the Keys PDF.
virtual double LowerLimitTailFraction(RooRealVar ¶m)
determine lower limit of the lower confidence interval
virtual TH1 * GetPosteriorHist()
set the number of bins to use (same for all axes, for now) virtual void SetNumBins(Int_t numBins);
virtual RooArgList * GetAxes()
return a list of RooRealVars representing the axes you own the returned RooArgList
virtual Int_t GetNumBurnInSteps()
get the number of steps in the chain to discard as burn-in,
virtual RooRealVar * GetNLLVar() const
Get a clone of the NLL variable from the markov chain.
virtual const MarkovChain * GetChain()
Get the markov chain on which this interval is based You do not own the returned MarkovChain*.
virtual double LowerLimitByHist(RooRealVar ¶m)
determine lower limit using histogram
virtual double LowerLimitByKeys(RooRealVar ¶m)
determine lower limit in the shortest interval by using keys pdf
virtual RooProduct * GetPosteriorKeysProduct()
Get a clone of the (keyspdf * heaviside) product of the posterior.
RooArgSet * GetParameters() const override
return a set containing the parameters of this interval the caller owns the returned RooArgSet*
virtual double UpperLimitTailFraction(RooRealVar ¶m)
determine upper limit of the lower confidence interval
virtual RooNDKeysPdf * GetPosteriorKeysPdf()
Get a clone of the keys pdf of the posterior.
virtual double UpperLimitByHist(RooRealVar ¶m)
determine upper limit using histogram
virtual double UpperLimitByKeys(RooRealVar ¶m)
determine upper limit in the shortest interval by using keys pdf
virtual Int_t GetDimension() const
Get the number of parameters of interest in this interval.
virtual double GetKeysPdfCutoff()
get the cutoff RooNDKeysPdf value for being considered in the confidence interval
virtual double GetHistCutoff()
get the cutoff bin height for being considered in the confidence interval
Stores the steps in a Markov Chain of points.
virtual double NLL(Int_t i) const
get the NLL value of entry at position i
virtual const RooArgSet * Get(Int_t i) const
get the entry at position i
virtual double Weight() const
get the weight of the current (last indexed) entry
virtual Int_t Size() const
get the number of steps in the chain
virtual void SetFillColor(Color_t fcolor)
Set the fill area color.
virtual void SetFillStyle(Style_t fstyle)
Set the fill area style.
virtual void SetLineWidth(Width_t lwidth)
Set the line width.
virtual void SetLineColor(Color_t lcolor)
Set the line color.
virtual void SetMarkerColor(Color_t mcolor=1)
Set the marker color.
virtual void SetMarkerStyle(Style_t mstyle=1)
Set the marker style.
virtual void Set(Int_t nbins, Double_t xmin, Double_t xmax)
Initialize axis with fix bins.
A TGraph is an object made of two arrays X and Y with npoints each.
void Draw(Option_t *chopt="") override
Draw this graph with its current attributes.
TAxis * GetXaxis() const
Get x axis of the graph.
TAxis * GetYaxis() const
Get y axis of the graph.
void SetTitle(const char *title="") override
Change (i.e.
1-D histogram with a float per channel (see TH1 documentation)}
virtual Double_t GetBinCenter(Int_t bin) const
Return bin center for 1D histogram.
void SetTitle(const char *title) override
Change/set the title.
virtual Int_t GetNbinsX() const
virtual void SetBinError(Int_t bin, Double_t error)
Set the bin Error Note that this resets the bin eror option to be of Normal Type and for the non-empt...
virtual Int_t Fill(Double_t x)
Increment bin with abscissa X by 1.
void Draw(Option_t *option="") override
Draw this histogram with options.
virtual void SetBinContent(Int_t bin, Double_t content)
Set bin content see convention for numbering bins in TH1::GetBin In case the bin number is greater th...
virtual Int_t GetMaximumBin() const
Return location of bin with maximum value in the range.
virtual Double_t GetBinContent(Int_t bin) const
Return content of bin number bin.
virtual void SetContour(Int_t nlevels, const Double_t *levels=nullptr)
Set the number and values of contour levels.
virtual void Scale(Double_t c1=1, Option_t *option="")
Multiply this histogram by a constant c1.
TObject * Clone(const char *newname="") const override
Make a complete copy of the underlying object.
virtual void SetStats(Bool_t stats=kTRUE)
Set statistics option on/off.
2-D histogram with a float per channel (see TH1 documentation)}
Use the TLine constructor to create a simple line.
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
const char * GetName() const override
Returns name of object.
const char * GetTitle() const override
Returns title of object.
virtual const char * GetName() const
Returns name of object.
virtual void Draw(Option_t *option="")
Default Draw method for all objects.
int CompareTo(const char *cs, ECaseCompare cmp=kExact) const
Compare a string to char *cs2.
const char * Data() const
TString & Append(const char *cs)
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
RooCmdArg YVar(const RooAbsRealLValue &var, const RooCmdArg &arg={})
RooCmdArg Scaling(bool flag)
RooCmdArg FillColor(Color_t color)
RooCmdArg DrawOption(const char *opt)
RooCmdArg Range(const char *rangeName, bool adjustNorm=true)
RooCmdArg Normalization(double scaleFactor)
Namespace for the RooStats classes.