Main Page | Class Hierarchy | Compound List | File List | Compound Members | File Members

ParticleFitObject Class Reference

Abstract base class for particle objects of kinematic fits. More...

#include <ParticleFitObject.h>

Inheritance diagram for ParticleFitObject:

Inheritance graph
[legend]
Collaboration diagram for ParticleFitObject:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 ParticleFitObject ()
 Default constructor.

virtual ~ParticleFitObject ()
 Virtual destructor.

virtual bool setParam (int ilocal, double par_, bool measured_, bool fixed_=false)
 Set value and measured flag of parameter ilocal; return=success.

virtual bool setParam (int ilocal, double par_)
 Set value of parameter ilocal; return=success.

virtual bool setMParam (int i, double mpar_)
 Set measured value of parameter ilocal; return=success.

virtual bool setError (int ilocal, double err_)
 Set error of parameter ilocal; return=success.

virtual bool setCov (int ilocal, int jlocal, double cov_)
 Set covariance of parameters ilocal and jlocal; return=success.

virtual bool setMass (double mass_)
 Set mass of particle; return=success.

virtual bool setGlobalParNum (int ilocal, int iglobal)
virtual bool fixParam (int ilocal, bool fix=true)
 Fix a parameter (fix=true), or release it (fix=false).

virtual double * getCovMatrix ()
 Get covariance matrix.

virtual double getParam (int ilocal) const
 Get current value of parameter ilocal.

virtual double getMParam (int iocal) const
 Get measured value of parameter ilocal.

virtual double getError (int ilocal) const
 Get error of parameter ilocal.

virtual double getCov (int ilocal, int jlocal) const
 Get covariance between parameters ilocal and jlocal.

virtual bool isParamMeasured (int ilocal) const
 Get measured flag for parameter i.

virtual bool isParamFixed (int ilocal) const
 Get fixed flag for parameter i.

virtual int getGlobalParNum (int ilocal) const
 Get global parameter number of parameter ilocal.

virtual int getNPar () const
 Get number of parameters of this FitObject.

virtual void addToGlobCov (double *globCov, int idim) const
 Add covariance matrix elements to global covariance matrix.

virtual std::ostream & print4Vector (std::ostream &os) const
 print the four-momentum (E, px, py, pz)

virtual double getPx () const=0
 these depend on actual parametrisation!

virtual double getPy () const=0
virtual double getPz () const=0
virtual double getE () const=0
virtual double getP () const=0
virtual double getP2 () const=0
virtual double getPt () const=0
virtual double getPt2 () const=0
virtual double getDPx (int ilocal) const=0
virtual double getDPy (int ilocal) const=0
virtual double getDPz (int ilocal) const=0
virtual double getDE (int ilocal) const=0
virtual void addToDerivatives (double der[], int idim, double pxfact=0, double pyfact=0, double pzfact=0, double efact=0) const=0
virtual void addTo2ndDerivatives (double der2[], int idim, double pxfact, double pyfact, double pzfact, double efact) const=0
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.

virtual double getD2Chi2DParam2 (int ilocal, int jlocal) const
 Get second derivative of chi squared w.r.t. parameters ilocal and jlocal.

virtual void addToGlobalChi2DerMatrix (int idim, double *M) const
 Add derivatives of chi squared to global covariance matrix.

virtual void addToGlobalDerMatrix (int idim, double c, double *M) const=0
 Add derivatives to global covariance matrix.

virtual void invalidateCache () const
 invalidate any cached quantities

virtual std::ostream & print (std::ostream &os) const
 print object to ostream


Protected Types

enum  { NPAR = 3 }
 number of parameters More...


Protected Member Functions

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


Protected Attributes

double mass
 mass of particle

double par [NPAR]
 fit parameters

double mpar [NPAR]
 measured parameters

bool measured [NPAR]
 measured flag

bool fixed [NPAR]
 fixed flag

int globalParNum [NPAR]
 global paramter number for each parameter

