Belle II Software light-2406-ragdoll
TrackConstraint.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 __TrackConstraint_H
18#define __TrackConstraint_H
19
20#include<vector>
21#include<cassert>
22#include "analysis/OrcaKinFit/BaseConstraint.h"
23
24namespace Belle2 {
30 namespace OrcaKinFit {
31
32 class TrackFitObject;
33
34// Class TrackConstraint:
36
74 public:
76 inline TrackConstraint();
78 virtual ~TrackConstraint() {};
79
81 virtual void setFOList(std::vector <TrackFitObject*>* fitobjects_
82 )
83 {
84 for (int i = 0; i < (int) fitobjects_->size(); i++) {
85 fitobjects.push_back((*fitobjects_)[i]);
86 flags.push_back(1);
87 sign.push_back(i == 0 ? 1 : -1);
88 }
89 };
91 virtual void addToFOList(TrackFitObject& fitobject, int flag = 1
92 )
93 {
94 fitobjects.push_back(&fitobject);
95 flags.push_back(flag);
96 sign.push_back(sign.size() == 0 ? 1 : -1);
97 };
99 virtual double getValue() const = 0;
100
103 virtual void getDerivatives(int idim, double der[]) const = 0;
105 virtual void add1stDerivativesToMatrix(double* M,
106 int idim
107 ) const
108 {assert(false);}
110 virtual void add2ndDerivativesToMatrix(double* M,
111 int idim,
112 double lambda
113 ) const
114 {assert(false);}
115
117 virtual void addToGlobalChi2DerVector(double* y,
118 int idim,
119 double lambda //< The lambda value
120 ) const
121 {assert(false);};
122
124 virtual int getGlobalNum() const {return globalNum;}
126 virtual void setGlobalNum(int iglobal) {globalNum = iglobal;}
127
129 virtual void invalidateCache() const {};
130
131 protected:
133 typedef std::vector <TrackFitObject*> FitObjectContainer;
135 typedef FitObjectContainer::iterator FitObjectIterator;
137 typedef FitObjectContainer::const_iterator ConstFitObjectIterator;
141 std::vector <double> derivatives;
144 std::vector <int> flags;
145 std::vector <double> sign;
146
149
150 };
151
153 {
155 }
156
157 }// end OrcaKinFit namespace
159} // end Belle2 namespace
160
161#endif // __TrackConstraint_H
Abstract base class for constraints of kinematic fits.
Abstract base class for constraints of kinematic fits.
virtual void addToFOList(TrackFitObject &fitobject, int flag=1)
Adds one TrackFitObject objects to the list.
virtual double getValue() const =0
Returns the value of the constraint.
FitObjectContainer::iterator FitObjectIterator
Iterator through vector of pointers to TrackFitObjects.
virtual int getGlobalNum() const
Accesses position of constraint in global constraint list.
std::vector< double > derivatives
The derivatives.
int globalNum
Position of constraint in global constraint list.
FitObjectContainer fitobjects
The FitObjectContainer.
virtual ~TrackConstraint()
Virtual destructor.
TrackConstraint()
Creates an empty TrackConstraint object.
std::vector< TrackFitObject * > FitObjectContainer
Vector of pointers to TrackFitObjects.
virtual void invalidateCache() const
Invalidates any cached values for the next event.
virtual void setGlobalNum(int iglobal)
Sets position of constraint in global constraint list.
virtual void setFOList(std::vector< TrackFitObject * > *fitobjects_)
Adds several TrackFitObject objects to the list.
virtual void add2ndDerivativesToMatrix(double *M, int idim, double lambda) const
Adds second order derivatives to global covariance matrix M.
FitObjectContainer::const_iterator ConstFitObjectIterator
Constant iterator through vector of pointers to TrackFitObjects.
virtual void addToGlobalChi2DerVector(double *y, int idim, double lambda) const
Add lambda times derivatives of chi squared to global derivative matrix.
std::vector< int > flags
The flags can be used to divide the FitObjectContainer into several subsets used for example to imple...
virtual void getDerivatives(int idim, double der[]) const =0
Get first order derivatives.
virtual void add1stDerivativesToMatrix(double *M, int idim) const
Adds first order derivatives to global covariance matrix M.
Abstract base class for different kinds of events.
Definition: ClusterUtils.h:24