Belle II Software  release-08-01-10
BaseFitObject Class Referenceabstract
Inheritance diagram for BaseFitObject:

Public Member Functions

 BaseFitObject ()
 Default constructor.
 
 BaseFitObject (const BaseFitObject &rhs)
 Copy constructor. More...
 
BaseFitObjectoperator= (const BaseFitObject &rhs)
 Assignment. More...
 
virtual ~BaseFitObject ()
 Virtual destructor.
 
virtual BaseFitObjectcopy () const =0
 Return a new copy of itself.
 
virtual BaseFitObjectassign (const BaseFitObject &source)
 Assign from anther object, if of same type. More...
 
virtual bool setParam (int ilocal, double par_, bool measured_, bool fixed_=false)
 Set value and measured flag of parameter i; return: significant change. More...
 
virtual bool setParam (int ilocal, double par_)
 Set value of parameter ilocal; return: significant change. More...
 
virtual bool updateParams (double p[], int idim)
 Read values from global vector, readjust vector; return: significant change. More...
 
virtual bool setMParam (int ilocal, double mpar_)
 Set measured value of parameter ilocal; return: success. More...
 
virtual bool setError (int ilocal, double err_)
 Set error of parameter ilocal; return: success. More...
 
virtual bool setCov (int ilocal, int jlocal, double cov_)
 Set covariance of parameters ilocal and jlocal; return: success. More...
 
virtual bool setGlobalParNum (int ilocal, int iglobal)
 Set number of parameter ilocal in global list return true signals OK. More...
 
virtual bool fixParam (int ilocal, bool fix=true)
 Fix a parameter (fix=true), or release it (fix=false) More...
 
virtual bool releaseParam (int ilocal)
 Release a parameter. More...
 
virtual bool isParamFixed (int ilocal) const
 Returns whether parameter is fixed. More...
 
virtual double getParam (int ilocal) const
 Get current value of parameter ilocal. More...
 
virtual const char * getParamName (int ilocal) const =0
 Get name of parameter ilocal. More...
 
virtual const char * getName () const
 Get object's name.
 
void setName (const char *name_)
 Set object's name.
 
virtual double getMParam (int ilocal) const
 Get measured value of parameter ilocal. More...
 
virtual double getError (int ilocal) const
 Get error of parameter ilocal. More...
 
virtual double getCov (int ilocal, int jlocal) const
 Get covariance between parameters ilocal and jlocal. More...
 
virtual double getRho (int ilocal, int jlocal) const
 Get correlation coefficient between parameters ilocal and jlocal. More...
 
virtual bool isParamMeasured (int ilocal) const
 Get measured flag for parameter ilocal. More...
 
virtual int getGlobalParNum (int ilocal) const
 Get global parameter number of parameter ilocal. More...
 
virtual int getNPar () const =0
 Get total number of parameters of this FitObject.
 
virtual int getNMeasured () const
 Get number of measured parameters of this FitObject.
 
virtual int getNUnmeasured () const
 Get number of unmeasured parameters of this FitObject.
 
virtual int getNFree () const
 Get number of free parameters of this FitObject.
 
virtual int getNFixed () const
 Get number of fixed parameters of this FitObject.
 
virtual double getChi2 () const
 Get chi squared from measured and fitted parameters.
 
virtual double getDChi2DParam (int ilocal) const
 Get derivative of chi squared w.r.t. parameter ilocal. More...
 
virtual double getD2Chi2DParam2 (int ilocal, int jlocal) const
 Get second derivative of chi squared w.r.t. parameters ilocal1 and ilocal2. More...
 
virtual std::ostream & printParams (std::ostream &os) const
 print the parameters and errors More...
 
virtual std::ostream & printRhoValues (std::ostream &os) const
 print the correlation coefficients More...
 
virtual std::ostream & print1stDerivatives (std::ostream &os) const
 print the 1st derivatives wrt metaSet 0 (E, px, py, pz) More...
 
virtual std::ostream & print2ndDerivatives (std::ostream &os) const
 print the 2nd derivatives wrt metaSet 0 (E, px, py, pz) More...
 
virtual std::ostream & print (std::ostream &os) const =0
 print object to ostream More...
 
void invalidateCache () const
 invalidate any cached quantities
 
virtual void updateCache () const =0
 
