![]() |
MaCh3
2.6.1
Reference Guide
|
Base class for implementing fitting algorithms. More...
#include <Fitters/FitterBase.h>
Public Member Functions | |
| FitterBase (Manager *const fitMan) | |
| Constructor. More... | |
| virtual | ~FitterBase () |
| Destructor for the FitterBase class. More... | |
| void | AddSampleHandler (SampleHandlerInterface *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... | |
| 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. 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 (const std::string &filename="") |
| 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... | |
Protected Member Functions | |
| 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... | |
| std::vector< double > | CalculateBinEdges (double lowerlimit, double upperlimit, int n_points) const |
Protected Attributes | |
| 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< SampleHandlerInterface * > | 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... | |
Base class for implementing fitting algorithms.
This class wraps MaCh3 classes like SampleHandlerInterface and ParameterHandlerBase. It serves as a base for different fitting algorithms and for validation techniques such as LLH scans.
Definition at line 29 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 18 of file FitterBase.cpp.
|
virtual |
| void FitterBase::AddSampleHandler | ( | SampleHandlerInterface * | 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 263 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 299 of file FitterBase.cpp.
|
protected |
Definition at line 606 of file FitterBase.cpp.
|
protected |
KS: Check whether we want to skip parameter using skip vector.
Definition at line 536 of file FitterBase.cpp.
|
protected |
For comparison with other fitting frameworks (like P-Theta) we usually have to apply different parameter values then usual 1, 3 sigma.
Example YAML format:
Definition at line 1351 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 454 of file FitterBase.cpp.
|
inline |
|
protected |
Helper function to get parameter scan range, central value.
Definition at line 543 of file FitterBase.cpp.
|
protected |
YSP: Set up a mapping to store parameters with user-specified ranges, suggested by D. Barrow.
| scanRanges | A map with user specified parameter ranges |
Definition at line 516 of file FitterBase.cpp.
| void FitterBase::GetStepScaleBasedOnLLHScan | ( | const std::string & | filename = "" | ) |
LLH scan is good first estimate of step scale.
| filename | by default empty, however if specified it will allow to load LLH scan from external file |
Definition at line 906 of file FitterBase.cpp.
|
protected |
Prepare the output file.
Definition at line 154 of file FitterBase.cpp.
|
protected |
Process MCMC output.
Definition at line 407 of file FitterBase.cpp.
| void FitterBase::Run2DLLHScan | ( | ) |
Perform a 2D likelihood scan.
Definition at line 968 of file FitterBase.cpp.
| void FitterBase::RunLLHMap | ( | ) |
Perform a general multi-dimensional likelihood scan.
Definition at line 1099 of file FitterBase.cpp.
| void FitterBase::RunLLHScan | ( | ) |
Perform a 1D likelihood scan.
Definition at line 622 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 PyLikelihoodFit, PyFitterBase, NuDockServerBase, PredictiveThrower, PSO, MinuitFit, and MCMCBase.
| void FitterBase::RunSigmaVar | ( | ) |
Perform a 1D/2D sigma var for all samples.
Apply custom range to make easier comparison with p-theta
Definition at line 1445 of file FitterBase.cpp.
|
protected |
Remove obsolete memory and make other checks before fit starts.
Definition at line 224 of file FitterBase.cpp.
|
protected |
Save output and close files.
Definition at line 232 of file FitterBase.cpp.
|
protected |
Save the settings that the MCMC was run with.
Definition at line 80 of file FitterBase.cpp.
|
virtual |
Allow to start from previous fit/chain.
| FitName | Name of previous chain |
Reimplemented in MCMCBase.
Definition at line 349 of file FitterBase.cpp.
|
protected |
counts accepted steps
Definition at line 128 of file FitterBase.h.
|
protected |
current acceptance prob
Definition at line 126 of file FitterBase.h.
|
protected |
Name of fitting algorithm that is being used.
Definition at line 177 of file FitterBase.h.
|
protected |
auto save every N steps
Definition at line 164 of file FitterBase.h.
|
protected |
tells global time how long fit took
Definition at line 146 of file FitterBase.h.
|
protected |
Output cov folder.
Definition at line 158 of file FitterBase.h.
|
protected |
Checks if file saved not repeat some operations.
Definition at line 170 of file FitterBase.h.
|
protected |
The manager for configuration handling.
Definition at line 117 of file FitterBase.h.
|
protected |
Necessary for some fitting algorithms like PSO.
Definition at line 167 of file FitterBase.h.
|
protected |
current likelihood
Definition at line 122 of file FitterBase.h.
|
protected |
proposed likelihood
Definition at line 124 of file FitterBase.h.
|
protected |
Output.
Definition at line 156 of file FitterBase.h.
|
protected |
Checks if output prepared not repeat some operations.
Definition at line 174 of file FitterBase.h.
|
protected |
Output tree with posteriors.
Definition at line 162 of file FitterBase.h.
|
protected |
Random number.
Definition at line 153 of file FitterBase.h.
|
protected |
store the llh breakdowns
Definition at line 133 of file FitterBase.h.
|
protected |
Output sample folder.
Definition at line 160 of file FitterBase.h.
|
protected |
Sample holder.
Definition at line 138 of file FitterBase.h.
|
protected |
Checks if setting saved not repeat some operations.
Definition at line 172 of file FitterBase.h.
|
protected |
current state
Definition at line 120 of file FitterBase.h.
|
protected |
tells how long single step/fit iteration took
Definition at line 148 of file FitterBase.h.
|
protected |
step start, by default 0 if we start from previous chain then it will be different
Definition at line 130 of file FitterBase.h.
|
protected |
Time of single step.
Definition at line 150 of file FitterBase.h.
|
protected |
systematic llh breakdowns
Definition at line 135 of file FitterBase.h.
|
protected |
Systematic holder.
Definition at line 143 of file FitterBase.h.
|
protected |
Total number of samples used, single SampleHandler can store more than one analysis sample!
Definition at line 140 of file FitterBase.h.