![]() |
MaCh3
2.2.3
Reference Guide
|
Implementation of Prior/Posterior Predictive and Bayesian p-Value calculations following the approach described in [10]. More...
#include <Fitters/PredictiveThrower.h>
Public Member Functions | |
PredictiveThrower (manager *const fitMan) | |
Constructor. More... | |
virtual | ~PredictiveThrower () |
Destructor. More... | |
void | ProduceToys () |
Produce toys by throwing from MCMC. More... | |
void | RunPredictiveAnalysis () |
Main routine responsible for producing posterior predictive distributions and $p$-value. More... | |
void | RunMCMC () override |
This is not used in this class. More... | |
![]() | |
FitterBase (manager *const fitMan) | |
Constructor. More... | |
virtual | ~FitterBase () |
Destructor for the FitterBase class. More... | |
void | AddSampleHandler (SampleHandlerBase *sample) |
This function adds a sample PDF object to the analysis framework. The sample PDF object will be utilized in fitting procedures or likelihood scans. More... | |
void | AddSystObj (ParameterHandlerBase *cov) |
This function adds a Covariance object to the analysis framework. The Covariance object will be utilized in fitting procedures or likelihood scans. More... | |
void | DragRace (const int NLaps=100) |
Calculates the required time for each sample or covariance object in a drag race simulation. Inspired by Dan's feature. More... | |
void | RunLLHScan () |
Perform a 1D likelihood scan. More... | |
void | GetStepScaleBasedOnLLHScan () |
LLH scan is good first estimate of step scale. More... | |
void | Run2DLLHScan () |
Perform a 2D likelihood scan. More... | |
void | RunSigmaVar () |
Perform a 2D and 1D sigma var for all samples. More... | |
void | RunSigmaVarFD () |
Perform a 1D sigma var for all samples. More... | |
virtual void | StartFromPreviousFit (const std::string &FitName) |
Allow to start from previous fit/chain. More... | |
std::string | GetName () const |
Get name of class. More... | |
Private Member Functions | |
void | SetParamters () |
This set some params to prior value this way you can evaluate errors from subset of errors. More... | |
void | SetupToyGeneration () |
Setup useful variables etc before stating toy generation. More... | |
bool | LoadToys () |
Load existing toys. More... | |
void | SetupSampleInformation () |
Setup sample information. More... | |
std::unique_ptr< TH1D > | MakePredictive (const std::vector< std::unique_ptr< TH1D >> &Toys, const std::string &Sample_Name, const std::string &suffix, const bool DebugHistograms) |
Produce posterior predictive distribution. More... | |
std::vector< std::unique_ptr< TH2D > > | ProduceSpectra (const std::vector< std::vector< std::unique_ptr< TH1D >>> &Toys, const std::string suffix) |
Produce Violin style spectra. More... | |
void | PosteriorPredictivepValue (const std::vector< std::unique_ptr< TH1D >> &PostPred_mc, const std::vector< TDirectory * > &SampleDir) |
Calculate Posterior Predictive $p$-value. More... | |
double | GetLLH (const std::unique_ptr< TH1D > &DatHist, const std::unique_ptr< TH1D > &MCHist, const std::unique_ptr< TH1D > &W2Hist, SampleHandlerBase *SampleHandler) |
Helper functions to calculate likelihoods using TH1D. More... | |
void | MakeChi2Plots (const std::vector< std::vector< double >> &Chi2_x, const std::string &Chi2_x_title, const std::vector< std::vector< double >> &Chi2_y, const std::string &Chi2_y_title, const std::vector< TDirectory * > &SampleDir, const std::string Title) |
Produce Chi2 plot for a single sample based on which $p$-value is calculated. More... | |
Private Attributes | |
bool | FullLLH |
KS: Use Full LLH or only sample contribution based on discussion with Asher we almost always only want the sample likelihood. More... | |
int | NModelParams |
KS: Count total number of model parameters which can be used for stuff like BIC. More... | |
bool | Is_PriorPredictive |
Whether it is Prior or Posterior predictive. More... | |
int | TotalNumberOfSamples |
Number of toys we are generating analysing. More... | |
std::vector< std::string > | SampleNames |
Name of a single sample. More... | |
std::vector< int > | SampleObjectMap |
Maps if sample with given SampleHandler, useful if we have more than one sample in single object. More... | |
int | Ntoys |
Number of toys we are generating analysing. More... | |
std::vector< std::string > | ParameterGroupsNotVaried |
KS: Names of parameter groups that will not be varied. More... | |
std::unordered_set< int > | ParameterOnlyToVary |
KS: Index of parameters groups that will be varied. More... | |
ParameterHandlerGeneric * | ModelSystematic |
Pointer to El Generico. More... | |
std::vector< std::unique_ptr< TH1D > > | Data_Hist |
Vector of Data histograms. More... | |
std::vector< std::unique_ptr< TH1D > > | MC_Nom_Hist |
Vector of MC histograms. More... | |
std::vector< std::unique_ptr< TH1D > > | W2_Nom_Hist |
Vector of W2 histograms. More... | |
std::vector< std::vector< std::unique_ptr< TH1D > > > | MC_Hist_Toy |
std::vector< std::vector< std::unique_ptr< TH1D > > > | W2_Hist_Toy |
std::vector< double > | ReweightWeight |
Reweighting factors applied for each toy, by default 1. More... | |
std::vector< double > | PenaltyTerm |
Penalty term values for each toy by default 0. More... | |
Additional Inherited Members | |
![]() | |
void | ProcessMCMC () |
Process MCMC output. More... | |
void | PrepareOutput () |
Prepare the output file. More... | |
void | SaveOutput () |
Save output and close files. More... | |
void | SanitiseInputs () |
Remove obsolete memory and make other checks before fit starts. More... | |
void | SaveSettings () |
Save the settings that the MCMC was run with. More... | |
bool | GetScaneRange (std::map< std::string, std::vector< double >> &scanRanges) |
YSP: Set up a mapping to store parameters with user-specified ranges, suggested by D. Barrow. More... | |
bool | CheckSkipParameter (const std::vector< std::string > &SkipVector, const std::string &ParamName) const |
KS: Check whether we want to skip parameter using skip vector. More... | |
void | CustomRange (const std::string &ParName, const double sigma, double &ParamShiftValue) |
For comparison with P-Theta we usually have to apply different parameter values then usual 1, 3 sigma. More... | |
![]() | |
manager * | fitMan |
The manager. More... | |
unsigned int | step |
current state More... | |
double | logLCurr |
current likelihood More... | |
double | logLProp |
proposed likelihood More... | |
double | accProb |
current acceptance prob More... | |
int | accCount |
counts accepted steps More... | |
unsigned int | stepStart |
step start, by default 0 if we start from previous chain then it will be different More... | |
std::vector< double > | sample_llh |
store the llh breakdowns More... | |
std::vector< double > | syst_llh |
systematic llh breakdowns More... | |
std::vector< SampleHandlerBase * > | samples |
Sample holder. More... | |
unsigned int | TotalNSamples |
Total number of samples used. More... | |
std::vector< ParameterHandlerBase * > | systematics |
Systematic holder. More... | |
std::unique_ptr< TStopwatch > | clock |
tells global time how long fit took More... | |
std::unique_ptr< TStopwatch > | stepClock |
tells how long single step/fit iteration took More... | |
double | stepTime |
Time of single step. More... | |
std::unique_ptr< TRandom3 > | random |
Random number. More... | |
TFile * | outputFile |
Output. More... | |
TDirectory * | CovFolder |
Output cov folder. More... | |
TDirectory * | SampleFolder |
Output sample folder. More... | |
TTree * | outTree |
Output tree with posteriors. More... | |
int | auto_save |
auto save every N steps More... | |
bool | fTestLikelihood |
Necessary for some fitting algorithms like PSO. More... | |
bool | FileSaved |
Checks if file saved not repeat some operations. More... | |
bool | SettingsSaved |
Checks if setting saved not repeat some operations. More... | |
bool | OutputPrepared |
Checks if output prepared not repeat some operations. More... | |
std::string | AlgorithmName |
Name of fitting algorithm that is being used. More... | |
Implementation of Prior/Posterior Predictive and Bayesian p-Value calculations following the approach described in [10].
For more information, visit the Wiki.
add BIC, DIC, WAIC
add ability yo make projection for Get1DDiscVar
add ability for TH2D
speed improvements
add Rate $p$-value
unify code with SampleSummary
Definition at line 23 of file PredictiveThrower.h.
PredictiveThrower::PredictiveThrower | ( | manager *const | fitMan | ) |
Constructor.
fitMan | A pointer to a manager object, which will handle all settings. |
Definition at line 6 of file PredictiveThrower.cpp.
|
virtual |
Destructor.
Definition at line 28 of file PredictiveThrower.cpp.
|
private |
Helper functions to calculate likelihoods using TH1D.
Data | histogram with data distribution for a single sample |
MC | histogram with MC distribution for a single sample |
W2 | histogram with W2 distribution for a single sample |
Definition at line 583 of file PredictiveThrower.cpp.
|
private |
Load existing toys.
Definition at line 191 of file PredictiveThrower.cpp.
|
private |
Produce Chi2 plot for a single sample based on which $p$-value is calculated.
Definition at line 644 of file PredictiveThrower.cpp.
|
private |
Produce posterior predictive distribution.
Definition at line 494 of file PredictiveThrower.cpp.
|
private |
Calculate Posterior Predictive $p$-value.
TODO This can be multithreaded
Definition at line 601 of file PredictiveThrower.cpp.
|
private |
Produce Violin style spectra.
Definition at line 438 of file PredictiveThrower.cpp.
void PredictiveThrower::ProduceToys | ( | ) |
Produce toys by throwing from MCMC.
If we found toys then skip process of making new toys
Setup useful information for toy generation
this store value of parameters sampled from a chain
Definition at line 281 of file PredictiveThrower.cpp.
|
inlineoverridevirtual |
This is not used in this class.
Implements FitterBase.
Definition at line 38 of file PredictiveThrower.h.
void PredictiveThrower::RunPredictiveAnalysis | ( | ) |
Main routine responsible for producing posterior predictive distributions and $p$-value.
Definition at line 534 of file PredictiveThrower.cpp.
|
private |
This set some params to prior value this way you can evaluate errors from subset of errors.
Have ability to not throw legacy matrices
Alternatively vary only selected params
Definition at line 34 of file PredictiveThrower.cpp.
|
private |
Setup sample information.
Definition at line 61 of file PredictiveThrower.cpp.
|
private |
Setup useful variables etc before stating toy generation.
Let's ask the manager what are the file with covariance matrix
Definition at line 105 of file PredictiveThrower.cpp.
|
private |
Vector of Data histograms.
Definition at line 114 of file PredictiveThrower.h.
|
private |
KS: Use Full LLH or only sample contribution based on discussion with Asher we almost always only want the sample likelihood.
Definition at line 90 of file PredictiveThrower.h.
|
private |
Whether it is Prior or Posterior predictive.
Definition at line 94 of file PredictiveThrower.h.
|
private |
Vector of MC histograms per sample and toy experiment. Indexed as [sample][toy].
Definition at line 122 of file PredictiveThrower.h.
|
private |
Vector of MC histograms.
Definition at line 116 of file PredictiveThrower.h.
|
private |
Pointer to El Generico.
Definition at line 111 of file PredictiveThrower.h.
|
private |
KS: Count total number of model parameters which can be used for stuff like BIC.
Definition at line 92 of file PredictiveThrower.h.
|
private |
Number of toys we are generating analysing.
Definition at line 104 of file PredictiveThrower.h.
|
private |
KS: Names of parameter groups that will not be varied.
Definition at line 106 of file PredictiveThrower.h.
|
private |
KS: Index of parameters groups that will be varied.
Definition at line 108 of file PredictiveThrower.h.
|
private |
Penalty term values for each toy by default 0.
Definition at line 130 of file PredictiveThrower.h.
|
private |
Reweighting factors applied for each toy, by default 1.
Definition at line 128 of file PredictiveThrower.h.
|
private |
Name of a single sample.
Definition at line 99 of file PredictiveThrower.h.
|
private |
Maps if sample with given SampleHandler, useful if we have more than one sample in single object.
Definition at line 101 of file PredictiveThrower.h.
|
private |
Number of toys we are generating analysing.
Definition at line 97 of file PredictiveThrower.h.
|
private |
Vector of W² histograms per sample and toy experiment. Indexed as [sample][toy]
Definition at line 125 of file PredictiveThrower.h.
|
private |
Vector of W2 histograms.
Definition at line 118 of file PredictiveThrower.h.