MaCh3 2.2.1
Reference Guide
Loading...
Searching...
No Matches
Public Member Functions | List of all members
PyLikelihoodFit Class Reference

EW: As LikelihoodFit is an abstract base class we have to do some gymnastics to get it to get it into python. More...

Inheritance diagram for PyLikelihoodFit:
[legend]
Collaboration diagram for PyLikelihoodFit:
[legend]

Public Member Functions

void RunMCMC () override
 Implementation of fitting algorithm.
 
 LikelihoodFit (manager *const fitMan)
 Constructor.
 
- Public Member Functions inherited from LikelihoodFit
 LikelihoodFit (manager *const fitMan)
 Constructor.
 
virtual ~LikelihoodFit ()
 Destructor.
 
virtual double CalcChi2 (const double *x)
 Chi2 calculation over all included samples and syst objects.
 
int GetNPars ()
 Get total number of params, this sums over all covariance objects.
 
virtual void RunMCMC ()=0
 Implementation of fitting algorithm.
 
virtual std::string GetName () const
 Get name of class.
 
- Public Member Functions inherited from FitterBase
 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.
 

Additional Inherited Members

- Protected Member Functions inherited from LikelihoodFit
void PrepareFit ()
 prepare output and perform sanity checks
 
- Protected Member Functions inherited from FitterBase
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 inherited from LikelihoodFit
int NPars
 Number of all parameters from all covariances.
 
int NParsPCA
 Number of all parameters from all covariances in PCA base.
 
bool fMirroring
 Flag telling if mirroring is used or not.
 
- Protected Attributes inherited from FitterBase
managerfitMan
 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.
 

Detailed Description

EW: As LikelihoodFit is an abstract base class we have to do some gymnastics to get it to get it into python.

Definition at line 39 of file fitters.cpp.

Member Function Documentation

◆ LikelihoodFit()

LikelihoodFit::LikelihoodFit ( manager *const  fitMan)

Constructor.

Definition at line 9 of file LikelihoodFit.cpp.

5 : FitterBase(man) {
6// *******************
7 NPars = 0;
8 NParsPCA = 0;
9 fMirroring = GetFromManager<bool>(fitMan->raw()["General"]["Fitter"]["Mirroring"], false);
10 if(fMirroring) MACH3LOG_INFO("Mirroring enabled");
11}
MaCh3Plotting::PlottingManager * man
#define MACH3LOG_INFO
Definition: MaCh3Logger.h:23
Base class for implementing fitting algorithms.
Definition: FitterBase.h:23
manager * fitMan
The manager.
Definition: FitterBase.h:92
int NParsPCA
Number of all parameters from all covariances in PCA base.
Definition: LikelihoodFit.h:30
int NPars
Number of all parameters from all covariances.
Definition: LikelihoodFit.h:28
bool fMirroring
Flag telling if mirroring is used or not.
Definition: LikelihoodFit.h:32
YAML::Node const & raw()
Return config.
Definition: Manager.h:41

◆ RunMCMC()

void PyLikelihoodFit::RunMCMC ( )
inlineoverridevirtual

Implementation of fitting algorithm.

Implements LikelihoodFit.

Definition at line 45 of file fitters.cpp.

45 {
46 PYBIND11_OVERRIDE_PURE_NAME(
47 void, /* Return type */
48 LikelihoodFit,/* Parent class */
49 "run", /* Python name*/
50 RunMCMC /* Name of function in C++ (must match Python name) */
51 );
52 }
Implementation of base Likelihood Fit class, it is mostly responsible for likelihood calculation whil...
Definition: LikelihoodFit.h:6
void RunMCMC() override
Implementation of fitting algorithm.
Definition: fitters.cpp:45

The documentation for this class was generated from the following file: