25 typedef std::map<std::string, double>
Pars;
28 typedef std::map<std::string, std::pair<double, double>>
Limits;
44 void init(
int Size,
double xMin,
double xMax);
51 std::pair<Pars, Eigen::MatrixXd>
fitData(
Pars pars,
Limits limits,
bool UseCheb =
true);
Unbinned Maximum Likelihood fitter with a possibility to use Chebyshev interpolation.
std::vector< double > m_data
vector with the data points to be fitted
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.
bool m_useCheb
flag to use approximation based on Chebyshev polynomials
Eigen::VectorXd m_weights
vector with cheb weights for integration
std::vector< std::string > m_parNames
vector with names of the parameters
std::function< double(double, Pars)> m_myFun
function to fit
Eigen::MatrixXd m_dataGridCov
vector with the data points covariances (useful for toy studies)
Eigen::VectorXd m_dataGrid
vector with the data points related to the cheb nodes (m_dataGrid.size = nodes.size)
Eigen::VectorXd m_nodes
vector with cheb nodes
Eigen::MatrixXd m_coefsMat
transformation matrix from chebPol to gridPoints
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.
double getFunctionFast(const Pars &pars, double x)
Evaluate the fitted function approximated with the Chebyshev polynomial, typically runs faster.
double operator()(const double *par) const
Evaluate the log likelihood.
double getLogLikelihoodSlow(const Pars &pars) const
Calculate log likelihood using exact formula.
std::map< std::string, double > Pars
values of parameters in ML fit
Eigen::VectorXd getDataGrid() const
Calculate Chebyshev coefficients for the data set.
Eigen::VectorXd getLogFunction(Pars pars) const
Get the -2*log(p(x)) on the Cheb nodes.
std::pair< Eigen::VectorXd, Eigen::MatrixXd > getDataGridWithCov() const
Calculate Chebyshev coefficients with the covariance (useful for toy studies)
double getLogLikelihoodFast(const Pars &pars) const
Calculate log likelihood using approximation based on Chebyshev polynomials (typically faster)
std::map< std::string, std::pair< double, double > > Limits
limits of parameters in ML fit
Abstract base class for different kinds of events.