Belle II Software light-2406-ragdoll
BaseFitter Class Referenceabstract

Abstract base class for fitting engines of kinematic fits. More...

#include <BaseFitter.h>

Inheritance diagram for BaseFitter:
Collaboration diagram for BaseFitter:

Public Member Functions

virtual void addFitObject (BaseFitObject *fitobject_)
 
virtual void addFitObject (BaseFitObject &fitobject_)
 
virtual void addConstraint (BaseConstraint *constraint_)
 
virtual void addConstraint (BaseConstraint &constraint_)
 
virtual void addHardConstraint (BaseHardConstraint *constraint_)
 
virtual void addHardConstraint (BaseHardConstraint &constraint_)
 
virtual void addSoftConstraint (BaseSoftConstraint *constraint_)
 
virtual void addSoftConstraint (BaseSoftConstraint &constraint_)
 
virtual std::vector< BaseFitObject * > * getFitObjects ()
 
virtual std::vector< BaseHardConstraint * > * getConstraints ()
 
virtual std::vector< BaseSoftConstraint * > * getSoftConstraints ()
 
virtual double fit ()=0
 
virtual int getError () const =0
 
virtual double getProbability () const =0
 
virtual double getChi2 () const =0
 
virtual int getDoF () const =0
 
virtual int getIterations () const =0
 
virtual void reset ()
 
virtual bool initialize ()=0
 
virtual BaseTracergetTracer ()
 
virtual const BaseTracergetTracer () const
 
virtual void setTracer (BaseTracer *newTracer)
 
virtual void setTracer (BaseTracer &newTracer)
 
virtual const double * getGlobalCovarianceMatrix (int &idim) const
 
virtual double * getGlobalCovarianceMatrix (int &idim)
 

Public Attributes

std::map< std::string, double > traceValues
 

Protected Types

typedef std::vector< BaseFitObject * > FitObjectContainer
 
typedef std::vector< BaseHardConstraint * > ConstraintContainer
 
typedef std::vector< BaseSoftConstraint * > SoftConstraintContainer
 
typedef FitObjectContainer::iterator FitObjectIterator
 
typedef ConstraintContainer::iterator ConstraintIterator
 
typedef SoftConstraintContainer::iterator SoftConstraintIterator
 

Protected Member Functions

 BaseFitter (const BaseFitter &rhs)
 Copy constructor disabled.
 
BaseFitteroperator= (const BaseFitter &rhs)
 Assignment disabled.
 

Protected Attributes

FitObjectContainer fitobjects
 
ConstraintContainer constraints
 
SoftConstraintContainer softconstraints
 
int covDim
 dimension of global covariance matrix
 
double * cov
 global covariance matrix of last fit problem
 
bool covValid
 Flag whether global covariance is valid.
 
BaseTracertracer
 

Detailed Description

Abstract base class for fitting engines of kinematic fits.

Author: Jenny List, Benno List Last update:

Date
2011/03/03 15:03:02

by:

Author
blist

Definition at line 47 of file BaseFitter.h.

Member Typedef Documentation

◆ ConstraintContainer

typedef std::vector<BaseHardConstraint*> ConstraintContainer
protected

Definition at line 92 of file BaseFitter.h.

◆ ConstraintIterator

typedef ConstraintContainer::iterator ConstraintIterator
protected

Definition at line 96 of file BaseFitter.h.

◆ FitObjectContainer

typedef std::vector<BaseFitObject*> FitObjectContainer
protected

Definition at line 91 of file BaseFitter.h.

◆ FitObjectIterator

typedef FitObjectContainer::iterator FitObjectIterator
protected

Definition at line 95 of file BaseFitter.h.

◆ SoftConstraintContainer

typedef std::vector<BaseSoftConstraint*> SoftConstraintContainer
protected

Definition at line 93 of file BaseFitter.h.

◆ SoftConstraintIterator

typedef SoftConstraintContainer::iterator SoftConstraintIterator
protected

Definition at line 97 of file BaseFitter.h.

Constructor & Destructor Documentation

◆ BaseFitter()

Definition at line 31 of file BaseFitter.cc.

32 : fitobjects(FitObjectContainer()),
33 constraints(ConstraintContainer()),
34 softconstraints(SoftConstraintContainer()),
35 covDim(0), cov(nullptr), covValid(false)
36#ifndef FIT_TRACEOFF
37 , tracer(nullptr),
38 traceValues(std::map<std::string, double> ())
39#endif
40 {}
double * cov
global covariance matrix of last fit problem
Definition: BaseFitter.h:104
bool covValid
Flag whether global covariance is valid.
Definition: BaseFitter.h:105
int covDim
dimension of global covariance matrix
Definition: BaseFitter.h:103

◆ ~BaseFitter()

~BaseFitter ( )
virtual

Definition at line 42 of file BaseFitter.cc.

43 {
44 delete[] cov;
45 cov = nullptr;
46 }

Member Function Documentation

◆ addConstraint() [1/2]

void addConstraint ( BaseConstraint constraint_)
virtual

Definition at line 74 of file BaseFitter.cc.

75 {
76 covValid = false;
77 if (auto* hc = dynamic_cast<BaseHardConstraint*>(&constraint_))
78 constraints.push_back(hc);
79 else if (auto* sc = dynamic_cast<BaseSoftConstraint*>(&constraint_))
80 softconstraints.push_back(sc);
81 }

◆ addConstraint() [2/2]

void addConstraint ( BaseConstraint constraint_)
virtual

Definition at line 60 of file BaseFitter.cc.

