![]() |
MaCh3 2.2.1
Reference Guide
|
Class responsible for processing MCMC chains, performing diagnostics, generating plots, and managing Bayesian analysis. More...
#include <Fitters/MCMCProcessor.h>
Public Member Functions | |
MCMCProcessor (const std::string &InputFile) | |
Constructs an MCMCProcessor object with the specified input file and options. | |
virtual | ~MCMCProcessor () |
Destroys the MCMCProcessor object. | |
void | Initialise () |
Scan chain, what parameters we have and load information from covariance matrices. | |
void | MakePostfit () |
Make 1D projection for each parameter and prepare structure. | |
void | MakeCovariance () |
Calculate covariance by making 2D projection of each combination of parameters. | |
void | CacheSteps () |
KS:By caching each step we use multithreading. | |
void | MakeCovariance_MP (const bool Mute=false) |
Calculate covariance by making 2D projection of each combination of parameters using multithreading. | |
void | MakeSubOptimality (const int NIntervals=10) |
Make and Draw SubOptimality [24]. | |
void | ResetHistograms () |
Reset 2D posteriors, in case we would like to calculate in again with different BurnInCut. | |
void | DrawPostfit () |
Draw the post-fit comparisons. | |
void | MakeViolin () |
Make and Draw Violin. | |
void | MakeCredibleIntervals (const std::vector< double > &CredibleIntervals={0.99, 0.90, 0.68 }, const std::vector< Color_t > &CredibleIntervalsColours={kCyan+4, kCyan-2, kCyan-10}, const bool CredibleInSigmas=false) |
Make and Draw Credible intervals. | |
void | DrawCovariance () |
Draw the post-fit covariances. | |
void | MakeCredibleRegions (const std::vector< double > &CredibleRegions={0.99, 0.90, 0.68}, const std::vector< Style_t > &CredibleRegionStyle={kDashed, kSolid, kDotted}, const std::vector< Color_t > &CredibleRegionColor={kGreen-3, kGreen-10, kGreen}, const bool CredibleInSigmas=false, const bool Draw2DPosterior=true, const bool DrawBestFit=true) |
Make and Draw Credible Regions. | |
void | MakeTrianglePlot (const std::vector< std::string > &ParNames, const std::vector< double > &CredibleIntervals={0.99, 0.90, 0.68 }, const std::vector< Color_t > &CredibleIntervalsColours={kCyan+4, kCyan-2, kCyan-10}, const std::vector< double > &CredibleRegions={0.99, 0.90, 0.68}, const std::vector< Style_t > &CredibleRegionStyle={kDashed, kSolid, kDotted}, const std::vector< Color_t > &CredibleRegionColor={kGreen-3, kGreen-10, kGreen}, const bool CredibleInSigmas=false) |
Make fancy triangle plot for selected parameters. | |
void | CheckCredibleIntervalsOrder (const std::vector< double > &CredibleIntervals, const std::vector< Color_t > &CredibleIntervalsColours) |
Checks the order and size consistency of the CredibleIntervals and CredibleIntervalsColours vectors. | |
void | CheckCredibleRegionsOrder (const std::vector< double > &CredibleRegions, const std::vector< Style_t > &CredibleRegionStyle, const std::vector< Color_t > &CredibleRegionColor) |
Checks the order and size consistency of the CredibleRegions , CredibleRegionStyle , and CredibleRegionColor vectors. | |
void | GetPolarPlot (const std::vector< std::string > &ParNames) |
Make funny polar plot. | |
void | GetBayesFactor (const std::vector< std::string > &ParName, const std::vector< std::vector< double > > &Model1Bounds, const std::vector< std::vector< double > > &Model2Bounds, const std::vector< std::vector< std::string > > &ModelNames) |
Calculate Bayes factor for vector of params, and model boundaries. | |
void | GetSavageDickey (const std::vector< std::string > &ParName, const std::vector< double > &EvaluationPoint, const std::vector< std::vector< double > > &Bounds) |
Calculate Bayes factor for point like hypothesis using SavageDickey. | |
void | ReweightPrior (const std::vector< std::string > &Names, const std::vector< double > &NewCentral, const std::vector< double > &NewError) |
Reweight Prior by giving new central value and new error. | |
void | ParameterEvolution (const std::vector< std::string > &Names, const std::vector< int > &NIntervals) |
Make .gif of parameter evolution. | |
void | ThinMCMC (const int ThinningCut) |
Thin MCMC Chain, to save space and maintain low autocorrelations. | |
void | DiagMCMC () |
KS: Perform MCMC diagnostic including Autocorrelation, Trace etc. | |
int | GetNParams () |
Get total number of used parameters. | |
int | GetNXSec () |
int | GetNND () |
int | GetNFD () |
int | GetGroup (const std::string &name) const |
Number of params from a given group, for example flux. | |
TH1D * | GetHpost (const int i) |
Get 1D posterior for a given parameter. | |
TH2D * | GetHpost2D (const int i, const int j) |
Get 2D posterior for a given parameter combination. | |
TH2D * | GetViolin () |
Get Violin plot for all parameters with posterior values. | |
TH2D * | GetViolinPrior () |
Get Violin plot for all parameters with prior values. | |
std::vector< std::string > | GetXSecCov () const |
std::string | GetNDCov () const |
std::string | GetFDCov () const |
void | GetPostfit (TVectorD *&Central, TVectorD *&Errors, TVectorD *&Central_Gauss, TVectorD *&Errors_Gauss, TVectorD *&Peaks) |
Get the post-fit results (arithmetic and Gaussian) | |
void | GetCovariance (TMatrixDSym *&Cov, TMatrixDSym *&Corr) |
Get the post-fit covariances and correlations. | |
void | GetPostfit_Ind (TVectorD *&Central, TVectorD *&Errors, TVectorD *&Peaks, ParameterEnum kParam) |
Or the individual post-fits. | |
const std::vector< TString > & | GetBranchNames () const |
Get the vector of branch names from root file. | |
void | GetNthParameter (const int param, double &Prior, double &PriorError, TString &Title) const |
Get properties of parameter by passing it number. | |
int | GetParamIndexFromName (const std::string &Name) |
Get parameter number based on name. | |
Long64_t | GetnEntries () |
Get Number of entries that Chain has, for merged chains will not be the same Nsteps. | |
Long64_t | GetnSteps () |
Get Number of Steps that Chain has, for merged chains will not be the same nEntries. | |
void | SetStepCut (const std::string &Cuts) |
Set the step cutting by string. | |
void | SetStepCut (const int Cuts) |
Set the step cutting by int. | |
void | SetPlotRelativeToPrior (const bool PlotOrNot) |
You can set relative to prior or relative to generated. It is advised to use relate to prior. | |
void | SetPrintToPDF (const bool PlotOrNot) |
void | SetPlotErrorForFlatPrior (const bool PlotOrNot) |
Set whether you want to plot error for parameters which have flat prior. | |
void | SetPlotBinValue (const bool PlotOrNot) |
void | SetFancyNames (const bool PlotOrNot) |
void | SetSmoothing (const bool PlotOrNot) |
Set whether want to use smoothing for histograms using ROOT algorithm. | |
void | SetPost2DPlotThreshold (const double Threshold) |
Code will only plot 2D posteriors if Correlation are larger than defined threshold. | |
void | SetUseFFTAutoCorrelation (const bool useFFT) |
Toggle using the FFT-based autocorrelation calculator. | |
void | SetExcludedTypes (std::vector< std::string > Name) |
Setter related what parameters we want to exclude from analysis, for example if cross-section parameters look like xsec_, then passing "xsec_" will. | |
void | SetExcludedNames (std::vector< std::string > Name) |
void | SetnBatches (const int Batches) |
Set value of Nbatches used for batched mean, this need to be done earlier as batches are made when reading tree. | |
void | SetnLags (const int nLags) |
void | SetOutputSuffix (const std::string Suffix) |
Sett output suffix, this way jobs using the same file will have different names. | |
void | SetPosterior1DCut (const std::string Cut) |
Allow to set addtional cuts based on ROOT TBrowser cut, for to only affect one mass ordering. | |
Protected Member Functions | |
std::unique_ptr< TH1D > | MakePrefit () |
Prepare prefit histogram for parameter overlay plot. | |
void | MakeOutputFile () |
prepare output root file and canvas to which we will save EVERYTHING | |
void | DrawCorrelations1D () |
Draw 1D correlations which might be more helpful than looking at huge 2D Corr matrix. | |
void | ReadInputCov () |
CW: Read the input Covariance matrix entries. Get stuff like parameter input errors, names, and so on. | |
void | ReadInputCovLegacy () |
void | FindInputFiles () |
Read the output MCMC file and find what inputs were used. | |
void | FindInputFilesLegacy () |
void | ReadModelFile () |
Read the xsec file and get the input central values and errors. | |
virtual void | LoadAdditionalInfo () |
allow loading additional info for example used for oscillation parameters | |
void | ReadNDFile () |
Read the ND cov file and get the input central values and errors. | |
void | ReadFDFile () |
Read the FD cov file and get the input central values and errors. | |
void | PrintInfo () const |
Print info like how many params have been loaded etc. | |
void | ScanInput () |
Scan Input etc. | |
void | ScanParameterOrder () |
Scan order of params from a different groups. | |
void | SetupOutput () |
Prepare all objects used for output. | |
void | PrepareDiagMCMC () |
CW: Prepare branches etc. for DiagMCMC. | |
void | ParamTraces () |
CW: Draw trace plots of the parameters i.e. parameter vs step. | |
void | AutoCorrelation () |
KS: Calculate autocorrelations supports both OpenMP and CUDA :) | |
void | AutoCorrelation_FFT () |
MJR: Autocorrelation function using FFT algorithm for extra speed. | |
void | CalculateESS (const int nLags, const std::vector< std::vector< double > > &LagL) |
KS: calc Effective Sample Size. | |
void | BatchedAnalysis () |
Get the batched means variance estimation and variable indicating if number of batches is sensible [4] [25]. | |
void | BatchedMeans () |
CW: Batched means, literally read from an array and chuck into TH1D. | |
void | GewekeDiagnostic () |
Geweke Diagnostic based on the methods described by Fang (2014) and Karlsbakk (2011). [8] [18]. | |
void | AcceptanceProbabilities () |
Acceptance Probability. | |
void | PowerSpectrumAnalysis () |
RC: Perform spectral analysis of MCMC [7]. | |
std::vector< double > | GetMargins (const std::unique_ptr< TCanvas > &Canv) const |
Get TCanvas margins, to be able to reset them if particular function need different margins. | |
void | SetMargins (std::unique_ptr< TCanvas > &Canv, const std::vector< double > &margins) |
Set TCanvas margins to specified values. | |
void | SetTLineStyle (TLine *Line, const Color_t Colour, const Width_t Width, const ELineStyle Style) const |
Configures a TLine object with the specified style parameters. | |
void | SetLegendStyle (TLegend *Legend, const double size) const |
Configures the style of a TLegend object. | |
Protected Attributes | |
std::string | MCMCFile |
Name of MCMC file. | |
std::string | OutputSuffix |
Output file suffix useful when running over same file with different settings. | |
std::vector< std::vector< std::string > > | CovPos |
Covariance matrix name position. | |
std::vector< YAML::Node > | CovConfig |
Covariance matrix config. | |
TChain * | Chain |
Main chain storing all steps etc. | |
std::string | StepCut |
BurnIn Cuts. | |
std::string | Posterior1DCut |
Cut used when making 1D Posterior distribution. | |
int | UpperCut |
KS: Used only for SubOptimality. | |
int | BurnInCut |
Value of burn in cut. | |
int | nBranches |
Number of branches in a TTree. | |
int | nEntries |
KS: For merged chains number of entries will be different from nSteps. | |
int | nSteps |
KS: For merged chains number of entries will be different from nSteps. | |
int | nSamples |
Number of sample PDF objects. | |
int | nSysts |
Number of covariance objects. | |
int | nDraw |
Number of all parameters used in the analysis. | |
std::vector< TString > | BranchNames |
std::vector< std::string > | ExcludedTypes |
std::vector< std::string > | ExcludedNames |
std::vector< bool > | IamVaried |
Is the ith parameter varied. | |
std::vector< std::vector< TString > > | ParamNames |
Name of parameters which we are going to analyse. | |
std::vector< std::vector< double > > | ParamCentral |
Parameters central values which we are going to analyse. | |
std::vector< std::vector< double > > | ParamNom |
std::vector< std::vector< double > > | ParamErrors |
Uncertainty on a single parameter. | |
std::vector< std::vector< bool > > | ParamFlat |
Whether Param has flat prior or not. | |
std::vector< int > | nParam |
Number of parameters per type. | |
std::vector< ParameterEnum > | ParamType |
Make an enum for which class this parameter belongs to so we don't have to keep string comparing. | |
std::vector< int > | ParamTypeStartPos |
std::vector< std::string > | ParameterGroup |
std::vector< TString > | SampleName_v |
Vector of each systematic. | |
std::vector< TString > | SystName_v |
Vector of each sample PDF object. | |
std::string | OutputName |
Name of output files. | |
TString | CanvasName |
Name of canvas which help to save to the sample pdf. | |
bool | PlotFlatPrior |
Whether we plot flat prior or not, we usually provide error even for flat prior params. | |
bool | plotRelativeToPrior |
Whether we plot relative to prior or nominal, in most cases is prior. | |
bool | MadePostfit |
Sanity check if Postfit is already done to not make several times. | |
bool | printToPDF |
Will plot all plot to PDF not only to root file. | |
bool | FancyPlotNames |
Whether we want fancy plot names or not. | |
bool | plotBinValue |
If true it will print value on each bin of covariance matrix. | |
bool | ApplySmoothing |
Apply smoothing for 2D histos using root algorithm. | |
double | Post2DPlotThreshold |
KS: Set Threshold when to plot 2D posterior as by default we get a LOT of plots. | |
bool | useFFTAutoCorrelation |
MJR: Use FFT-based autocorrelation algorithm (save time & resources)? | |
std::vector< int > | NDSamplesBins |
std::vector< std::string > | NDSamplesNames |
std::unique_ptr< TF1 > | Gauss |
Gaussian fitter. | |
TFile * | OutputFile |
The output file. | |
std::unique_ptr< TCanvas > | Posterior |
Fancy canvas used for our beautiful plots. | |
TVectorD * | Central_Value |
Vector with central value for each parameter. | |
TVectorD * | Means |
Vector with mean values using Arithmetic Mean. | |
TVectorD * | Errors |
Vector with errors values using RMS. | |
TVectorD * | Means_Gauss |
Vector with mean values using Gaussian fit. | |
TVectorD * | Errors_Gauss |
Vector with error values using Gaussian fit. | |
TVectorD * | Means_HPD |
Vector with mean values using Highest Posterior Density. | |
TVectorD * | Errors_HPD |
Vector with error values using Highest Posterior Density. | |
TVectorD * | Errors_HPD_Positive |
Vector with positive error (right hand side) values using Highest Posterior Density. | |
TVectorD * | Errors_HPD_Negative |
Vector with negative error (left hand side) values using Highest Posterior Density. | |
TMatrixDSym * | Covariance |
Posterior Covariance Matrix. | |
TMatrixDSym * | Correlation |
Posterior Correlation Matrix. | |
std::vector< TH1D * > | hpost |
Holds 1D Posterior Distributions. | |
std::vector< std::vector< TH2D * > > | hpost2D |
Holds 2D Posterior Distributions. | |
std::unique_ptr< TH2D > | hviolin |
Holds violin plot for all dials. | |
std::unique_ptr< TH2D > | hviolin_prior |
Holds prior violin plot for all dials,. | |
double ** | ParStep |
Array holding values for all parameters. | |
int * | StepNumber |
Step number for step, important if chains were merged. | |
int | nBins |
Number of bins. | |
double | DrawRange |
Drawrange for SetMaximum. | |
bool | CacheMCMC |
MCMC Chain has been cached. | |
bool | doDiagMCMC |
Doing MCMC Diagnostic. | |
int | nBatches |
Number of batches for Batched Mean. | |
int | AutoCorrLag |
LagL used in AutoCorrelation. | |
double * | ParamSums |
Total parameter sum for each param. | |
double ** | BatchedAverages |
Values of batched average for every param and batch. | |
double ** | SampleValues |
Holds the sample values. | |
double ** | SystValues |
Holds the systs values. | |
double * | AccProbValues |
Holds all accProb. | |
double * | AccProbBatchedAverages |
Holds all accProb in batches. | |
Class responsible for processing MCMC chains, performing diagnostics, generating plots, and managing Bayesian analysis.
This class provides utilities to handle MCMC output generated by mcmc::runMCMC. It is particularly useful for extracting values from previous MCMC runs and initiating new MCMC runs with those values. Inspired by nd280_utils/DrawComp.cpp.
Definition at line 65 of file MCMCProcessor.h.
_MaCh3_Safe_Include_Start_ _MaCh3_Safe_Include_End_ MCMCProcessor::MCMCProcessor | ( | const std::string & | InputFile | ) |
Constructs an MCMCProcessor object with the specified input file and options.
InputFile | The path to the input file containing MCMC data. |
Definition at line 17 of file MCMCProcessor.cpp.
|
virtual |
Destroys the MCMCProcessor object.
Definition at line 106 of file MCMCProcessor.cpp.
|
inlineprotected |
Acceptance Probability.
Definition at line 4030 of file MCMCProcessor.cpp.
|
inlineprotected |
KS: Calculate autocorrelations supports both OpenMP and CUDA :)
Definition at line 3287 of file MCMCProcessor.cpp.
|
inlineprotected |
MJR: Autocorrelation function using FFT algorithm for extra speed.
Definition at line 3192 of file MCMCProcessor.cpp.
|
inlineprotected |
Get the batched means variance estimation and variable indicating if number of batches is sensible [4] [25].
Definition at line 3661 of file MCMCProcessor.cpp.
|
inlineprotected |
CW: Batched means, literally read from an array and chuck into TH1D.
Definition at line 3603 of file MCMCProcessor.cpp.
void MCMCProcessor::CacheSteps | ( | ) |
KS:By caching each step we use multithreading.
Definition at line 1032 of file MCMCProcessor.cpp.
|
inlineprotected |
KS: calc Effective Sample Size.
nLags | Should be the same nLags as used in AutoCorrelation() |
LagL | Value of LagL for each dial and each Lag |
This function computes the Effective Sample Size (ESS) using the autocorrelations calculated by AutoCorrelation(). Ensure that the parameter nLags here matches the number of lags used in AutoCorrelation() to obtain accurate results. [27] [13] [9]
Definition at line 3506 of file MCMCProcessor.cpp.
void MCMCProcessor::CheckCredibleIntervalsOrder | ( | const std::vector< double > & | CredibleIntervals, |
const std::vector< Color_t > & | CredibleIntervalsColours | ||
) |
Checks the order and size consistency of the CredibleIntervals
and CredibleIntervalsColours
vectors.
CredibleIntervals | A vector of credible interval values. |
CredibleIntervalsColours | A vector of colors associated with each credible interval. |
MaCh3Exception | If the sizes are not equal or the intervals are not in decreasing order. |
Definition at line 4076 of file MCMCProcessor.cpp.
void MCMCProcessor::CheckCredibleRegionsOrder | ( | const std::vector< double > & | CredibleRegions, |
const std::vector< Style_t > & | CredibleRegionStyle, | ||
const std::vector< Color_t > & | CredibleRegionColor | ||
) |
Checks the order and size consistency of the CredibleRegions
, CredibleRegionStyle
, and CredibleRegionColor
vectors.
CredibleRegions | A vector of credible region values. |
CredibleRegionStyle | A vector of styles associated with each credible region. |
CredibleRegionColor | A vector of colors associated with each credible region. |
MaCh3Exception | If the sizes are not equal or the regions are not in decreasing order. |
Definition at line 4095 of file MCMCProcessor.cpp.
void MCMCProcessor::DiagMCMC | ( | ) |
KS: Perform MCMC diagnostic including Autocorrelation, Trace etc.
Definition at line 2906 of file MCMCProcessor.cpp.
|
inlineprotected |
Draw 1D correlations which might be more helpful than looking at huge 2D Corr matrix.
Definition at line 1410 of file MCMCProcessor.cpp.
void MCMCProcessor::DrawCovariance | ( | ) |
Draw the post-fit covariances.
Definition at line 1317 of file MCMCProcessor.cpp.
void MCMCProcessor::DrawPostfit | ( | ) |
Draw the post-fit comparisons.
Definition at line 420 of file MCMCProcessor.cpp.
|
inlineprotected |
Read the output MCMC file and find what inputs were used.
Definition at line 2180 of file MCMCProcessor.cpp.
|
inlineprotected |
Definition at line 2239 of file MCMCProcessor.cpp.
void MCMCProcessor::GetBayesFactor | ( | const std::vector< std::string > & | ParName, |
const std::vector< std::vector< double > > & | Model1Bounds, | ||
const std::vector< std::vector< double > > & | Model2Bounds, | ||
const std::vector< std::vector< std::string > > & | ModelNames | ||
) |
Calculate Bayes factor for vector of params, and model boundaries.
ParName | Vector with parameter names for which we calculate Bayes factor |
Model1Bounds | Lower and upper bound for hypothesis 1. Within this bound we calculate integral used later for Bayes Factor |
Model2Bounds | Lower and upper bound for hypothesis 2. Within this bound we calculate integral used later for Bayes Factor |
ModelNames | Names for hypothesis 1 and 2 |
Definition at line 2545 of file MCMCProcessor.cpp.
|
inline |
void MCMCProcessor::GetCovariance | ( | TMatrixDSym *& | Cov, |
TMatrixDSym *& | Corr | ||
) |
Get the post-fit covariances and correlations.
Cov | Covariance matrix |
Corr | Correlation matrix |
Definition at line 192 of file MCMCProcessor.cpp.
|
inline |
Definition at line 215 of file MCMCProcessor.h.
int MCMCProcessor::GetGroup | ( | const std::string & | name | ) | const |
Number of params from a given group, for example flux.
Definition at line 4114 of file MCMCProcessor.cpp.
|
inline |
Get 1D posterior for a given parameter.
i | parameter index |
Definition at line 202 of file MCMCProcessor.h.
|
inline |
Get 2D posterior for a given parameter combination.
i | parameter index X |
j | parameter index Y |
Definition at line 206 of file MCMCProcessor.h.
|
protected |
Get TCanvas margins, to be able to reset them if particular function need different margins.
Definition at line 4158 of file MCMCProcessor.cpp.
|
inline |
Definition at line 214 of file MCMCProcessor.h.
|
inline |
Get Number of entries that Chain has, for merged chains will not be the same Nsteps.
Definition at line 233 of file MCMCProcessor.h.
|
inline |
Definition at line 196 of file MCMCProcessor.h.
|
inline |
Definition at line 195 of file MCMCProcessor.h.
|
inline |
|
inline |
Get Number of Steps that Chain has, for merged chains will not be the same nEntries.
Definition at line 235 of file MCMCProcessor.h.
void MCMCProcessor::GetNthParameter | ( | const int | param, |
double & | Prior, | ||
double & | PriorError, | ||
TString & | Title | ||
) | const |
Get properties of parameter by passing it number.
Definition at line 2425 of file MCMCProcessor.cpp.
|
inline |
Definition at line 194 of file MCMCProcessor.h.
int MCMCProcessor::GetParamIndexFromName | ( | const std::string & | Name | ) |
Get parameter number based on name.
Definition at line 2438 of file MCMCProcessor.cpp.
void MCMCProcessor::GetPolarPlot | ( | const std::vector< std::string > & | ParNames | ) |
Make funny polar plot.
ParNames | Vector with parameter names for which Polar Plot will be made |
Definition at line 2476 of file MCMCProcessor.cpp.
void MCMCProcessor::GetPostfit | ( | TVectorD *& | Central, |
TVectorD *& | Errors, | ||
TVectorD *& | Central_Gauss, | ||
TVectorD *& | Errors_Gauss, | ||
TVectorD *& | Peaks | ||
) |
Get the post-fit results (arithmetic and Gaussian)
Definition at line 159 of file MCMCProcessor.cpp.
void MCMCProcessor::GetPostfit_Ind | ( | TVectorD *& | Central, |
TVectorD *& | Errors, | ||
TVectorD *& | Peaks, | ||
ParameterEnum | kParam | ||
) |
Or the individual post-fits.
Definition at line 174 of file MCMCProcessor.cpp.
void MCMCProcessor::GetSavageDickey | ( | const std::vector< std::string > & | ParName, |
const std::vector< double > & | EvaluationPoint, | ||
const std::vector< std::vector< double > > & | Bounds | ||
) |
Calculate Bayes factor for point like hypothesis using SavageDickey.
Definition at line 2602 of file MCMCProcessor.cpp.
|
inline |
Get Violin plot for all parameters with posterior values.
Definition at line 208 of file MCMCProcessor.h.
|
inline |
Get Violin plot for all parameters with prior values.
Definition at line 210 of file MCMCProcessor.h.
|
inline |
Definition at line 213 of file MCMCProcessor.h.
|
inlineprotected |
Geweke Diagnostic based on the methods described by Fang (2014) and Karlsbakk (2011). [8] [18].
Definition at line 3898 of file MCMCProcessor.cpp.
void MCMCProcessor::Initialise | ( | ) |
Scan chain, what parameters we have and load information from covariance matrices.
Definition at line 149 of file MCMCProcessor.cpp.
|
inlineprotectedvirtual |
allow loading additional info for example used for oscillation parameters
Reimplemented in OscProcessor.
Definition at line 293 of file MCMCProcessor.h.
void MCMCProcessor::MakeCovariance | ( | ) |
Calculate covariance by making 2D projection of each combination of parameters.
Definition at line 925 of file MCMCProcessor.cpp.
void MCMCProcessor::MakeCovariance_MP | ( | const bool | Mute = false | ) |
Calculate covariance by making 2D projection of each combination of parameters using multithreading.
Mute | Allow silencing many messages, especially important if we calculate matrix many times |
Definition at line 1141 of file MCMCProcessor.cpp.
void MCMCProcessor::MakeCredibleIntervals | ( | const std::vector< double > & | CredibleIntervals = {0.99, 0.90, 0.68 } , |
const std::vector< Color_t > & | CredibleIntervalsColours = {kCyan+4, kCyan-2, kCyan-10} , |
||
const bool | CredibleInSigmas = false |
||
) |
Make and Draw Credible intervals.
CredibleIntervals | Vector with values of credible intervals, must be in descending order |
CredibleIntervalsColours | Color_t telling what colour to use for each Interval line |
CredibleInSigmas | Bool telling whether intervals are in percentage or in sigmas, then special conversions is used |
Scale the histograms so it shows the posterior probability
Definition at line 674 of file MCMCProcessor.cpp.
void MCMCProcessor::MakeCredibleRegions | ( | const std::vector< double > & | CredibleRegions = {0.99, 0.90, 0.68} , |
const std::vector< Style_t > & | CredibleRegionStyle = {kDashed, kSolid, kDotted} , |
||
const std::vector< Color_t > & | CredibleRegionColor = {kGreen-3, kGreen-10, kGreen} , |
||
const bool | CredibleInSigmas = false , |
||
const bool | Draw2DPosterior = true , |
||
const bool | DrawBestFit = true |
||
) |
Make and Draw Credible Regions.
CredibleRegions | Vector with values of credible intervals, must be in descending order |
CredibleRegionStyle | Style_t telling what line style to use for each Interval line |
CredibleRegionColor | Color_t telling what colour to use for each Interval line |
CredibleInSigmas | Bool telling whether intervals are in percentage or in sigmas, then special conversions is used |
Definition at line 1544 of file MCMCProcessor.cpp.
|
inlineprotected |
prepare output root file and canvas to which we will save EVERYTHING
Definition at line 201 of file MCMCProcessor.cpp.
void MCMCProcessor::MakePostfit | ( | ) |
Make 1D projection for each parameter and prepare structure.
Definition at line 235 of file MCMCProcessor.cpp.
|
inlineprotected |
Prepare prefit histogram for parameter overlay plot.
Definition at line 2100 of file MCMCProcessor.cpp.
void MCMCProcessor::MakeSubOptimality | ( | const int | NIntervals = 10 | ) |
Make and Draw SubOptimality [24].
Definition at line 1247 of file MCMCProcessor.cpp.
void MCMCProcessor::MakeTrianglePlot | ( | const std::vector< std::string > & | ParNames, |
const std::vector< double > & | CredibleIntervals = {0.99, 0.90, 0.68 } , |
||
const std::vector< Color_t > & | CredibleIntervalsColours = {kCyan+4, kCyan-2, kCyan-10} , |
||
const std::vector< double > & | CredibleRegions = {0.99, 0.90, 0.68} , |
||
const std::vector< Style_t > & | CredibleRegionStyle = {kDashed, kSolid, kDotted} , |
||
const std::vector< Color_t > & | CredibleRegionColor = {kGreen-3, kGreen-10, kGreen} , |
||
const bool | CredibleInSigmas = false |
||
) |
Make fancy triangle plot for selected parameters.
CredibleIntervals | Vector with values of credible intervals, must be in descending order |
CredibleIntervalsColours | Color_t telling what colour to use for each Interval line |
CredibleInSigmas | Bool telling whether intervals are in percentage or in sigmas, then special conversions is used |
CredibleRegions | Vector with values of credible intervals, must be in descending order |
CredibleRegionStyle | Style_t telling what line style to use for each Interval line |
CredibleRegionColor | Color_t telling what colour to use for each Interval line |
Scale the histograms so it shows the posterior probability
Definition at line 1662 of file MCMCProcessor.cpp.
void MCMCProcessor::MakeViolin | ( | ) |
Make and Draw Violin.
Definition at line 781 of file MCMCProcessor.cpp.
void MCMCProcessor::ParameterEvolution | ( | const std::vector< std::string > & | Names, |
const std::vector< int > & | NIntervals | ||
) |
Make .gif of parameter evolution.
Names | Parameter names for which we do .gif |
NIntervals | Number of intervals for a gif |
Definition at line 2836 of file MCMCProcessor.cpp.
|
inlineprotected |
CW: Draw trace plots of the parameters i.e. parameter vs step.
Definition at line 3099 of file MCMCProcessor.cpp.
|
inlineprotected |
RC: Perform spectral analysis of MCMC [7].
Definition at line 3776 of file MCMCProcessor.cpp.
|
inlineprotected |
CW: Prepare branches etc. for DiagMCMC.
Definition at line 2936 of file MCMCProcessor.cpp.
|
inlineprotected |
Print info like how many params have been loaded etc.
Definition at line 4131 of file MCMCProcessor.cpp.
|
inlineprotected |
Read the FD cov file and get the input central values and errors.
Definition at line 2373 of file MCMCProcessor.cpp.
|
inlineprotected |
CW: Read the input Covariance matrix entries. Get stuff like parameter input errors, names, and so on.
Definition at line 2162 of file MCMCProcessor.cpp.
|
inlineprotected |
Definition at line 2171 of file MCMCProcessor.cpp.
|
inlineprotected |
Read the xsec file and get the input central values and errors.
Definition at line 2280 of file MCMCProcessor.cpp.
|
inlineprotected |
Read the ND cov file and get the input central values and errors.
Definition at line 2330 of file MCMCProcessor.cpp.
void MCMCProcessor::ResetHistograms | ( | ) |
Reset 2D posteriors, in case we would like to calculate in again with different BurnInCut.
Definition at line 2458 of file MCMCProcessor.cpp.
void MCMCProcessor::ReweightPrior | ( | const std::vector< std::string > & | Names, |
const std::vector< double > & | NewCentral, | ||
const std::vector< double > & | NewError | ||
) |
Reweight Prior by giving new central value and new error.
Names | Parameter names for which we do reweighting |
NewCentral | New central value for which we reweight |
NewError | New error used for calculating weight |
Definition at line 2737 of file MCMCProcessor.cpp.
|
inlineprotected |
Scan Input etc.
Definition at line 1920 of file MCMCProcessor.cpp.
|
inlineprotected |
Scan order of params from a different groups.
Definition at line 2082 of file MCMCProcessor.cpp.
|
inline |
Definition at line 263 of file MCMCProcessor.h.
|
inline |
Setter related what parameters we want to exclude from analysis, for example if cross-section parameters look like xsec_, then passing "xsec_" will.
Batches | Vector with parameters type names we want to exclude |
Definition at line 262 of file MCMCProcessor.h.
|
inline |
Definition at line 251 of file MCMCProcessor.h.
|
protected |
Configures the style of a TLegend object.
Legend | Pointer to the TLegend object to modify |
size | The text size to set for the legend |
Definition at line 4190 of file MCMCProcessor.cpp.
|
protected |
Set TCanvas margins to specified values.
Definition at line 4165 of file MCMCProcessor.cpp.
|
inline |
Set value of Nbatches used for batched mean, this need to be done earlier as batches are made when reading tree.
Batches | Number of batches, default is 20 |
Definition at line 267 of file MCMCProcessor.h.
|
inline |
Definition at line 268 of file MCMCProcessor.h.
|
inline |
Sett output suffix, this way jobs using the same file will have different names.
Definition at line 271 of file MCMCProcessor.h.
|
inline |
Definition at line 250 of file MCMCProcessor.h.
|
inline |
Set whether you want to plot error for parameters which have flat prior.
Definition at line 249 of file MCMCProcessor.h.
|
inline |
You can set relative to prior or relative to generated. It is advised to use relate to prior.
PlotOrNot | bool controlling plotRelativeToPrior argument |
Definition at line 246 of file MCMCProcessor.h.
|
inline |
Code will only plot 2D posteriors if Correlation are larger than defined threshold.
Threshold | This threshold is compared with correlation value |
Definition at line 256 of file MCMCProcessor.h.
|
inline |
Allow to set addtional cuts based on ROOT TBrowser cut, for to only affect one mass ordering.
Definition at line 273 of file MCMCProcessor.h.
|
inline |
Definition at line 247 of file MCMCProcessor.h.
|
inline |
Set whether want to use smoothing for histograms using ROOT algorithm.
Definition at line 253 of file MCMCProcessor.h.
void MCMCProcessor::SetStepCut | ( | const int | Cuts | ) |
Set the step cutting by int.
Cuts | integer telling cut value |
Definition at line 2415 of file MCMCProcessor.cpp.
void MCMCProcessor::SetStepCut | ( | const std::string & | Cuts | ) |
Set the step cutting by string.
Cuts | string telling cut value |
Definition at line 2407 of file MCMCProcessor.cpp.
|
protected |
Configures a TLine object with the specified style parameters.
Line | Pointer to the TLine object to modify. Must not be nullptr. |
Colour | The color to set for the line. |
Width | The width of the line. |
Style | The line style (e.g., solid, dashed, etc.). |
Definition at line 4182 of file MCMCProcessor.cpp.
|
inlineprotected |
Prepare all objects used for output.
Definition at line 2025 of file MCMCProcessor.cpp.
|
inline |
Toggle using the FFT-based autocorrelation calculator.
Definition at line 258 of file MCMCProcessor.h.
|
inline |
Thin MCMC Chain, to save space and maintain low autocorrelations.
ThinningCut | every which entry you want to thin |
Average | If true will perform MCMC averaging instead of thinning |
Definition at line 186 of file MCMCProcessor.h.
|
protected |
Holds all accProb in batches.
Definition at line 530 of file MCMCProcessor.h.
|
protected |
Holds all accProb.
Definition at line 528 of file MCMCProcessor.h.
|
protected |
Apply smoothing for 2D histos using root algorithm.
Definition at line 444 of file MCMCProcessor.h.
|
protected |
LagL used in AutoCorrelation.
Definition at line 515 of file MCMCProcessor.h.
|
protected |
Values of batched average for every param and batch.
Definition at line 520 of file MCMCProcessor.h.
|
protected |
Definition at line 394 of file MCMCProcessor.h.
|
protected |
Value of burn in cut.
Definition at line 379 of file MCMCProcessor.h.
|
protected |
MCMC Chain has been cached.
Definition at line 507 of file MCMCProcessor.h.
|
protected |
Name of canvas which help to save to the sample pdf.
Definition at line 427 of file MCMCProcessor.h.
|
protected |
Vector with central value for each parameter.
Definition at line 464 of file MCMCProcessor.h.
|
protected |
Main chain storing all steps etc.
Definition at line 371 of file MCMCProcessor.h.
|
protected |
Posterior Correlation Matrix.
Definition at line 485 of file MCMCProcessor.h.
|
protected |
Posterior Covariance Matrix.
Definition at line 483 of file MCMCProcessor.h.
|
protected |
Covariance matrix config.
Definition at line 368 of file MCMCProcessor.h.
|
protected |
Covariance matrix name position.
Definition at line 366 of file MCMCProcessor.h.
|
protected |
Doing MCMC Diagnostic.
Definition at line 509 of file MCMCProcessor.h.
|
protected |
Drawrange for SetMaximum.
Definition at line 504 of file MCMCProcessor.h.
|
protected |
Vector with errors values using RMS.
Definition at line 468 of file MCMCProcessor.h.
|
protected |
Vector with error values using Gaussian fit.
Definition at line 472 of file MCMCProcessor.h.
|
protected |
Vector with error values using Highest Posterior Density.
Definition at line 476 of file MCMCProcessor.h.
|
protected |
Vector with negative error (left hand side) values using Highest Posterior Density.
Definition at line 480 of file MCMCProcessor.h.
|
protected |
Vector with positive error (right hand side) values using Highest Posterior Density.
Definition at line 478 of file MCMCProcessor.h.
|
protected |
Definition at line 396 of file MCMCProcessor.h.
|
protected |
Definition at line 395 of file MCMCProcessor.h.
|
protected |
Whether we want fancy plot names or not.
Definition at line 440 of file MCMCProcessor.h.
|
protected |
Gaussian fitter.
Definition at line 454 of file MCMCProcessor.h.
|
protected |
Holds 1D Posterior Distributions.
Definition at line 488 of file MCMCProcessor.h.
|
protected |
Holds 2D Posterior Distributions.
Definition at line 490 of file MCMCProcessor.h.
|
protected |
Holds violin plot for all dials.
Definition at line 492 of file MCMCProcessor.h.
|
protected |
Holds prior violin plot for all dials,.
Definition at line 494 of file MCMCProcessor.h.
|
protected |
Is the ith parameter varied.
Definition at line 399 of file MCMCProcessor.h.
|
protected |
Sanity check if Postfit is already done to not make several times.
Definition at line 436 of file MCMCProcessor.h.
|
protected |
Name of MCMC file.
Definition at line 362 of file MCMCProcessor.h.
|
protected |
Vector with mean values using Arithmetic Mean.
Definition at line 466 of file MCMCProcessor.h.
|
protected |
Vector with mean values using Gaussian fit.
Definition at line 470 of file MCMCProcessor.h.
|
protected |
Vector with mean values using Highest Posterior Density.
Definition at line 474 of file MCMCProcessor.h.
|
protected |
Number of batches for Batched Mean.
Definition at line 513 of file MCMCProcessor.h.
|
protected |
Number of bins.
Definition at line 502 of file MCMCProcessor.h.
|
protected |
Number of branches in a TTree.
Definition at line 381 of file MCMCProcessor.h.
|
protected |
Number of all parameters used in the analysis.
Definition at line 391 of file MCMCProcessor.h.
|
protected |
Definition at line 450 of file MCMCProcessor.h.
|
protected |
Definition at line 451 of file MCMCProcessor.h.
|
protected |
KS: For merged chains number of entries will be different from nSteps.
Definition at line 383 of file MCMCProcessor.h.
|
protected |
Number of parameters per type.
Definition at line 410 of file MCMCProcessor.h.
|
protected |
Number of sample PDF objects.
Definition at line 387 of file MCMCProcessor.h.
|
protected |
KS: For merged chains number of entries will be different from nSteps.
Definition at line 385 of file MCMCProcessor.h.
|
protected |
Number of covariance objects.
Definition at line 389 of file MCMCProcessor.h.
|
protected |
The output file.
Definition at line 457 of file MCMCProcessor.h.
|
protected |
Name of output files.
Definition at line 425 of file MCMCProcessor.h.
|
protected |
Output file suffix useful when running over same file with different settings.
Definition at line 364 of file MCMCProcessor.h.
|
protected |
Parameters central values which we are going to analyse.
Definition at line 403 of file MCMCProcessor.h.
|
protected |
Uncertainty on a single parameter.
Definition at line 406 of file MCMCProcessor.h.
|
protected |
Definition at line 417 of file MCMCProcessor.h.
|
protected |
Whether Param has flat prior or not.
Definition at line 408 of file MCMCProcessor.h.
|
protected |
Name of parameters which we are going to analyse.
Definition at line 401 of file MCMCProcessor.h.
|
protected |
Definition at line 404 of file MCMCProcessor.h.
|
protected |
Total parameter sum for each param.
Definition at line 518 of file MCMCProcessor.h.
|
protected |
Make an enum for which class this parameter belongs to so we don't have to keep string comparing.
Definition at line 412 of file MCMCProcessor.h.
|
protected |
KS: in MCMC output there is order of parameters so for example first goes xsec then nd det etc. Idea is that this parameter will keep track of it so code is flexible
Definition at line 415 of file MCMCProcessor.h.
|
protected |
Array holding values for all parameters.
Definition at line 497 of file MCMCProcessor.h.
|
protected |
If true it will print value on each bin of covariance matrix.
Definition at line 442 of file MCMCProcessor.h.
|
protected |
Whether we plot flat prior or not, we usually provide error even for flat prior params.
Definition at line 430 of file MCMCProcessor.h.
|
protected |
Whether we plot relative to prior or nominal, in most cases is prior.
Definition at line 434 of file MCMCProcessor.h.
|
protected |
KS: Set Threshold when to plot 2D posterior as by default we get a LOT of plots.
Definition at line 446 of file MCMCProcessor.h.
|
protected |
Fancy canvas used for our beautiful plots.
Definition at line 460 of file MCMCProcessor.h.
|
protected |
Cut used when making 1D Posterior distribution.
Definition at line 375 of file MCMCProcessor.h.
|
protected |
Will plot all plot to PDF not only to root file.
Definition at line 438 of file MCMCProcessor.h.
|
protected |
Vector of each systematic.
Definition at line 420 of file MCMCProcessor.h.
|
protected |
Holds the sample values.
Definition at line 523 of file MCMCProcessor.h.
|
protected |
BurnIn Cuts.
Definition at line 373 of file MCMCProcessor.h.
|
protected |
Step number for step, important if chains were merged.
Definition at line 499 of file MCMCProcessor.h.
|
protected |
Vector of each sample PDF object.
Definition at line 422 of file MCMCProcessor.h.
|
protected |
Holds the systs values.
Definition at line 525 of file MCMCProcessor.h.
|
protected |
KS: Used only for SubOptimality.
Definition at line 377 of file MCMCProcessor.h.
|
protected |
MJR: Use FFT-based autocorrelation algorithm (save time & resources)?
Definition at line 448 of file MCMCProcessor.h.