virtual void addToGlobCov (double *glcov, int idim) const
 Add covariance matrix elements to global covariance matrix of size idim x idim. More...
 
virtual int addToGlobalChi2DerVector (double *y, int idim) const
 Add derivatives of chi squared to global derivative vector. More...
 
virtual void addToGlobalChi2DerMatrix (double *M, int idim) const
 Add 2nd derivatives of chi squared to global derivative matrix. More...
 
virtual void addToGlobalChi2DerVector (double *y, int idim, double lambda, double der[], int metaSet) const
 Add derivatives of momentum vector to global derivative vector. More...
 
virtual void addTo1stDerivatives (double M[], int idim, double der[], int kglobal, int metaSet) const
 
virtual void addTo2ndDerivatives (double der2[], int idim, double factor[], int metaSet) const
 
virtual void addTo2ndDerivatives (double M[], int idim, double lambda, double der[], int metaSet) const
 
virtual double getFirstDerivative_Meta_Local (int iMeta, int ilocal, int metaSet) const =0
 
virtual double getSecondDerivative_Meta_Local (int iMeta, int ilocal, int jlocal, int metaSet) const =0
 
virtual void initCov ()
 
virtual double getError2 (double der[], int metaset) const
 
virtual void getDerivatives (double der[], int idim) const =0
 

Protected Member Functions

virtual bool calculateCovInv () const
 Calculate the inverse of the covariance matrix.
 

Protected Attributes

char * name
 
double par [BaseDefs::MAXPAR]
 fit parameters
 
double mpar [BaseDefs::MAXPAR]
 measured parameters
 
bool measured [BaseDefs::MAXPAR]
 measured flag
 
bool fixed [BaseDefs::MAXPAR]
 fixed flag
 
int globalParNum [BaseDefs::MAXPAR]
 global parameter number for each parameter
 
double cov [BaseDefs::MAXPAR][BaseDefs::MAXPAR]
 local covariance matrix
 
double covinv [BaseDefs::MAXPAR][BaseDefs::MAXPAR]
 inverse pf local covariance matrix
 
bool covinvvalid
 flag for valid inverse covariance matrix
 
bool cachevalid
 flag for valid cache
 

Static Protected Attributes

static const double eps2 = 0.0001
 

Related Functions

(Note that these are not member functions.)

std::ostream & operator<< (std::ostream &os, const BaseFitObject &bfo)
 Prints out a BaseFitObject, using its print method. More...
 

Detailed Description

Definition at line 91 of file BaseFitObject.h.

Constructor & Destructor Documentation

◆ BaseFitObject()

BaseFitObject ( const BaseFitObject rhs)

Copy constructor.

Parameters
rhsright hand side

Definition at line 54 of file BaseFitObject.cc.

55  : name(nullptr), par{}, mpar{}, measured{}, fixed{}, globalParNum{}, cov{}, covinv{}, covinvvalid(false), cachevalid(false)
56  {
58  }
bool covinvvalid
flag for valid inverse covariance matrix
bool fixed[BaseDefs::MAXPAR]
fixed flag
virtual BaseFitObject & assign(const BaseFitObject &source)
Assign from anther object, if of same type.
double covinv[BaseDefs::MAXPAR][BaseDefs::MAXPAR]
inverse pf local covariance matrix
bool cachevalid
flag for valid cache
int globalParNum[BaseDefs::MAXPAR]
global parameter number for each parameter
double par[BaseDefs::MAXPAR]
fit parameters
double mpar[BaseDefs::MAXPAR]
measured parameters
double cov[BaseDefs::MAXPAR][BaseDefs::MAXPAR]
local covariance matrix
bool measured[BaseDefs::MAXPAR]
measured flag

Member Function Documentation

◆ addToGlobalChi2DerMatrix()

void addToGlobalChi2DerMatrix ( double *  M,
int  idim 
) const
virtual

Add 2nd derivatives of chi squared to global derivative matrix.

Parameters
MGlobal derivative matrix
idimFirst dimension of global derivative matrix

Definition at line 462 of file BaseFitObject.cc.

◆ addToGlobalChi2DerVector() [1/2]

int addToGlobalChi2DerVector ( double *  y,
int  idim 
) const
virtual

Add derivatives of chi squared to global derivative vector.

Parameters
yVector of chi2 derivatives
idimVector size

