Belle II Software  release-08-01-10
BaseFitter.h
1 /**************************************************************************
2  * basf2 (Belle II Analysis Software Framework) *
3  * Author: The Belle II Collaboration *
4  * *
5  * Forked from https://github.com/iLCSoft/MarlinKinfit *
6  * *
7  * Further information about the fit engine and the user interface *
8  * provided in MarlinKinfit can be found at *
9  * https://www.desy.de/~blist/kinfit/doc/html/ *
10  * and in the LCNotes LC-TOOL-2009-001 and LC-TOOL-2009-004 available *
11  * from http://www-flc.desy.de/lcnotes/ *
12  * *
13  * See git log for contributors and copyright holders. *
14  * This file is licensed under LGPL-3.0, see LICENSE.md. *
15  **************************************************************************/
16 
17 #ifndef __BASEFITTER_H
18 #define __BASEFITTER_H
19 
20 #include<vector>
21 #include<string>
22 #include<map>
23 
24 namespace Belle2 {
30  namespace OrcaKinFit {
31 
32  class BaseFitObject;
33  class BaseConstraint;
34  class BaseHardConstraint;
35  class BaseSoftConstraint;
36  class BaseTracer;
37 
38 // Class BaseConstraint:
40 
47  class BaseFitter {
48  public:
49  BaseFitter();
50  virtual ~BaseFitter();
51  virtual void addFitObject(BaseFitObject* fitobject_);
52  virtual void addFitObject(BaseFitObject& fitobject_);
53  virtual void addConstraint(BaseConstraint* constraint_);
54  virtual void addConstraint(BaseConstraint& constraint_);
55  virtual void addHardConstraint(BaseHardConstraint* constraint_);
56  virtual void addHardConstraint(BaseHardConstraint& constraint_);
57  virtual void addSoftConstraint(BaseSoftConstraint* constraint_);
58  virtual void addSoftConstraint(BaseSoftConstraint& constraint_);
59  virtual std::vector<BaseFitObject*>* getFitObjects();
60  virtual std::vector<BaseHardConstraint*>* getConstraints();
61  virtual std::vector<BaseSoftConstraint*>* getSoftConstraints();
62  virtual double fit() = 0;
63  virtual int getError() const = 0;
64  virtual double getProbability() const = 0;
65  virtual double getChi2() const = 0;
66  virtual int getDoF() const = 0;
67  virtual int getIterations() const = 0;
68 
69  virtual void reset();
70  virtual bool initialize() = 0;
71 
72  virtual BaseTracer* getTracer();
73  virtual const BaseTracer* getTracer() const;
74  virtual void setTracer(BaseTracer* newTracer
75  );
76  virtual void setTracer(BaseTracer& newTracer
77  );
78 
79  virtual const double* getGlobalCovarianceMatrix(int& idim
80  ) const;
81  virtual double* getGlobalCovarianceMatrix(int& idim
82  );
83 
84  protected:
86  BaseFitter(const BaseFitter& rhs);
89 
90 
91  typedef std::vector <BaseFitObject*> FitObjectContainer;
92  typedef std::vector <BaseHardConstraint*> ConstraintContainer;
93  typedef std::vector <BaseSoftConstraint*> SoftConstraintContainer;
94 
95  typedef FitObjectContainer::iterator FitObjectIterator;
96  typedef ConstraintContainer::iterator ConstraintIterator;
97  typedef SoftConstraintContainer::iterator SoftConstraintIterator;
98 
99  FitObjectContainer fitobjects;
100  ConstraintContainer constraints;
101  SoftConstraintContainer softconstraints;
102 
103  int covDim;
104  double* cov;
105  bool covValid;
106 
107 #ifndef FIT_TRACEOFF
108  BaseTracer* tracer;
109 #endif
110  public:
111 #ifndef FIT_TRACEOFF
112  std::map<std::string, double> traceValues;
113 #endif
114 
115  };
116 
117  }// end OrcaKinFit namespace
119 } // end Belle2 namespace
120 
121 
122 #endif // __BASEFITTER_H
Abstract base class for constraints of kinematic fits.
Abstract base class for fitting engines of kinematic fits.
Definition: BaseFitter.h:47
BaseFitter(const BaseFitter &rhs)
Copy constructor disabled.
virtual const double * getGlobalCovarianceMatrix(int &idim) const
Definition: BaseFitter.cc:148
BaseFitter & operator=(const BaseFitter &rhs)
Assignment disabled.
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
Abstract base class for constraints of kinematic fits.
Abstract base class for soft constraints of kinematic fits.
Abstract base class for trace objects of kinematic fits.
Definition: BaseTracer.h:70
Abstract base class for different kinds of events.