61 {
62 covValid = false;
63
64 if (auto* hc = dynamic_cast<BaseHardConstraint*>(constraint_))
65 constraints.push_back(hc);
66 else if (auto* sc = dynamic_cast<BaseSoftConstraint*>(constraint_))
67 softconstraints.push_back(sc);
68 else {
69 // illegal constraint
70 assert(0);
71 }
72 }

◆ addFitObject() [1/2]

void addFitObject ( BaseFitObject fitobject_)
virtual

Definition at line 54 of file BaseFitter.cc.

55 {
56 covValid = false;
57 fitobjects.push_back(&fitobject_);
58 }

◆ addFitObject() [2/2]

void addFitObject ( BaseFitObject fitobject_)
virtual

Definition at line 48 of file BaseFitter.cc.

49 {
50 covValid = false;
51 fitobjects.push_back(fitobject_);
52 }

◆ addHardConstraint() [1/2]

void addHardConstraint ( BaseHardConstraint constraint_)
virtual

Definition at line 89 of file BaseFitter.cc.

90 {
91 covValid = false;
92 constraints.push_back(&constraint_);
93 }

◆ addHardConstraint() [2/2]

void addHardConstraint ( BaseHardConstraint constraint_)
virtual

Definition at line 83 of file BaseFitter.cc.

84 {
85 covValid = false;
86 constraints.push_back(constraint_);
87 }

◆ addSoftConstraint() [1/2]

void addSoftConstraint ( BaseSoftConstraint constraint_)
virtual

Definition at line 101 of file BaseFitter.cc.

102 {
103 covValid = false;
104 softconstraints.push_back(&constraint_);
105 }

◆ addSoftConstraint() [2/2]

void addSoftConstraint ( BaseSoftConstraint constraint_)
virtual

Definition at line 95 of file BaseFitter.cc.

96 {
97 covValid = false;
98 softconstraints.push_back(constraint_);
99 }

◆ fit()

virtual double fit ( )
pure virtual

◆ getChi2()

virtual double getChi2 ( ) const
pure virtual

◆ getConstraints()

std::vector< BaseHardConstraint * > * getConstraints ( )
virtual

Definition at line 112 of file BaseFitter.cc.

113 {
114 return &constraints;
115 }

◆ getDoF()

virtual int getDoF ( ) const
pure virtual

◆ getError()

virtual int getError ( ) const
pure virtual

◆ getFitObjects()

std::vector< BaseFitObject * > * getFitObjects ( )
virtual

Definition at line 107 of file BaseFitter.cc.

108 {
109 return &fitobjects;
110 }

◆ getGlobalCovarianceMatrix() [1/2]

double * getGlobalCovarianceMatrix ( int &  idim)
virtual
Parameters
idim1st dimension of global covariance matrix

Definition at line 158 of file BaseFitter.cc.

159 {
160 if (covValid && cov) {
161 idim = covDim;
162 return cov;
163 }
164 idim = 0;
165 return nullptr;
166 }

◆ getGlobalCovarianceMatrix() [2/2]

const double * getGlobalCovarianceMatrix ( int &  idim) const
virtual
Parameters
idim1st dimension of global covariance matrix

Definition at line 148 of file BaseFitter.cc.

149 {
150 if (covValid && cov) {
151 idim = covDim;
152 return cov;
153 }
154 idim = 0;
155 return nullptr;
156 }

◆ getIterations()

virtual int getIterations ( ) const
pure virtual

◆ getProbability()

virtual double getProbability ( ) const
pure virtual

◆ getSoftConstraints()

std::vector< BaseSoftConstraint * > * getSoftConstraints ( )
virtual

Definition at line 117 of file BaseFitter.cc.

118 {
119 return &softconstraints;
120 }

◆ getTracer() [1/2]

BaseTracer * getTracer ( )
virtual

Definition at line 130 of file BaseFitter.cc.

131 {
132 return tracer;
133 }

◆ getTracer() [2/2]

const BaseTracer * getTracer ( ) const
virtual

Definition at line 134 of file BaseFitter.cc.

135 {
136 return tracer;
137 }

◆ initialize()

virtual bool initialize ( )
pure virtual

Implemented in NewFitterGSL, and NewtonFitterGSL.

◆ reset()

void reset ( )
virtual

Definition at line 122 of file BaseFitter.cc.

123 {
124 fitobjects.resize(0);
125 constraints.resize(0);
126 softconstraints.resize(0);
127 covValid = false;
128 }

◆ setTracer() [1/2]

void setTracer ( BaseTracer newTracer)
virtual

Definition at line 143 of file BaseFitter.cc.

144 {
145 tracer = &newTracer;
146 }

◆ setTracer() [2/2]

void setTracer ( BaseTracer newTracer)
virtual

Definition at line 138 of file BaseFitter.cc.

139 {
140 tracer = newTracer;
141 }

Member Data Documentation

◆ constraints

ConstraintContainer constraints
protected

Definition at line 100 of file BaseFitter.h.

◆ cov

double* cov
protected

global covariance matrix of last fit problem

Definition at line 104 of file BaseFitter.h.

◆ covDim

int covDim
protected

dimension of global covariance matrix

Definition at line 103 of file BaseFitter.h.

◆ covValid

bool covValid
protected

Flag whether global covariance is valid.

Definition at line 105 of file BaseFitter.h.

◆ fitobjects

FitObjectContainer fitobjects
protected

Definition at line 99 of file BaseFitter.h.

◆ softconstraints

SoftConstraintContainer softconstraints
protected

Definition at line 101 of file BaseFitter.h.

◆ tracer

BaseTracer* tracer
protected

Definition at line 108 of file BaseFitter.h.

◆ traceValues

std::map<std::string, double> traceValues

Definition at line 112 of file BaseFitter.h.


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