double cov [NPAR][NPAR]
 local covariance matrix

double covinv [NPAR][NPAR]
 inverse pf local covariance matrix

bool covinvvalid
 flag for valid inverse covariance matrix


Detailed Description

Abstract base class for particle objects of kinematic fits.

This class defines the minimal functionality any fit object must provide. The main task of a fit object is to keep parameters (and errors) that define the four-momentum of a particle and encapsulate the actually chosen parametrisation from the rest of the fitting machinery.

Since for the fit a parametrisation distributed like a gaussian is most favorable, different kinds of particles (implying different kinds of measurements!) might require different parametrisations. For each desired parametrisation a concrete class should be derived from this abstract base class. It needs to be able to convert its parameters to E, px, py, pz and to provide the derivatives of E, px, py, pz with respect to the internal parameters.

Depending on the type of particle, some or all parameters might be unmeasured (neutrinos!), meaning that they come with a very large and/or unknown error. They are treated differently by the fit algorithm and are thus flagged accordingly.

In order to insert its derivatives into the global covariance matrix of all FitObjects in the event, each FitObjects needs to know the position of its parameters in the overall parameter list.

THIS iS JUNK!!!! It is done like this in JetFitObject.C, but using measured[i] which is the bool giving the measured/unmeasured status and NOT a bool containing the START VALUES!!!!! From its stored initial parameters and the current fit parameters the FitObject calculates its contribution to the $^2$ of the fit.

In its current state, a ParticleFitObject has a set of parameters, some of them measured (i.e., they contribute to the $\chi^2$). These parameters have a local numbering, running from 0 to n-1. Global numbers can be assigned by the BaseFitter using setGlobalParNum.

Author: Benno List, Jenny List

Date
2007/09/14 10:58:42
Author
blist

Changelog:

Definition at line 62 of file ParticleFitObject.h.


Member Enumeration Documentation

anonymous enum [protected]
 

number of parameters

Enumeration values:
NPAR 

Definition at line 200 of file ParticleFitObject.h.


Constructor & Destructor Documentation

ParticleFitObject::ParticleFitObject  ) 
 

Default constructor.

Definition at line 27 of file ParticleFitObject.C.

References globalParNum, and NPAR.

ParticleFitObject::~ParticleFitObject  )  [virtual]
 

Virtual destructor.

Definition at line 31 of file ParticleFitObject.C.


Member Function Documentation

virtual void ParticleFitObject::addTo2ndDerivatives double  der2[],
int  idim,
double  pxfact,
double  pyfact,
double  pzfact,
double  efact
const [pure virtual]
 

add second order derivatives to matrix der2 of size idim x idim pxfact*d^2px/(dx_i dx_j) + pyfact...

Parameters:
der2  Derivatives vector, size idim x idim
idim  First dimension of derivatives matrix
pxfact  Factor for d^2px/dx_i dx_j
pyfact  Factor for d^2py/dx_i dx_j
pzfact  Factor for d^2pz/dx_i dx_j
efact  Factor for d^2E/dx_i dx_j

Implemented in JetFitObject.

Referenced by PzConstraint::add2ndDerivativesToMatrix(), PyConstraint::add2ndDerivativesToMatrix(), PxConstraint::add2ndDerivativesToMatrix(), and EConstraint::add2ndDerivativesToMatrix().

virtual void ParticleFitObject::addToDerivatives double  der[],
int  idim,
double  pxfact = 0,
double  pyfact = 0,
double  pzfact = 0,
double  efact = 0
const [pure virtual]
 

add derivatives to vector der of size idim pxfact*dpx/dx_i + pyfact*dpy/dx_i + pzfact*dpz/dx_i + efact*dE/dx_i

Parameters:
der  Derivatives vector, length idim
idim  Length of derivatives vector
pxfact  Factor for dpx/dx_i
pyfact  Factor for dpy/dx_i
pzfact  Factor for dpz/dx_i
efact  Factor for dE/dx_i

Implemented in JetFitObject.

void ParticleFitObject::addToGlobalChi2DerMatrix int  idim,
double *  M
const [virtual]
 

Add derivatives of chi squared to global covariance matrix.

Parameters:
idim  First dimension of global covariance matrix
M  Global covariance matrix

Implements BaseFitObject.

Definition at line 206 of file ParticleFitObject.C.

References calculateCovInv(), covinv, covinvvalid, getGlobalParNum(), getNPar(), isParamFixed(), and isParamMeasured().

virtual void ParticleFitObject::addToGlobalDerMatrix int  idim,
double  c,
double *  M
const [pure virtual]
 

Add derivatives to global covariance matrix.

Parameters:
idim  First dimension of global covariance matrix
c  Constant by which to multiply derivatives
M  Global covariance matrix

Implements BaseFitObject.

Implemented in JetFitObject, and NeutrinoFitObject.

void ParticleFitObject::addToGlobCov double *  globCov,
int  idim
const [virtual]
 

Add covariance matrix elements to global covariance matrix.

Parameters:
globCov  Global covariance matrix, size idim x idim
idim  First dimension of globCov

Implements BaseFitObject.

Definition at line 226 of file ParticleFitObject.C.

References cov, getGlobalParNum(), getNPar(), isParamFixed(), and isParamMeasured().

bool ParticleFitObject::calculateCovInv  )  const [protected, virtual]
 

Calculate the inverse of the covariance matrix.

Definition at line 139 of file ParticleFitObject.C.

References cov, covinv, covinvvalid, dsinv(), BaseFitObject::getName(), getNPar(), isParamMeasured(), and NPAR.

Referenced by addToGlobalChi2DerMatrix(), getChi2(), getD2Chi2DParam2(), and getDChi2DParam().

bool ParticleFitObject::fixParam int  ilocal,
bool  fix = true
[virtual]
 

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

Parameters:
ilocal  Local parameter number
fix  fix if true, release if false

Implements BaseFitObject.

Definition at line 84 of file ParticleFitObject.C.

References fixed, and NPAR.

double ParticleFitObject::getChi2  )  const [virtual]
 

Get chi squared from measured and fitted parameters.

Implements BaseFitObject.

Definition at line 165 of file ParticleFitObject.C.

References calculateCovInv(), covinv, covinvvalid, getNPar(), isParamFixed(), isParamMeasured(), mpar, NPAR, and par.

double ParticleFitObject::getCov int  ilocal,
int  jlocal
const [virtual]
 

Get covariance between parameters ilocal and jlocal.

Parameters:
ilocal  Local parameter number i
jlocal  Local parameter number j

Implements BaseFitObject.

Definition at line 112 of file ParticleFitObject.C.

References cov, and NPAR.

virtual double* ParticleFitObject::getCovMatrix  )  [inline, virtual]
 

Get covariance matrix.

Definition at line 101 of file ParticleFitObject.h.

References cov.

double ParticleFitObject::getD2Chi2DParam2 int  ilocal,
int  jlocal
const [virtual]
 

Get second derivative of chi squared w.r.t. parameters ilocal and jlocal.

Parameters:
ilocal  Local parameter number i
jlocal  Local parameter number j

Implements BaseFitObject.

Definition at line 195 of file ParticleFitObject.C.

References calculateCovInv(), covinv, covinvvalid, isParamFixed(), isParamMeasured(), and NPAR.

double ParticleFitObject::getDChi2DParam int  ilocal  )  const [virtual]
 

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

Parameters:
ilocal  Local parameter number

Implements BaseFitObject.

Definition at line 183 of file ParticleFitObject.C.

References calculateCovInv(), covinv, covinvvalid, getNPar(), isParamFixed(), isParamMeasured(), measured, NPAR, and par.

virtual double ParticleFitObject::getDE int  ilocal  )  const [pure virtual]
 

Implemented in JetFitObject, and NeutrinoFitObject.

Referenced by EConstraint::add1stDerivativesToMatrix().

