![]() |
MaCh3 2.2.1
Reference Guide
|
Base class for implementing fitting algorithms. More...
#include <Fitters/FitterBase.h>
Public Member Functions | |
FitterBase (manager *const fitMan) | |
Constructor. | |
virtual | ~FitterBase () |
Destructor for the FitterBase class. | |
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. | |
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. | |
virtual void | RunMCMC ()=0 |
The specific fitting algorithm implemented in this function depends on the derived class. It could be Markov Chain Monte Carlo (MCMC), MinuitFit, or another algorithm. | |
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. | |
void | RunLLHScan () |
Perform a 1D likelihood scan. | |
void | GetStepScaleBasedOnLLHScan () |
LLH scan is good first estimate of step scale. | |
void | Run2DLLHScan () |
Perform a 2D likelihood scan. | |
void | RunSigmaVar () |
Perform a 2D and 1D sigma var for all samples. | |
virtual void | StartFromPreviousFit (const std::string &FitName) |
Allow to start from previous fit/chain. | |
virtual std::string | GetName () const |
Get name of class. | |
Protected Member Functions | |
void | ProcessMCMC () |
Process MCMC output. | |
void | PrepareOutput () |
Prepare the output file. | |
void | SaveOutput () |
Save output and close files. | |
void | SanitiseInputs () |
Remove obsolete memory and make other checks before fit starts. | |
void | SaveSettings () |
Save the settings that the MCMC was run with. | |
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. | |
bool | CheckSkipParameter (const std::vector< std::string > &SkipVector, const std::string &ParamName) const |
KS: Check whether we want to skip parameter using skip vector. | |
Protected Attributes | |
manager * | fitMan |
The manager. | |
unsigned int | step |
current state | |
double | logLCurr |
current likelihood | |
double | logLProp |
proposed likelihood | |
double | accProb |
current acceptance prob | |
int | accCount |
counts accepted steps | |
int | stepStart |
step start if restarting | |
std::vector< double > | sample_llh |
store the llh breakdowns | |
std::vector< double > | syst_llh |
systematic llh breakdowns | |
std::vector< SampleHandlerBase * > | samples |
Sample holder. | |
unsigned int | TotalNSamples |
Total number of samples used. | |
std::vector< ParameterHandlerBase * > | systematics |
Systematic holder. | |
std::unique_ptr< TStopwatch > | clock |
tells global time how long fit took | |
std::unique_ptr< TStopwatch > | stepClock |
tells how long single step/fit iteration took | |
double | stepTime |
Time of single step. | |
std::unique_ptr< TRandom3 > | random |
Random number. | |
TFile * | outputFile |
Output. | |
TDirectory * | CovFolder |
Output cov folder. | |
TDirectory * | SampleFolder |
Output sample folder. | |
TTree * | outTree |
Output tree with posteriors. | |
int | auto_save |
auto save every N steps | |
bool | fTestLikelihood |
Necessary for some fitting algorithms like PSO. | |
bool | FileSaved |
Checks if file saved not repeat some operations. | |
bool | SettingsSaved |
Checks if setting saved not repeat some operations. | |
bool | OutputPrepared |
Checks if output prepared not repeat some operations. | |
Base class for implementing fitting algorithms.
Definition at line 23 of file FitterBase.h.
_MaCh3_Safe_Include_Start_ _MaCh3_Safe_Include_End_ FitterBase::FitterBase | ( | manager *const | fitMan | ) |
Constructor.
fitMan | A pointer to a manager object, which will handle all settings. |
Definition at line 15 of file FitterBase.cpp.
|
virtual |
Destructor for the FitterBase class.
Definition at line 71 of file FitterBase.cpp.
void FitterBase::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.
sample | A pointer to a sample PDF object derived from ParameterHandlerBase. |
Definition at line 246 of file FitterBase.cpp.
void FitterBase::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.
cov | A pointer to a Covariance object derived from ParameterHandlerBase. |
Definition at line 267 of file FitterBase.cpp.
|
protected |
KS: Check whether we want to skip parameter using skip vector.
Definition at line 500 of file FitterBase.cpp.
void FitterBase::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.
NLaps | number of laps, every part of Fitter will be tested with given number of laps and you will get total and average time |
Definition at line 418 of file FitterBase.cpp.
|
inlinevirtual |
Get name of class.
Reimplemented in LikelihoodFit, mcmc, MinuitFit, PSO, and PyFitterBase.
Definition at line 66 of file FitterBase.h.
|
protected |
YSP: Set up a mapping to store parameters with user-specified ranges, suggested by D. Barrow.
Definition at line 480 of file FitterBase.cpp.
void FitterBase::GetStepScaleBasedOnLLHScan | ( | ) |
LLH scan is good first estimate of step scale.
Definition at line 826 of file FitterBase.cpp.
|
protected |
Prepare the output file.
Definition at line 148 of file FitterBase.cpp.
|
protected |
Process MCMC output.
Definition at line 371 of file FitterBase.cpp.
void FitterBase::Run2DLLHScan | ( | ) |
Perform a 2D likelihood scan.
Definition at line 875 of file FitterBase.cpp.
void FitterBase::RunLLHScan | ( | ) |
Perform a 1D likelihood scan.
Definition at line 516 of file FitterBase.cpp.
|
pure virtual |
The specific fitting algorithm implemented in this function depends on the derived class. It could be Markov Chain Monte Carlo (MCMC), MinuitFit, or another algorithm.
Implemented in mcmc, MinuitFit, PSO, PyFitterBase, PyLikelihoodFit, and LikelihoodFit.
void FitterBase::RunSigmaVar | ( | ) |
Perform a 2D and 1D sigma var for all samples.
Definition at line 1043 of file FitterBase.cpp.
|
protected |
Remove obsolete memory and make other checks before fit starts.
Definition at line 213 of file FitterBase.cpp.
|
protected |
Save output and close files.
Definition at line 221 of file FitterBase.cpp.
|
protected |
Save the settings that the MCMC was run with.
Definition at line 82 of file FitterBase.cpp.
|
virtual |
Allow to start from previous fit/chain.
FitName | Name of previous chain |
Reimplemented in mcmc.
Definition at line 295 of file FitterBase.cpp.
|
protected |
counts accepted steps
Definition at line 103 of file FitterBase.h.
|
protected |
current acceptance prob
Definition at line 101 of file FitterBase.h.
|
protected |
auto save every N steps
Definition at line 139 of file FitterBase.h.
|
protected |
tells global time how long fit took
Definition at line 121 of file FitterBase.h.
|
protected |
Output cov folder.
Definition at line 133 of file FitterBase.h.
|
protected |
Checks if file saved not repeat some operations.
Definition at line 145 of file FitterBase.h.
|
protected |
The manager.
Definition at line 92 of file FitterBase.h.
|
protected |
Necessary for some fitting algorithms like PSO.
Definition at line 142 of file FitterBase.h.
|
protected |
current likelihood
Definition at line 97 of file FitterBase.h.
|
protected |
proposed likelihood
Definition at line 99 of file FitterBase.h.
|
protected |
Output.
Definition at line 131 of file FitterBase.h.
|
protected |
Checks if output prepared not repeat some operations.
Definition at line 149 of file FitterBase.h.
|
protected |
Output tree with posteriors.
Definition at line 137 of file FitterBase.h.
|
protected |
Random number.
Definition at line 128 of file FitterBase.h.
|
protected |
store the llh breakdowns
Definition at line 108 of file FitterBase.h.
|
protected |
Output sample folder.
Definition at line 135 of file FitterBase.h.
|
protected |
Sample holder.
Definition at line 113 of file FitterBase.h.
|
protected |
Checks if setting saved not repeat some operations.
Definition at line 147 of file FitterBase.h.
|
protected |
current state
Definition at line 95 of file FitterBase.h.
|
protected |
tells how long single step/fit iteration took
Definition at line 123 of file FitterBase.h.
|
protected |
step start if restarting
Definition at line 105 of file FitterBase.h.
|
protected |
Time of single step.
Definition at line 125 of file FitterBase.h.
|
protected |
systematic llh breakdowns
Definition at line 110 of file FitterBase.h.
|
protected |
Systematic holder.
Definition at line 118 of file FitterBase.h.
|
protected |
Total number of samples used.
Definition at line 115 of file FitterBase.h.