125 const char* title,
bool scale)
131 coutE(InputArguments) <<
"MCMCIntervalPlot::DrawPosteriorHist: "
132 <<
"Couldn't get posterior histogram." << std::endl;
169 coutE(InputArguments) <<
"MCMCIntervalPlot::DrawPosteriorKeysPdf: "
170 <<
"Couldn't get posterior Keys PDF." << std::endl;
175 bool isEmpty = (title.CompareTo(
"") == 0);
180 if (frame ==
nullptr) {
181 coutE(InputArguments) <<
"MCMCIntervalPlot::DrawPosteriorKeysPdf: "
182 <<
"Invalid parameter" << std::endl;
186 frame->
SetTitle((
"Posterior Keys PDF for " + std::string(
v->GetName())).c_str());
203 Form(
"MCMC histogram of posterior Keys PDF for %s, %s",
209 keysHist->
Draw(options);
228 coutE(InputArguments) <<
"MCMCIntervalPlot::DrawInterval(): " <<
229 "Interval type not supported" << std::endl;
250 bool isEmpty = (title.CompareTo(
"") == 0);
263 double ul =
fInterval->UpperLimitByKeys(*p);
264 double ll =
fInterval->LowerLimitByKeys(*p);
289 frame->
Draw(options);
298 llLine->
Draw(options);
299 ulLine->
Draw(options);
305 coutE(InputArguments) <<
"MCMCIntervalPlot::DrawKeysPdfInterval: "
306 <<
"Couldn't get posterior Keys PDF." << std::endl;
331 double cutoff =
fInterval->GetKeysPdfCutoff();
338 coutE(InputArguments) <<
"MCMCIntervalPlot::DrawKeysPdfInterval: "
339 <<
" Sorry: " <<
fDimension <<
"-D plots not currently supported" << std::endl;
348 bool isEmpty = (title.CompareTo(
"") == 0);
353 double ul =
fInterval->UpperLimitByHist(*p);
354 double ll =
fInterval->LowerLimitByHist(*p);
360 if (hist ==
nullptr)
return;
369 double histCutoff =
fInterval->GetHistCutoff();
374 for (i = 1; i <= nBins; i++) {
377 if (height < histCutoff) {
390 copy->
Draw(
"HIST SAME");
400 llLine->
Draw(options);
401 ulLine->
Draw(options);
408 coutE(InputArguments) <<
"MCMCIntervalPlot::DrawHistInterval: "
409 <<
"Couldn't get posterior histogram." << std::endl;
432 double cutoff =
fInterval->GetHistCutoff();
438 coutE(InputArguments) <<
"MCMCIntervalPlot::DrawHistInterval: "
439 <<
" Sorry: " <<
fDimension <<
"-D plots not currently supported" << std::endl;
448 bool isEmpty = (title.CompareTo(
"") == 0);
454 double ul =
fInterval->UpperLimitTailFraction(*p);
455 double ll =
fInterval->LowerLimitTailFraction(*p);
458 if (hist ==
nullptr)
return;
472 for (i = 1; i <= nBins; i++) {
475 if (center < ll || center > ul) {
487 copy->
Draw(
"hist same");
496 llLine->
Draw(options);
497 ulLine->
Draw(options);
499 coutE(InputArguments) <<
"MCMCIntervalPlot::DrawTailFractionInterval: "
500 <<
" Sorry: " <<
fDimension <<
"-D plots not currently supported"
513 coutE(InputArguments) <<
"MCMCIntervalPlot::DrawPosteriorKeysProduct: "
514 <<
"Couldn't get posterior Keys product." << std::endl;
521 bool isEmpty = (title.CompareTo(
"") == 0);
525 if (!frame)
return nullptr;
527 frame->
SetTitle(
Form(
"Posterior Keys PDF * Heaviside product for %s",
535 frame->
Draw(options);
544 Form(
"MCMC Posterior Keys Product Hist. for %s, %s",
549 productHist->
Draw(options);
565 burnInSteps =
fInterval->GetNumBurnInSteps();
570 double*
x =
new double[
size - burnInSteps];
571 double*
y =
new double[
size - burnInSteps];
572 double* burnInX =
nullptr;
573 double* burnInY =
nullptr;
574 if (burnInSteps > 0) {
575 burnInX =
new double[burnInSteps];
576 burnInY =
new double[burnInSteps];
581 for (
Int_t i = burnInSteps; i <
size; i++) {
586 for (
Int_t i = 0; i < burnInSteps; i++) {
595 bool isEmpty = (title.CompareTo(
"") == 0);
599 walk->
SetTitle(
Form(
"2-D Scatter Plot of Markov chain for %s, %s",
612 walk->
Draw(
"A,L,P,same");
615 if (burnInX !=
nullptr && burnInY !=
nullptr) {
616 burnIn =
new TGraph(burnInSteps - 1, burnInX, burnInY);
620 burnIn->
Draw(
"L,P,same");
628 first->
Draw(
"L,P,same");
633 if (burnInX !=
nullptr)
delete [] burnInX;
634 if (burnInY !=
nullptr)
delete [] burnInY;
647 double* value =
new double[numEntries];
648 double* time =
new double[numEntries];
656 value[2*i + 1] = val;
663 bool isEmpty = (title.CompareTo(
"") == 0);
665 TGraph* paramGraph =
new TGraph(numEntries, time, value);
674 paramGraph->
Draw(
"A,L,same");
687 double* nllValue =
new double[numEntries];
688 double* time =
new double[numEntries];
693 nll = markovChain->
NLL(i);
696 nllValue[2*i + 1] = nll;
703 bool isEmpty = (title.CompareTo(
"") == 0);
705 TGraph* nllGraph =
new TGraph(numEntries, time, nllValue);
707 nllGraph->
SetTitle(
"NLL value vs. time in Markov chain");
714 nllGraph->
Draw(
"A,L,same");
730 if (markovChain->
NLL(i) > maxNLL)
731 maxNLL = markovChain->
NLL(i);
734 fNLLHist =
new TH1F(
"mcmc_nll_hist",
"MCMC NLL Histogram",
737 bool isEmpty = (title.CompareTo(
"") == 0);
740 fNLLHist->GetXaxis()->SetTitle(
"-log(likelihood)");
754 double maxWeight = 0;
757 if (markovChain->
Weight(i) > maxWeight)
758 maxWeight = markovChain->
Weight(i);
761 (
Int_t)(maxWeight + 1), 0, maxWeight * 1.02);
770 // 3-d plot of the parameter points
772 // also plot the points in the markov chain
773 RooDataSet* markovChainData = ((MCMCInterval*)mcmcint)->GetChainAsDataSet();
775 TTree& chain = ((RooTreeDataStore*) markovChainData->store())->tree();
776 chain.SetMarkerStyle(6);
777 chain.SetMarkerColor(kRed);
778 chain.Draw("s:ratioSigEff:ratioBkgEff","","box"); // 3-d box proportional to posterior
780 // the points used in the profile construction
781 TTree& parameterScan = ((RooTreeDataStore*) fc.GetPointsToScan()->store())->tree();
782 parameterScan.SetMarkerStyle(24);
783 parameterScan.Draw("s:ratioSigEff:ratioBkgEff","","same");
785 chain.SetMarkerStyle(6);
786 chain.SetMarkerColor(kRed);
787 //chain.Draw("s:ratioSigEff:ratioBkgEff", "_MarkovChain_local_nll","box");
788 //chain.Draw("_MarkovChain_local_nll");
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
int Int_t
Signed integer 4 bytes (int).
const char Option_t
Option string (const char).
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.
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.
void Draw(Option_t *chopt="") override
Default Draw method for all objects.
void SetTitle(const char *title="") override
Set the title of the TNamed.
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 FillColor(TColorNumber color)
RooCmdArg DrawOption(const char *opt)
RooCmdArg Range(const char *rangeName, bool adjustNorm=true)
RooCmdArg Normalization(double scaleFactor)
Namespace for the RooStats classes.