virtual double ParticleFitObject::getDPx int  ilocal  )  const [pure virtual]
 

Implemented in JetFitObject, and NeutrinoFitObject.

Referenced by PxConstraint::add1stDerivativesToMatrix(), and PConstraint::add1stDerivativesToMatrix().

virtual double ParticleFitObject::getDPy int  ilocal  )  const [pure virtual]
 

Implemented in JetFitObject, and NeutrinoFitObject.

Referenced by PyConstraint::add1stDerivativesToMatrix().

virtual double ParticleFitObject::getDPz int  ilocal  )  const [pure virtual]
 

Implemented in JetFitObject, and NeutrinoFitObject.

Referenced by PzConstraint::add1stDerivativesToMatrix().

virtual double ParticleFitObject::getE  )  const [pure virtual]
 

Implemented in JetFitObject, and NeutrinoFitObject.

Referenced by print4Vector().

double ParticleFitObject::getError int  ilocal  )  const [virtual]
 

Get error of parameter ilocal.

Parameters:
ilocal  Local parameter number

Implements BaseFitObject.

Definition at line 108 of file ParticleFitObject.C.

References cov, and NPAR.

Referenced by main().

int ParticleFitObject::getGlobalParNum int  ilocal  )  const [virtual]
 

Get global parameter number of parameter ilocal.

Implements BaseFitObject.

Definition at line 94 of file ParticleFitObject.C.

References globalParNum, and NPAR.

Referenced by PzConstraint::add1stDerivativesToMatrix(), PyConstraint::add1stDerivativesToMatrix(), PxConstraint::add1stDerivativesToMatrix(), PConstraint::add1stDerivativesToMatrix(), EConstraint::add1stDerivativesToMatrix(), addToGlobalChi2DerMatrix(), and addToGlobCov().

double ParticleFitObject::getMParam int  iocal  )  const [virtual]
 

Get measured value of parameter ilocal.

Parameters:
ilocal  Local parameter number

Implements BaseFitObject.

Definition at line 103 of file ParticleFitObject.C.

References mpar, and NPAR.

virtual int ParticleFitObject::getNPar  )  const [inline, virtual]
 

Get number of parameters of this FitObject.

Implements BaseFitObject.

Definition at line 122 of file ParticleFitObject.h.

References NPAR.

Referenced by PzConstraint::add1stDerivativesToMatrix(), PyConstraint::add1stDerivativesToMatrix(), PxConstraint::add1stDerivativesToMatrix(), PConstraint::add1stDerivativesToMatrix(), EConstraint::add1stDerivativesToMatrix(), addToGlobalChi2DerMatrix(), addToGlobCov(), calculateCovInv(), getChi2(), and getDChi2DParam().

virtual double ParticleFitObject::getP  )  const [pure virtual]
 

Implemented in JetFitObject, and NeutrinoFitObject.

virtual double ParticleFitObject::getP2  )  const [pure virtual]
 

Implemented in JetFitObject.

double ParticleFitObject::getParam int  ilocal  )  const [virtual]
 

Get current value of parameter ilocal.

Parameters:
ilocal  Local parameter number

Implements BaseFitObject.

Definition at line 99 of file ParticleFitObject.C.

References NPAR, and par.

Referenced by main().

virtual double ParticleFitObject::getPt  )  const [pure virtual]
 

Implemented in JetFitObject.

virtual double ParticleFitObject::getPt2  )  const [pure virtual]
 

Implemented in JetFitObject.

virtual double ParticleFitObject::getPx  )  const [pure virtual]
 

these depend on actual parametrisation!

Implemented in JetFitObject, and NeutrinoFitObject.

Referenced by print4Vector().

virtual double ParticleFitObject::getPy  )  const [pure virtual]
 

Implemented in JetFitObject, and NeutrinoFitObject.

Referenced by print4Vector().

virtual double ParticleFitObject::getPz  )  const [pure virtual]
 

