126 const char* title,
bool scale)
132 coutE(InputArguments) <<
"MCMCIntervalPlot::DrawPosteriorHist: "
133 <<
"Couldn't get posterior histogram." << endl;
170 coutE(InputArguments) <<
"MCMCIntervalPlot::DrawPosteriorKeysPdf: "
171 <<
"Couldn't get posterior Keys PDF." << endl;
176 bool isEmpty = (title.
CompareTo(
"") == 0);
181 if (frame ==
nullptr) {
182 coutE(InputArguments) <<
"MCMCIntervalPlot::DrawPosteriorKeysPdf: "
183 <<
"Invalid parameter" << endl;
187 frame->
SetTitle((
"Posterior Keys PDF for " + std::string(
v->GetName())).c_str());
204 Form(
"MCMC histogram of posterior Keys PDF for %s, %s",
210 keysHist->
Draw(options);
229 coutE(InputArguments) <<
"MCMCIntervalPlot::DrawInterval(): " <<
230 "Interval type not supported" << endl;
251 bool isEmpty = (title.
CompareTo(
"") == 0);
264 double ul =
fInterval->UpperLimitByKeys(*p);
265 double ll =
fInterval->LowerLimitByKeys(*p);
290 frame->
Draw(options);
299 llLine->
Draw(options);
300 ulLine->
Draw(options);
306 coutE(InputArguments) <<
"MCMCIntervalPlot::DrawKeysPdfInterval: "
307 <<
"Couldn't get posterior Keys PDF." << endl;
332 double cutoff =
fInterval->GetKeysPdfCutoff();
339 coutE(InputArguments) <<
"MCMCIntervalPlot::DrawKeysPdfInterval: "
340 <<
" Sorry: " <<
fDimension <<
"-D plots not currently supported" << endl;
349 bool isEmpty = (title.
CompareTo(
"") == 0);
354 double ul =
fInterval->UpperLimitByHist(*p);
355 double ll =
fInterval->LowerLimitByHist(*p);
361 if (hist ==
nullptr)
return;
370 double histCutoff =
fInterval->GetHistCutoff();
375 for (
i = 1;
i <= nBins;
i++) {
378 if (
height < histCutoff) {
391 copy->
Draw(
"HIST SAME");
401 llLine->
Draw(options);
402 ulLine->
Draw(options);
409 coutE(InputArguments) <<
"MCMCIntervalPlot::DrawHistInterval: "
410 <<
"Couldn't get posterior histogram." << endl;
433 double cutoff =
fInterval->GetHistCutoff();
439 coutE(InputArguments) <<
"MCMCIntervalPlot::DrawHistInterval: "
440 <<
" Sorry: " <<
fDimension <<
"-D plots not currently supported" << endl;
449 bool isEmpty = (title.
CompareTo(
"") == 0);
455 double ul =
fInterval->UpperLimitTailFraction(*p);
456 double ll =
fInterval->LowerLimitTailFraction(*p);
459 if (hist ==
nullptr)
return;
473 for (
i = 1;
i <= nBins;
i++) {
476 if (center < ll || center > ul) {
488 copy->
Draw(
"hist same");
497 llLine->
Draw(options);
498 ulLine->
Draw(options);
500 coutE(InputArguments) <<
"MCMCIntervalPlot::DrawTailFractionInterval: "
501 <<
" Sorry: " <<
fDimension <<
"-D plots not currently supported"
514 coutE(InputArguments) <<
"MCMCIntervalPlot::DrawPosteriorKeysProduct: "
515 <<
"Couldn't get posterior Keys product." << endl;
522 bool isEmpty = (title.
CompareTo(
"") == 0);
526 if (!frame)
return nullptr;
528 frame->
SetTitle(
Form(
"Posterior Keys PDF * Heaviside product for %s",
536 frame->
Draw(options);
545 Form(
"MCMC Posterior Keys Product Hist. for %s, %s",
550 productHist->
Draw(options);
566 burnInSteps =
fInterval->GetNumBurnInSteps();
571 double*
x =
new double[
size - burnInSteps];
572 double*
y =
new double[
size - burnInSteps];
573 double* burnInX =
nullptr;
574 double* burnInY =
nullptr;
575 if (burnInSteps > 0) {
576 burnInX =
new double[burnInSteps];
577 burnInY =
new double[burnInSteps];
587 for (
Int_t i = 0;
i < burnInSteps;
i++) {
596 bool isEmpty = (title.
CompareTo(
"") == 0);
600 walk->
SetTitle(
Form(
"2-D Scatter Plot of Markov chain for %s, %s",
613 walk->
Draw(
"A,L,P,same");
616 if (burnInX !=
nullptr && burnInY !=
nullptr) {
617 burnIn =
new TGraph(burnInSteps - 1, burnInX, burnInY);
621 burnIn->
Draw(
"L,P,same");
629 first->
Draw(
"L,P,same");
634 if (burnInX !=
nullptr)
delete [] burnInX;
635 if (burnInY !=
nullptr)
delete [] burnInY;
648 double*
value =
new double[numEntries];
649 double* time =
new double[numEntries];
664 bool isEmpty = (title.
CompareTo(
"") == 0);
675 paramGraph->
Draw(
"A,L,same");
688 double* nllValue =
new double[numEntries];
689 double* time =
new double[numEntries];
694 nll = markovChain->
NLL(
i);
697 nllValue[2*
i + 1] = nll;
704 bool isEmpty = (title.
CompareTo(
"") == 0);
706 TGraph* nllGraph =
new TGraph(numEntries, time, nllValue);
708 nllGraph->
SetTitle(
"NLL value vs. time in Markov chain");
715 nllGraph->
Draw(
"A,L,same");
731 if (markovChain->
NLL(
i) > maxNLL)
732 maxNLL = markovChain->
NLL(
i);
735 fNLLHist =
new TH1F(
"mcmc_nll_hist",
"MCMC NLL Histogram",
738 bool isEmpty = (title.
CompareTo(
"") == 0);
741 fNLLHist->GetXaxis()->SetTitle(
"-log(likelihood)");
755 double maxWeight = 0;
758 if (markovChain->
Weight(
i) > maxWeight)
759 maxWeight = markovChain->
Weight(
i);
762 (
Int_t)(maxWeight + 1), 0, maxWeight * 1.02);
771 // 3-d plot of the parameter points
773 // also plot the points in the markov chain
774 RooDataSet* markovChainData = ((MCMCInterval*)mcmcint)->GetChainAsDataSet();
776 TTree& chain = ((RooTreeDataStore*) markovChainData->store())->tree();
777 chain.SetMarkerStyle(6);
778 chain.SetMarkerColor(kRed);
779 chain.Draw("s:ratioSigEff:ratioBkgEff","","box"); // 3-d box proportional to posterior
781 // the points used in the profile construction
782 TTree& parameterScan = ((RooTreeDataStore*) fc.GetPointsToScan()->store())->tree();
783 parameterScan.SetMarkerStyle(24);
784 parameterScan.Draw("s:ratioSigEff:ratioBkgEff","","same");
786 chain.SetMarkerStyle(6);
787 chain.SetMarkerColor(kRed);
788 //chain.Draw("s:ratioSigEff:ratioBkgEff", "_MarkovChain_local_nll","box");
789 //chain.Draw("_MarkovChain_local_nll");
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
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.
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.
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.
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.
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)
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.
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 SetMarkerSize(Size_t msize=1)
Set the marker size.
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...
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 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 DrawOption(const char *opt)
RooCmdArg Range(const char *rangeName, bool adjustNorm=true)
RooCmdArg FillColor(Color_t color)
RooCmdArg Normalization(double scaleFactor)
Namespace for the RooStats classes.