Definition at line 482 of file BaseFitObject.cc.

◆ addToGlobalChi2DerVector() [2/2]

void addToGlobalChi2DerVector ( double *  y,
int  idim,
double  lambda,
double  der[],
int  metaSet 
) const
virtual

Add derivatives of momentum vector to global derivative vector.

Parameters
yVector of chi2 derivatives
idimVector size
lambdaThe lambda value
derderivatives of constraint wrt intermediate variables (e.g. 4-vector with dg/dE, dg/dpx, dg/dpy, dg/dpz)
metaSetwhich set of intermediate variables

Definition at line 498 of file BaseFitObject.cc.

◆ addToGlobCov()

void addToGlobCov ( double *  glcov,
int  idim 
) const
virtual

Add covariance matrix elements to global covariance matrix of size idim x idim.

Parameters
glcovGlobal covariance matrix
idimFirst dimension of global derivative matrix

Definition at line 217 of file BaseFitObject.cc.

◆ assign()

BaseFitObject & assign ( const BaseFitObject source)
virtual

Assign from anther object, if of same type.

Parameters
sourceThe source object

Reimplemented in PxPyPzMFitObject, ParticleFitObject, NeutrinoFitObject, JetFitObject, and ISRPhotonFitObject.

Definition at line 68 of file BaseFitObject.cc.

◆ fixParam()

bool fixParam ( int  ilocal,
bool  fix = true 
)
virtual

Fix a parameter (fix=true), or release it (fix=false)

Parameters
ilocalLocal parameter number
fixfix if true, release if false

Definition at line 352 of file BaseFitObject.cc.

◆ getCov()

double getCov ( int  ilocal,
int  jlocal 
) const
virtual

Get covariance between parameters ilocal and jlocal.

Parameters
ilocalLocal parameter number i
jlocalLocal parameter number j

Reimplemented in JetFitObject.

Definition at line 389 of file BaseFitObject.cc.

◆ getD2Chi2DParam2()

double getD2Chi2DParam2 ( int  ilocal,
int  jlocal 
) const
virtual

Get second derivative of chi squared w.r.t. parameters ilocal1 and ilocal2.

Parameters
ilocalLocal parameter number i
jlocalLocal parameter number j

Definition at line 449 of file BaseFitObject.cc.

◆ getDChi2DParam()

double getDChi2DParam ( int  ilocal) const
virtual

Get derivative of chi squared w.r.t. parameter ilocal.

Parameters
ilocalLocal parameter number

Definition at line 435 of file BaseFitObject.cc.

◆ getError()

double getError ( int  ilocal) const
virtual

Get error of parameter ilocal.

Parameters
ilocalLocal parameter number

Reimplemented in JetFitObject.

Definition at line 383 of file BaseFitObject.cc.

◆ getGlobalParNum()

int getGlobalParNum ( int  ilocal) const
virtual

Get global parameter number of parameter ilocal.

Parameters
ilocalLocal parameter number

Definition at line 365 of file BaseFitObject.cc.

◆ getMParam()

double getMParam ( int  ilocal) const
virtual

Get measured value of parameter ilocal.

Parameters
ilocalLocal parameter number

Definition at line 377 of file BaseFitObject.cc.

◆ getParam()

double getParam ( int  ilocal) const
virtual

Get current value of parameter ilocal.

Parameters
ilocalLocal parameter number

Definition at line 371 of file BaseFitObject.cc.

◆ getParamName()

virtual const char* getParamName ( int  ilocal) const
pure virtual

Get name of parameter ilocal.

Parameters
ilocalLocal parameter number

Implemented in PxPyPzMFitObject, NeutrinoFitObject, JetFitObject, and ISRPhotonFitObject.

◆ getRho()

double getRho ( int  ilocal,
int  jlocal 
) const
virtual

Get correlation coefficient between parameters ilocal and jlocal.

Parameters
ilocalLocal parameter number i
jlocalLocal parameter number j

Definition at line 396 of file BaseFitObject.cc.

◆ isParamFixed()

bool isParamFixed ( int  ilocal) const
virtual

Returns whether parameter is fixed.

Parameters
ilocalLocal parameter number

Definition at line 408 of file BaseFitObject.cc.

◆ isParamMeasured()

bool isParamMeasured ( int  ilocal) const
virtual

