17#ifndef __NEWTONFITTERGSL_H
18#define __NEWTONFITTERGSL_H
20#include "analysis/OrcaKinFit/BaseFitter.h"
22#include <gsl/gsl_vector.h>
23#include <gsl/gsl_matrix.h>
24#include <gsl/gsl_permutation.h>
25#include <gsl/gsl_eigen.h>
36 namespace OrcaKinFit {
46 virtual double fit()
override;
49 virtual int getError()
const override;
54 virtual double getChi2()
const override;
56 virtual int getDoF()
const override;
76 virtual void setDebug(
int debuglevel);
89 void printMy(
const double M[],
const double y[],
int idim);
91 bool updateParams(gsl_vector* xnew);
94 int calcM(
bool errorpropagation =
false);
101 double meritFunction(
double mu);
102 double meritFunctionDeriv();
104 enum {NPARMAX = 50, NCONMAX = 10, NUNMMAX = 10};
116 static void ini_gsl_permutation(gsl_permutation*& p,
unsigned int size);
117 static void ini_gsl_vector(gsl_vector*& v,
int unsigned size);
118 static void ini_gsl_matrix(gsl_matrix*& m,
int unsigned size1,
unsigned int size2);
120 static void debug_print(gsl_matrix* m,
const char* name);
121 static void debug_print(gsl_vector* v,
const char* name);
150 gsl_permutation* permM;
151 gsl_eigen_symmv_workspace* ws;
163 double scalevals[NITMAX];
164 double fvals[NITMAX];
Abstract base class for fitting engines of kinematic fits.
int ncon
total number of hard constraints
int calcDxSVD()
Calculate the vector dx to update the parameters; returns fail code, 0=OK.
int npar
total number of parameters
virtual double calcChi2()
Calculate the chi2.
void printMy(const double M[], const double y[], int idim)
Print a Matrix M and a vector y of dimension idim.
virtual int getNsoft() const
Get the number of soft constraints of the last fit.
NewtonFitterGSL()
Constructor.
virtual double fit() override
The fit method, returns the fit probability.
virtual bool initialize() override
Initialize the fitter.
virtual int getNcon() const
Get the number of hard constraints of the last fit.
double fitprob
fit probability
int nsoft
total number of soft constraints
virtual int getError() const override
Get the error code of the last fit: 0=OK, 1=failed.
int nunm
total number of unmeasured parameters
int calcDx()
Calculate the vector dx to update the parameters; returns fail code, 0=OK.
int nit
Number of iterations.
virtual int getNunm() const
Get the number of unmeasured parameters of the last fit.
virtual int getIterations() const override
Get the number of iterations of the last fit.
virtual double getProbability() const override
Get the fit probability of the last fit.
virtual void setDebug(int debuglevel)
Set the Debug Level.
virtual int getDoF() const override
Get the number of degrees of freedom of the last fit.
virtual double getChi2() const override
Get the chi**2 of the last fit.
virtual int getNpar() const
Get the number of all parameters of the last fit.
virtual ~NewtonFitterGSL()
Virtual destructor.
Abstract base class for different kinds of events.