Belle II Software  release-08-01-10
ParticleFitObject.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 __PARTICLEFITOBJECT_H
18 #define __PARTICLEFITOBJECT_H
19 
20 #include "analysis/OrcaKinFit/BaseFitObject.h"
21 #include "analysis/OrcaKinFit/FourVector.h"
22 
23 
24 // Class ParticleFitObject
26 
70 namespace Belle2 {
76  namespace OrcaKinFit {
77 
78 
80  public:
83 
84 
87  );
88 
91  );
92 
94  virtual ~ParticleFitObject();
95 
97  virtual ParticleFitObject& assign(const BaseFitObject& source
98  ) override;
99 
101  virtual bool setMass(double mass_);
103  virtual double getMass() const;
104 
106  virtual std::ostream& print4Vector(std::ostream& os
107  ) const;
108 
109  virtual FourVector getFourMomentum() const;
110 
112  virtual double getE() const;
114  virtual double getPx() const;
116  virtual double getPy() const;
118  virtual double getPz() const;
119 
121  virtual double getP() const;
123  virtual double getP2() const;
125  virtual double getPt() const;
127  virtual double getPt2() const;
128 
130  virtual double getDPx(int ilocal
131  ) const = 0;
133  virtual double getDPy(int ilocal
134  ) const = 0;
136  virtual double getDPz(int ilocal
137  ) const = 0;
139  virtual double getDE(int ilocal
140  ) const = 0;
141 
142  virtual void getDerivatives(double der[], int idim) const override;
143 
145  virtual void addToGlobalChi2DerMatrixNum(double* M,
146  int idim,
147  double eps
148  );
149 
151  virtual void addToGlobalChi2DerVectorNum(double* y,
152  int idim,
153  double eps
154  );
155 
157  virtual std::ostream& print(std::ostream& os
158  ) const override;
159 
160  void test1stDerivatives();
161  void test2ndDerivatives();
162 
164  double num1stDerivative(int ilocal,
165  double eps
166  );
167 
169  double num2ndDerivative(int ilocal1,
170  double eps1,
171  int ilocal2,
172  double eps2
173  );
174 
175  virtual double getChi2() const override;
176 
177  protected:
179  double mass;
180 
181  mutable FourVector fourMomentum;
182 
183  // this is to flag phi angle, for example
184  double paramCycl[BaseDefs::MAXPAR];
185 
186  };
187 
188  }// end OrcaKinFit namespace
190 } // end Belle2 namespace
191 
192 #endif // __PARTICLEFITOBJECT_H
193 
Yet another four vector class, with metric +—.
Definition: FourVector.h:43
virtual double getPx() const
Return px.
virtual ~ParticleFitObject()
Virtual destructor.
virtual void addToGlobalChi2DerMatrixNum(double *M, int idim, double eps)
Add numerically determined derivatives of chi squared to global covariance matrix.
ParticleFitObject & operator=(const ParticleFitObject &rhs)
Assignment.
virtual double getPz() const
Return pz.
virtual bool setMass(double mass_)
Set mass of particle; return=success.
double num2ndDerivative(int ilocal1, double eps1, int ilocal2, double eps2)
Evaluates numerically the 2nd derivative of chi2 w.r.t. 2 parameters.
virtual void addToGlobalChi2DerVectorNum(double *y, int idim, double eps)
Add numerically determined derivatives of chi squared to global derivative vector.
virtual std::ostream & print(std::ostream &os) const override
print object to ostream
virtual double getPt2() const
Return pt (transverse momentum) squared.
virtual double getDE(int ilocal) const =0
Return d E / d par_ilocal (derivative of E w.r.t. local parameter ilocal)
virtual double getPy() const
Return py.
virtual double getDPx(int ilocal) const =0
Return d p_x / d par_ilocal (derivative of px w.r.t. local parameter ilocal)
virtual double getDPz(int ilocal) const =0
Return d p_z / d par_ilocal (derivative of pz w.r.t. local parameter ilocal)
virtual double getP2() const
Return p (momentum) squared.
virtual double getPt() const
Return pt (transverse momentum)
virtual double getP() const
Return p (momentum)
virtual ParticleFitObject & assign(const BaseFitObject &source) override
Assign from anther object, if of same type.
virtual double getE() const
Return E.
double num1stDerivative(int ilocal, double eps)
Evaluates numerically the 1st derivative of chi2 w.r.t. a parameter.
virtual double getChi2() const override
Get chi squared from measured and fitted parameters.
virtual double getDPy(int ilocal) const =0
Return d p_y / d par_ilocal (derivative of py w.r.t. local parameter ilocal)
virtual double getMass() const
Get mass of particle.
virtual std::ostream & print4Vector(std::ostream &os) const
print the four-momentum (E, px, py, pz)
Abstract base class for different kinds of events.