Implemented in JetFitObject, and NeutrinoFitObject.

Referenced by print4Vector().

virtual void ParticleFitObject::invalidateCache  )  const [inline, virtual]
 

invalidate any cached quantities

Reimplemented in JetFitObject.

Definition at line 189 of file ParticleFitObject.h.

Referenced by setCov(), setError(), setMass(), setMParam(), and setParam().

bool ParticleFitObject::isParamFixed int  ilocal  )  const [virtual]
 

Get fixed flag for parameter i.

Implements BaseFitObject.

Definition at line 122 of file ParticleFitObject.C.

References fixed, and NPAR.

Referenced by PzConstraint::add1stDerivativesToMatrix(), PyConstraint::add1stDerivativesToMatrix(), PxConstraint::add1stDerivativesToMatrix(), PConstraint::add1stDerivativesToMatrix(), EConstraint::add1stDerivativesToMatrix(), addToGlobalChi2DerMatrix(), addToGlobCov(), getChi2(), getD2Chi2DParam2(), and getDChi2DParam().

bool ParticleFitObject::isParamMeasured int  ilocal  )  const [virtual]
 

Get measured flag for parameter i.

Implements BaseFitObject.

Definition at line 117 of file ParticleFitObject.C.

References measured, and NPAR.

Referenced by addToGlobalChi2DerMatrix(), addToGlobCov(), calculateCovInv(), getChi2(), getD2Chi2DParam2(), and getDChi2DParam().

std::ostream & ParticleFitObject::print std::ostream &  os  )  const [virtual]
 

print object to ostream

Parameters:
os  The output stream

Implements BaseFitObject.

Definition at line 133 of file ParticleFitObject.C.

References print4Vector(), and BaseFitObject::printParams().

std::ostream & ParticleFitObject::print4Vector std::ostream &  os  )  const [virtual]
 

print the four-momentum (E, px, py, pz)

Parameters:
os  The output stream

Definition at line 127 of file ParticleFitObject.C.

References getE(), getPx(), getPy(), and getPz().

Referenced by print().

bool ParticleFitObject::setCov int  ilocal,
int  jlocal,
double  cov_
[virtual]
 

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

Parameters:
ilocal  Local parameter number
jlocal  Local parameter number
cov_  New error value

Implements BaseFitObject.

Definition at line 68 of file ParticleFitObject.C.

References cov, covinvvalid, invalidateCache(), and NPAR.

bool ParticleFitObject::setError int  ilocal,
double  err_
[virtual]
 

Set error of parameter ilocal; return=success.

Parameters:
ilocal  Local parameter number
err_  New error value

Implements BaseFitObject.

Definition at line 59 of file ParticleFitObject.C.

References cov, covinvvalid, invalidateCache(), and NPAR.

Referenced by JetFitObject::JetFitObject().

bool ParticleFitObject::setGlobalParNum int  ilocal,
int  iglobal
[virtual]
 

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

Implements BaseFitObject.

Definition at line 89 of file ParticleFitObject.C.

References globalParNum, and NPAR.

bool ParticleFitObject::setMass double  mass_  )  [virtual]
 

Set mass of particle; return=success.

Definition at line 77 of file ParticleFitObject.C.

References invalidateCache(), and mass.

Referenced by JetFitObject::JetFitObject(), and NeutrinoFitObject::NeutrinoFitObject().

bool ParticleFitObject::setMParam int  i,
double  mpar_
[virtual]
 

Set measured value of parameter ilocal; return=success.

Implements BaseFitObject.

Definition at line 51 of file ParticleFitObject.C.

References invalidateCache(), mpar, and NPAR.

Referenced by JetFitObject::JetFitObject().

bool ParticleFitObject::setParam int  ilocal,
double  par_
[virtual]
 

Set value of parameter ilocal; return=success.

Parameters:
ilocal  Local parameter number
par_  New parameter value

Implements BaseFitObject.

Reimplemented in NeutrinoFitObject.

