![]() |
MaCh3
2.4.2
Reference Guide
|
Implementation of Prior/Posterior Predictive and Bayesian p-Value calculations following the approach described in [11]. 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... | |
Public Member Functions inherited from FitterBase | |
| 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 | RunLLHMap () |
| Perform a general multi-dimensional 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 1D/2D 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::vector< std::string > | GetStoredFancyName (ParameterHandlerBase *Systematics) const |
| Get Fancy parameters stored in mcmc chains for passed ParameterHandler. More... | |
| std::vector< std::unique_ptr< TH1 > > | MakePredictive (const std::vector< std::vector< std::unique_ptr< TH1 >>> &Toys, const std::vector< TDirectory * > &Director, const std::string &suffix, const bool DebugHistograms) |
| Produce posterior predictive distribution. More... | |
| std::vector< std::vector< std::unique_ptr< TH2D > > > | ProduceSpectra (const std::vector< std::vector< std::unique_ptr< TH1 >>> &Toys, const std::vector< TDirectory * > &Director, const std::string suffix) |
| Produce Violin style spectra. More... | |
| void | PosteriorPredictivepValue (const std::vector< std::unique_ptr< TH1 >> &PostPred_mc, const std::vector< TDirectory * > &SampleDir) |
| Calculate Posterior Predictive $p$-value. More... | |
| double | GetLLH (const std::unique_ptr< TH1 > &DatHist, const std::unique_ptr< TH1 > &MCHist, const std::unique_ptr< TH1 > &W2Hist, const SampleHandlerBase *SampleHandler) |
| Helper functions to calculate likelihoods using TH1. 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... | |
| void | StudyBetaParameters (TDirectory *PredictiveDir) |
| Evaluate prior/post predictive distribution for beta parameters (used for evaluating impact MC statistical uncertainty) 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< PredictiveSample > | SampleInfo |
| Handy struct for all sample info. 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 that will be varied. More... | |
| ParameterHandlerGeneric * | ModelSystematic |
| Pointer to El Generico. More... | |
| std::vector< std::unique_ptr< TH1 > > | Data_Hist |
| Vector of Data histograms. More... | |
| std::vector< std::unique_ptr< TH1 > > | MC_Nom_Hist |
| Vector of MC histograms. More... | |
| std::vector< std::unique_ptr< TH1 > > | W2_Nom_Hist |
| Vector of W2 histograms. More... | |
| std::vector< std::vector< std::unique_ptr< TH1 > > > | MC_Hist_Toy |
| std::vector< std::vector< std::unique_ptr< TH1 > > > | 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 | |
Protected Member Functions inherited from FitterBase | |
| 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 | GetScanRange (std::map< std::string, std::vector< double >> &scanRanges) const |
| YSP: Set up a mapping to store parameters with user-specified ranges, suggested by D. Barrow. More... | |
| void | GetParameterScanRange (const ParameterHandlerBase *cov, const int i, double &CentralValue, double &lower, double &upper, const int n_points, const std::string &suffix="") const |
| Helper function to get parameter scan range, central value. 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) const |
| For comparison with other fitting frameworks (like P-Theta) we usually have to apply different parameter values then usual 1, 3 sigma. More... | |
Protected Attributes inherited from FitterBase | |
| Manager * | fitMan |
| The manager for configuration handling. 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, single SampleHandler can store more than one analysis sample! 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 [11].
For more information, visit the Posterior Predictive page.
add BIC, DIC, WAIC
add ability yo make projection for Get1DDiscVar
Make more flexible for dimensions beyond 2D
speed improvements
add Rate $p$-value
unify code with SampleSummary
Definition at line 42 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 7 of file PredictiveThrower.cpp.
|
virtual |
Destructor.
Definition at line 29 of file PredictiveThrower.cpp.
|
private |
Helper functions to calculate likelihoods using TH1.
| 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 832 of file PredictiveThrower.cpp.
|
private |
Get Fancy parameters stored in mcmc chains for passed ParameterHandler.
Definition at line 294 of file PredictiveThrower.cpp.
|
private |
Load existing toys.
Definition at line 201 of file PredictiveThrower.cpp.
|
private |
Produce Chi2 plot for a single sample based on which $p$-value is calculated.
Definition at line 903 of file PredictiveThrower.cpp.
|
private |
Produce posterior predictive distribution.
Definition at line 689 of file PredictiveThrower.cpp.
|
private |
Calculate Posterior Predictive $p$-value.
TODO This can be multithreaded
Definition at line 850 of file PredictiveThrower.cpp.
|
private |
Produce Violin style spectra.
Definition at line 526 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 331 of file PredictiveThrower.cpp.
|
inlineoverridevirtual |
This is not used in this class.
Implements FitterBase.
Definition at line 57 of file PredictiveThrower.h.
| void PredictiveThrower::RunPredictiveAnalysis | ( | ) |
Main routine responsible for producing posterior predictive distributions and $p$-value.
Definition at line 790 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 35 of file PredictiveThrower.cpp.
|
private |
Setup sample information.
Definition at line 66 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 108 of file PredictiveThrower.cpp.
|
private |
Evaluate prior/post predictive distribution for beta parameters (used for evaluating impact MC statistical uncertainty)
ROOT enumerates from 1 while MaCh3 from 0
Definition at line 945 of file PredictiveThrower.cpp.
|
private |
Vector of Data histograms.
Definition at line 140 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 117 of file PredictiveThrower.h.
|
private |
Whether it is Prior or Posterior predictive.
Definition at line 121 of file PredictiveThrower.h.
|
private |
Vector of MC histograms per sample and toy experiment. Indexed as [sample][toy].
Definition at line 148 of file PredictiveThrower.h.
|
private |
Vector of MC histograms.
Definition at line 142 of file PredictiveThrower.h.
|
private |
Pointer to El Generico.
Definition at line 137 of file PredictiveThrower.h.
|
private |
KS: Count total number of model parameters which can be used for stuff like BIC.
Definition at line 119 of file PredictiveThrower.h.
|
private |
Number of toys we are generating analysing.
Definition at line 130 of file PredictiveThrower.h.
|
private |
KS: Names of parameter groups that will not be varied.
Definition at line 132 of file PredictiveThrower.h.
|
private |
KS: Index of parameters that will be varied.
Definition at line 134 of file PredictiveThrower.h.
|
private |
Penalty term values for each toy by default 0.
Definition at line 156 of file PredictiveThrower.h.
|
private |
Reweighting factors applied for each toy, by default 1.
Definition at line 154 of file PredictiveThrower.h.
|
private |
Handy struct for all sample info.
Definition at line 127 of file PredictiveThrower.h.
|
private |
Number of toys we are generating analysing.
Definition at line 124 of file PredictiveThrower.h.
|
private |
Vector of W² histograms per sample and toy experiment. Indexed as [sample][toy]
Definition at line 151 of file PredictiveThrower.h.
|
private |
Vector of W2 histograms.
Definition at line 144 of file PredictiveThrower.h.