Get measured flag for parameter ilocal.

Parameters
ilocalLocal parameter number

Definition at line 402 of file BaseFitObject.cc.

◆ operator=()

BaseFitObject & operator= ( const BaseFitObject rhs)

Assignment.

Parameters
rhsright hand side

Definition at line 60 of file BaseFitObject.cc.

◆ print()

virtual std::ostream& print ( std::ostream &  os) const
pure virtual

print object to ostream

Parameters
osThe output stream

Implemented in ParticleFitObject.

◆ print1stDerivatives()

std::ostream & print1stDerivatives ( std::ostream &  os) const
virtual

print the 1st derivatives wrt metaSet 0 (E, px, py, pz)

Parameters
osThe output stream

Definition at line 164 of file BaseFitObject.cc.

◆ print2ndDerivatives()

std::ostream & print2ndDerivatives ( std::ostream &  os) const
virtual

print the 2nd derivatives wrt metaSet 0 (E, px, py, pz)

Parameters
osThe output stream

Definition at line 178 of file BaseFitObject.cc.

◆ printParams()

std::ostream & printParams ( std::ostream &  os) const
virtual

print the parameters and errors

Parameters
osThe output stream

Definition at line 137 of file BaseFitObject.cc.

◆ printRhoValues()

std::ostream & printRhoValues ( std::ostream &  os) const
virtual

print the correlation coefficients

Parameters
osThe output stream

Definition at line 151 of file BaseFitObject.cc.

◆ releaseParam()

virtual bool releaseParam ( int  ilocal)
inlinevirtual

Release a parameter.

Parameters
ilocalLocal parameter number

Definition at line 157 of file BaseFitObject.h.

159  { return fixParam(ilocal, false); }
virtual bool fixParam(int ilocal, bool fix=true)
Fix a parameter (fix=true), or release it (fix=false)

◆ setCov()

bool setCov ( int  ilocal,
int  jlocal,
double  cov_ 
)
virtual

Set covariance of parameters ilocal and jlocal; return: success.

Parameters
ilocalLocal parameter number
jlocalLocal parameter number
cov_New error value

Definition at line 340 of file BaseFitObject.cc.

◆ setError()

bool setError ( int  ilocal,
double  err_ 
)
virtual

Set error of parameter ilocal; return: success.

Parameters
ilocalLocal parameter number
err_New error value

Definition at line 330 of file BaseFitObject.cc.

◆ setGlobalParNum()

bool setGlobalParNum ( int  ilocal,
int  iglobal 
)
virtual

Set number of parameter ilocal in global list return true signals OK.

Parameters
ilocalLocal parameter number
iglobalNew global parameter number

Definition at line 358 of file BaseFitObject.cc.

◆ setMParam()

bool setMParam ( int  ilocal,
double  mpar_ 
)
virtual

Set measured value of parameter ilocal; return: success.

Parameters
ilocalLocal parameter number
mpar_New measured parameter value

Definition at line 320 of file BaseFitObject.cc.

◆ setParam() [1/2]

bool setParam ( int  ilocal,
double  par_ 
)
virtual

Set value of parameter ilocal; return: significant change.

Parameters
ilocalLocal parameter number
par_New parameter value

Definition at line 309 of file BaseFitObject.cc.

◆ setParam() [2/2]

bool setParam ( int  ilocal,
double  par_,
bool  measured_,
bool  fixed_ = false 
)
virtual

Set value and measured flag of parameter i; return: significant change.

Parameters
ilocalLocal parameter number
par_New parameter value
measured_New "measured" flag
fixed_New "fixed" flag

Definition at line 299 of file BaseFitObject.cc.

◆ updateParams()

bool updateParams ( double  p[],
int  idim 
)
virtual

Read values from global vector, readjust vector; return: significant change.

Parameters
pThe parameter vector
idimLength of the vector

Reimplemented in PxPyPzMFitObject, NeutrinoFitObject, JetFitObject, and ISRPhotonFitObject.

Definition at line 196 of file BaseFitObject.cc.

Friends And Related Function Documentation

◆ operator<<()

std::ostream & operator<< ( std::ostream &  os,
const BaseFitObject bfo 
)
related

Prints out a BaseFitObject, using its print method.

Parameters
osThe output stream
bfoThe object to print

Definition at line 341 of file BaseFitObject.h.


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