![]() |
MaCh3
2.4.2
Reference Guide
|
Class PSO, consist of a vector of object Class Particle and global best Takes in the size (number of particle) and number of iteration functions includes: finding global best, updating velocity, actual minimisation function. More...
#include <Fitters/PSO.h>
Public Member Functions | |
| PSO (Manager *const fitMan) | |
| constructor More... | |
| virtual | ~PSO () |
| Destructor. More... | |
| particle * | get_best_particle () |
| void | set_best_particle (particle *n) |
| std::vector< std::vector< double > > | bisection (const std::vector< double > &position, const double minimum, const double range, const double precision) |
| std::vector< std::vector< double > > | calc_uncertainty (const std::vector< double > &position, const double minimum) |
| void | init () |
| void | uncertainty_check (const std::vector< double > &previous_pos) |
| void | run () |
| void | WriteOutput () |
| void | RunMCMC () override |
| Actual implementation of PSO Fit algorithm. More... | |
| double | CalcChi2 (const double *x) override |
| Chi2 calculation over all included samples and syst objects. More... | |
| double | rastriginFunc (const double *x) |
| Evaluates the Rastrigin function for a given parameter values. More... | |
| double | swarmIterate () |
| std::vector< double > | vector_multiply (std::vector< double > velocity, const double mul) |
| std::vector< double > | vector_add (const std::vector< double > &v1, const std::vector< double > &v2) |
| std::vector< double > | vector_subtract (const std::vector< double > &v1, const std::vector< double > &v2) |
| std::vector< double > | three_vector_addition (std::vector< double > vec1, const std::vector< double > &vec2, const std::vector< double > &vec3) |
| std::vector< double > | four_vector_addition (std::vector< double > vec1, const std::vector< double > &vec2, const std::vector< double > &vec3, const std::vector< double > &vec4) |
| double | CalcChi (std::vector< double > x) |
Public Member Functions inherited from LikelihoodFit | |
| LikelihoodFit (Manager *const fitMan) | |
| Constructor. More... | |
| virtual | ~LikelihoodFit () |
| Destructor. More... | |
| int | GetNPars () |
| Get total number of params, this sums over all covariance objects. 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 Attributes | |
| particle * | best_particle |
| double | fBestValue |
| std::vector< double > | prior |
| std::vector< bool > | fixed |
| std::vector< double > | ranges_max |
| std::vector< double > | ranges_min |
| std::vector< particle * > | system |
| double | fInertia |
| double | fOne |
| double | fTwo |
| double | fConvergence |
| int | fIterations |
| double | fConstriction |
| std::vector< std::vector< double > > | uncertainties |
| int | fParticles |
| std::vector< double * > | paramlist |
| double | vel [kMaxParticles] |
| double * | par |
| int | fDim |
Static Private Attributes | |
| constexpr static const int | kMaxParticles = 10000 |
Additional Inherited Members | |
Protected Member Functions inherited from LikelihoodFit | |
| void | PrepareFit () |
| prepare output and perform sanity checks More... | |
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 LikelihoodFit | |
| int | NPars |
| Number of all parameters from all covariances. More... | |
| int | NParsPCA |
| Number of all parameters from all covariances in PCA base. More... | |
| bool | fMirroring |
| Flag telling if mirroring is used or not. 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... | |
Class PSO, consist of a vector of object Class Particle and global best Takes in the size (number of particle) and number of iteration functions includes: finding global best, updating velocity, actual minimisation function.
| PSO::PSO | ( | Manager *const | fitMan | ) |
constructor
Definition at line 6 of file PSO.cpp.
| std::vector< std::vector< double > > PSO::bisection | ( | const std::vector< double > & | position, |
| const double | minimum, | ||
| const double | range, | ||
| const double | precision | ||
| ) |
Definition at line 152 of file PSO.cpp.
| std::vector< std::vector< double > > PSO::calc_uncertainty | ( | const std::vector< double > & | position, |
| const double | minimum | ||
| ) |
|
inline |
Definition at line 141 of file PSO.h.
|
overridevirtual |
Chi2 calculation over all included samples and syst objects.
Reimplemented from LikelihoodFit.
Definition at line 530 of file PSO.cpp.
|
inline |
|
inline |
| void PSO::init | ( | ) |
Definition at line 51 of file PSO.cpp.
| double PSO::rastriginFunc | ( | const double * | x | ) |
Evaluates the Rastrigin function for a given parameter values.
Definition at line 540 of file PSO.cpp.
| void PSO::run | ( | ) |
Definition at line 398 of file PSO.cpp.
|
overridevirtual |
Actual implementation of PSO Fit algorithm.
Implements FitterBase.
Definition at line 26 of file PSO.cpp.
|
inline |
| double PSO::swarmIterate | ( | ) |
Definition at line 338 of file PSO.cpp.
|
inline |
| void PSO::uncertainty_check | ( | const std::vector< double > & | previous_pos | ) |
|
inline |
|
inline |
|
inline |
| void PSO::WriteOutput | ( | ) |
Definition at line 443 of file PSO.cpp.
|
staticconstexprprivate |
|
private |