MaCh3  2.4.2
Reference Guide
Classes | Functions
Fitting Algorithms

Available in MaCh3 fitting algorithms. More...

Classes

class  DelayedMR2T2
 Implementation of delayed rejection for MR2T2. More...
 
class  MinuitFit
 Implementation of Minuit fitting algorithm [18]. More...
 
class  MR2T2
 MCMC algorithm implementing the Metropolis–Rosenbluth–Rosenbluth–Teller–Teller (MR \(^2\)T \(^2\)) method. More...
 
class  PSO
 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...
 

Functions

std::unique_ptr< FitterBaseMaCh3FitterFactory (Manager *FitManager)
 MaCh3 Factory initiates one of implemented fitting algorithms. More...
 

Detailed Description

Available in MaCh3 fitting algorithms.

Introduction

MaCh3 provides multiple fitting strategies that fall into two main categories: Markov Chain Monte Carlo samplers and likelihood minimisation algorithms.


Markov Chain Monte Carlo (MCMC)

These algorithms explore parameter space by stochastic sampling of the posterior. They are primarily used for full Bayesian inference and high-dimensional problems.

Implemented methods:


Likelihood Minimizers

These algorithms deterministically minimise the negative log-likelihood to obtain a best-fit point. They are typically much faster than MCMC and are useful for diagnostics, validation, and systematic scans.

Implemented methods:

Factory Method

A factory method is implemented to select the algorithm from the configuration file instead of hard-coding it.

Example configuration:

General:
FittingAlgorithm: "MCMC"

or

General:
FittingAlgorithm: "PSO"

This allows switching algorithms without recompilation.

Function Documentation

◆ MaCh3FitterFactory()

std::unique_ptr<FitterBase> MaCh3FitterFactory ( Manager FitManager)

MaCh3 Factory initiates one of implemented fitting algorithms.

Parameters
FitManagerpointer to Manager class
Note
Example YAML configuration:
General:
FittingAlgorithm: ["MCMC"]

Definition at line 5 of file MaCh3Factory.cpp.

5  {
6 // ********************************************
7  std::unique_ptr<FitterBase> MaCh3Fitter = nullptr;
8 
9  auto Algorithm = GetFromManager<std::string>(fitMan->raw()["General"]["FittingAlgorithm"], "MCMC");
10 
11  if(Algorithm == "MCMC" || Algorithm == "MR2T2")
12  {
13  MaCh3Fitter = std::make_unique<MR2T2>(fitMan);
14  }
15  else if (Algorithm == "DelayedMCMC" || Algorithm == "DelayedMR2T2")
16  {
17  MaCh3Fitter = std::make_unique<DelayedMR2T2>(fitMan);
18  }
19  else if (Algorithm == "PSO")
20  {
21  MaCh3Fitter = std::make_unique<PSO>(fitMan);
22  }
23  else if (Algorithm == "Minuit2")
24  {
25  #ifdef MaCh3_MINUIT2
26  MaCh3Fitter = std::make_unique<MinuitFit>(fitMan);
27  #else
28  MACH3LOG_ERROR("Trying to use Minuit2 however MaCh3 was compiled without Minuit2 support");
29  throw MaCh3Exception(__FILE__ , __LINE__ );
30  #endif
31  }
32  else
33  {
34  MACH3LOG_ERROR("You want to use algorithm {}, I don't recognize it, sry", Algorithm);
35  throw MaCh3Exception(__FILE__ , __LINE__ );
36  }
37  return MaCh3Fitter;
38 }
#define MACH3LOG_ERROR
Definition: MaCh3Logger.h:37
Custom exception class used throughout MaCh3.