Definition at line 43 of file ParticleFitObject.C.

References invalidateCache(), NPAR, and par.

bool ParticleFitObject::setParam int  ilocal,
double  par_,
bool  measured_,
bool  fixed_ = false
[virtual]
 

Set value and measured flag of parameter ilocal; return=success.

Parameters:
ilocal  Local parameter number
par_  New parameter value
measured_  New "measured" flag
fixed_  New "fixed" flag

Implements BaseFitObject.

Definition at line 34 of file ParticleFitObject.C.

References fixed, invalidateCache(), measured, and NPAR.

Referenced by JetFitObject::JetFitObject().


Member Data Documentation

double ParticleFitObject::cov[NPAR][NPAR] [protected]
 

local covariance matrix

Definition at line 214 of file ParticleFitObject.h.

Referenced by addToGlobCov(), calculateCovInv(), getCov(), getCovMatrix(), getError(), JetFitObject::initCov(), setCov(), and setError().

double ParticleFitObject::covinv[NPAR][NPAR] [mutable, protected]
 

inverse pf local covariance matrix

Definition at line 216 of file ParticleFitObject.h.

Referenced by addToGlobalChi2DerMatrix(), calculateCovInv(), getChi2(), getD2Chi2DParam2(), and getDChi2DParam().

bool ParticleFitObject::covinvvalid [mutable, protected]
 

flag for valid inverse covariance matrix

Definition at line 218 of file ParticleFitObject.h.

Referenced by addToGlobalChi2DerMatrix(), calculateCovInv(), getChi2(), getD2Chi2DParam2(), getDChi2DParam(), setCov(), and setError().

bool ParticleFitObject::fixed[NPAR] [protected]
 

fixed flag

Definition at line 210 of file ParticleFitObject.h.

Referenced by fixParam(), isParamFixed(), and setParam().

int ParticleFitObject::globalParNum[NPAR] [protected]
 

global paramter number for each parameter

Definition at line 212 of file ParticleFitObject.h.

Referenced by JetFitObject::addTo2ndDerivatives(), JetFitObject::addToDerivatives(), getGlobalParNum(), ParticleFitObject(), and setGlobalParNum().

double ParticleFitObject::mass [protected]
 

mass of particle

Definition at line 202 of file ParticleFitObject.h.

Referenced by JetFitObject::addTo2ndDerivatives(), NeutrinoFitObject::getD2Px(), NeutrinoFitObject::getD2Py(), NeutrinoFitObject::getD2Pz(), NeutrinoFitObject::getP(), setMass(), NeutrinoFitObject::setParam(), and JetFitObject::updateCache().

bool ParticleFitObject::measured[NPAR] [protected]
 

measured flag

Definition at line 208 of file ParticleFitObject.h.

Referenced by getDChi2DParam(), isParamMeasured(), setParam(), and NeutrinoFitObject::setParam().

double ParticleFitObject::mpar[NPAR] [protected]
 

measured parameters

Definition at line 206 of file ParticleFitObject.h.

Referenced by getChi2(), getMParam(), and setMParam().

double ParticleFitObject::par[NPAR] [protected]
 

fit parameters

Definition at line 204 of file ParticleFitObject.h.

Referenced by getChi2(), NeutrinoFitObject::getD2Px(), NeutrinoFitObject::getD2Py(), NeutrinoFitObject::getD2Pz(), getDChi2DParam(), NeutrinoFitObject::getDPx(), NeutrinoFitObject::getDPy(), NeutrinoFitObject::getDPz(), NeutrinoFitObject::getE(), JetFitObject::getE(), NeutrinoFitObject::getP(), getParam(), NeutrinoFitObject::getPx(), NeutrinoFitObject::getPy(), NeutrinoFitObject::getPz(), setParam(), NeutrinoFitObject::setParam(), and JetFitObject::updateCache().


The documentation for this class was generated from the following files:
Generated on Fri Sep 14 17:38:37 2007 for Kinfit by doxygen 1.3.2