17#ifndef __BASEFITOBJECT_H
18#define __BASEFITOBJECT_H
22#include "analysis/OrcaKinFit/BaseDefs.h"
89 namespace OrcaKinFit {
141 virtual bool setCov(
int ilocal,
173 virtual const char*
getName()
const;
175 void setName(
const char* name_);
183 virtual double getCov(
int ilocal,
187 virtual double getRho(
int ilocal,
208 virtual double getChi2()
const;
236 virtual std::ostream&
print(std::ostream& os
242 virtual void updateCache()
const = 0;
274 virtual void addTo1stDerivatives(
double M[],
281 virtual void addTo2ndDerivatives(
double der2[],
int idim,
double factor[],
int metaSet)
const;
282 virtual void addTo2ndDerivatives(
double M[],
int idim,
double lambda,
double der[],
int metaSet)
const;
287 virtual double getFirstDerivative_Meta_Local(
int iMeta,
292 virtual double getSecondDerivative_Meta_Local(
int iMeta,
298 virtual void initCov();
300 virtual double getError2(
double der[],
int metaset)
const;
302 virtual void getDerivatives(
double der[],
int idim)
const = 0;
307 const static double eps2;
317 double par[BaseDefs::MAXPAR];
327 double cov [BaseDefs::MAXPAR][BaseDefs::MAXPAR];
329 mutable double covinv [BaseDefs::MAXPAR][BaseDefs::MAXPAR];
341 inline std::ostream& operator<< (std::ostream& os,
345 return bfo.
print(os);
bool covinvvalid
flag for valid inverse covariance matrix
virtual ~BaseFitObject()
Virtual destructor.
virtual bool updateParams(double p[], int idim)
Read values from global vector, readjust vector; return: significant change.
BaseFitObject & operator=(const BaseFitObject &rhs)
Assignment.
virtual int getNPar() const =0
Get total number of parameters of this FitObject.
virtual void addToGlobalChi2DerMatrix(double *M, int idim) const
Add 2nd derivatives of chi squared to global derivative matrix.
virtual const char * getParamName(int ilocal) const =0
Get name of parameter ilocal.
BaseFitObject()
Default constructor.
bool fixed[BaseDefs::MAXPAR]
fixed flag
virtual BaseFitObject & assign(const BaseFitObject &source)
Assign from anther object, if of same type.
virtual double getError(int ilocal) const
Get error of parameter ilocal.
virtual double getRho(int ilocal, int jlocal) const
Get correlation coefficient between parameters ilocal and jlocal.
virtual std::ostream & printRhoValues(std::ostream &os) const
print the correlation coefficients
virtual int getNFixed() const
Get number of fixed parameters of this FitObject.
virtual bool setParam(int ilocal, double par_, bool measured_, bool fixed_=false)
Set value and measured flag of parameter i; return: significant change.
void setName(const char *name_)
Set object's name.
double covinv[BaseDefs::MAXPAR][BaseDefs::MAXPAR]
inverse pf local covariance matrix
virtual double getCov(int ilocal, int jlocal) const
Get covariance between parameters ilocal and jlocal.
virtual double getChi2() const
Get chi squared from measured and fitted parameters.
virtual double getD2Chi2DParam2(int ilocal, int jlocal) const
Get second derivative of chi squared w.r.t. parameters ilocal1 and ilocal2.
bool cachevalid
flag for valid cache
virtual bool fixParam(int ilocal, bool fix=true)
Fix a parameter (fix=true), or release it (fix=false)
int globalParNum[BaseDefs::MAXPAR]
global parameter number for each parameter
virtual bool setCov(int ilocal, int jlocal, double cov_)
Set covariance of parameters ilocal and jlocal; return: success.
virtual std::ostream & print(std::ostream &os) const =0
print object to ostream
virtual int getGlobalParNum(int ilocal) const
Get global parameter number of parameter ilocal.
virtual bool setMParam(int ilocal, double mpar_)
Set measured value of parameter ilocal; return: success.
virtual const char * getName() const
Get object's name.
virtual int getNUnmeasured() const
Get number of unmeasured parameters of this FitObject.
virtual std::ostream & print1stDerivatives(std::ostream &os) const
print the 1st derivatives wrt metaSet 0 (E, px, py, pz)
virtual bool isParamFixed(int ilocal) const
Returns whether parameter is fixed.
double par[BaseDefs::MAXPAR]
fit parameters
virtual std::ostream & print2ndDerivatives(std::ostream &os) const
print the 2nd derivatives wrt metaSet 0 (E, px, py, pz)
void invalidateCache() const
invalidate any cached quantities
double mpar[BaseDefs::MAXPAR]
measured parameters
virtual double getParam(int ilocal) const
Get current value of parameter ilocal.
double cov[BaseDefs::MAXPAR][BaseDefs::MAXPAR]
local covariance matrix
bool measured[BaseDefs::MAXPAR]
measured flag
virtual int addToGlobalChi2DerVector(double *y, int idim) const
Add derivatives of chi squared to global derivative vector.
virtual void addToGlobCov(double *glcov, int idim) const
Add covariance matrix elements to global covariance matrix of size idim x idim.
virtual std::ostream & printParams(std::ostream &os) const
print the parameters and errors
virtual bool calculateCovInv() const
Calculate the inverse of the covariance matrix.
virtual bool isParamMeasured(int ilocal) const
Get measured flag for parameter ilocal.
virtual bool setGlobalParNum(int ilocal, int iglobal)
Set number of parameter ilocal in global list return true signals OK.
virtual bool releaseParam(int ilocal)
Release a parameter.
virtual double getMParam(int ilocal) const
Get measured value of parameter ilocal.
virtual double getDChi2DParam(int ilocal) const
Get derivative of chi squared w.r.t. parameter ilocal.
virtual int getNFree() const
Get number of free parameters of this FitObject.
virtual int getNMeasured() const
Get number of measured parameters of this FitObject.
virtual bool setError(int ilocal, double err_)
Set error of parameter ilocal; return: success.
virtual BaseFitObject * copy() const =0
Return a new copy of itself.
Abstract base class for different kinds of events.