Belle II Software development
ChebFitter Class Reference

Unbinned Maximum Likelihood fitter with a possibility to use Chebyshev interpolation. More...

#include <ChebFitter.h>

Public Member Functions

void setDataAndFunction (std::function< double(double, Pars)> fun, const std::vector< double > &data)
 Set the fitted data and the fitted function, should be called before init.
 
void init (int Size, double xMin, double xMax)
 Initialize the fitter (the Chebyshev coefficients)
 
double operator() (const double *par) const
 Evaluate the log likelihood.
 
std::pair< Pars, Eigen::MatrixXd > fitData (Pars pars, Limits limits, bool UseCheb=true)
 Fit the data with specified initial values of parameters and limits on them.
 

Private Member Functions

Eigen::VectorXd getLogFunction (Pars pars) const
 Get the -2*log(p(x)) on the Cheb nodes.
 
double getLogLikelihoodSlow (const Pars &pars) const
 Calculate log likelihood using exact formula.
 
double getLogLikelihoodFast (const Pars &pars) const
 Calculate log likelihood using approximation based on Chebyshev polynomials (typically faster)
 
Eigen::VectorXd getDataGrid () const
 Calculate Chebyshev coefficients for the data set.
 
std::pair< Eigen::VectorXd, Eigen::MatrixXd > getDataGridWithCov () const
 Calculate Chebyshev coefficients with the covariance (useful for toy studies)
 
double getFunctionFast (const Pars &pars, double x)
 Evaluate the fitted function approximated with the Chebyshev polynomial, typically runs faster.
 

Private Attributes

std::vector< double > m_data
 vector with the data points to be fitted
 
Eigen::VectorXd m_dataGrid
 vector with the data points related to the cheb nodes (m_dataGrid.size = nodes.size)
 
Eigen::MatrixXd m_dataGridCov
 vector with the data points covariances (useful for toy studies)
 
Eigen::MatrixXd m_coefsMat
 transformation matrix from chebPol to gridPoints
 
Eigen::VectorXd m_nodes
 vector with cheb nodes
 
Eigen::VectorXd m_weights
 vector with cheb weights for integration
 
std::vector< std::string > m_parNames
 vector with names of the parameters
 
bool m_useCheb = true
 flag to use approximation based on Chebyshev polynomials
 
std::function< double(double, Pars)> m_myFun
 function to fit
 

Detailed Description

Unbinned Maximum Likelihood fitter with a possibility to use Chebyshev interpolation.

Definition at line 32 of file ChebFitter.h.

Member Function Documentation

◆ setDataAndFunction()

void setDataAndFunction ( std::function< double(double, Pars)>  fun,
const std::vector< double > &  data 
)
inline

Set the fitted data and the fitted function, should be called before init.

Definition at line 37 of file ChebFitter.h.

38 {
39 m_myFun = fun;
40 m_data = data;
41 }
std::vector< double > m_data
vector with the data points to be fitted
Definition: ChebFitter.h:78
std::function< double(double, Pars)> m_myFun
function to fit
Definition: ChebFitter.h:89

Member Data Documentation

◆ m_coefsMat

Eigen::MatrixXd m_coefsMat
private

transformation matrix from chebPol to gridPoints

Definition at line 81 of file ChebFitter.h.

◆ m_data

std::vector<double> m_data
private

vector with the data points to be fitted

Definition at line 78 of file ChebFitter.h.

◆ m_dataGrid

Eigen::VectorXd m_dataGrid
private

vector with the data points related to the cheb nodes (m_dataGrid.size = nodes.size)

Definition at line 79 of file ChebFitter.h.

◆ m_dataGridCov

Eigen::MatrixXd m_dataGridCov
private

vector with the data points covariances (useful for toy studies)

Definition at line 80 of file ChebFitter.h.

◆ m_myFun

std::function<double(double, Pars)> m_myFun
private

function to fit

Definition at line 89 of file ChebFitter.h.

◆ m_nodes

Eigen::VectorXd m_nodes
private

vector with cheb nodes

Definition at line 83 of file ChebFitter.h.

◆ m_parNames

std::vector<std::string> m_parNames
private

vector with names of the parameters

Definition at line 86 of file ChebFitter.h.

◆ m_useCheb

bool m_useCheb = true
private

flag to use approximation based on Chebyshev polynomials

Definition at line 87 of file ChebFitter.h.

◆ m_weights

Eigen::VectorXd m_weights
private

vector with cheb weights for integration

Definition at line 84 of file ChebFitter.h.


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