Belle II Software  release-05-01-25
MomentumConstraint.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * See https://github.com/tferber/OrcaKinfit, forked from *
4  * https://github.com/iLCSoft/MarlinKinfit *
5  * *
6  * Further information about the fit engine and the user interface *
7  * provided in MarlinKinfit can be found at *
8  * https://www.desy.de/~blist/kinfit/doc/html/ *
9  * and in the LCNotes LC-TOOL-2009-001 and LC-TOOL-2009-004 available *
10  * from http://www-flc.desy.de/lcnotes/ *
11  * *
12  * Adopted by: Torben Ferber (torben.ferber@desy.de) (TF) *
13  * *
14  * This software is provided "as is" without any warranty. *
15  **************************************************************************/
16 
17 #ifndef __MOMENTUMCONSTRAINT_H
18 #define __MOMENTUMCONSTRAINT_H
19 
20 #include "analysis/OrcaKinFit/ParticleConstraint.h"
21 
22 namespace Belle2 {
28  namespace OrcaKinFit {
29 
30  class ParticleFitObject;
31 
32 // Class PConstraint:
34 
41  class MomentumConstraint : public ParticleConstraint {
42  public:
43  MomentumConstraint(double efact_ = 0,
44  double pxfact_ = 0,
45  double pyfact_ = 0,
46  double pzfact_ = 0,
47  double value_ = 0
48  );
49  virtual ~MomentumConstraint();
50  virtual double getValue() const override;
53  virtual void getDerivatives(int idim,
54  double der[]
55  ) const override;
56 
57  // not used at all
58  // virtual void addToGlobalDerMatrix (double lambda, int idim, double *M) const;
59 
60  virtual void invalidateCache() const override;
61 
62  virtual int getVarBasis() const override;
63 
64  protected:
65  void updateCache() const;
66 
67 
68  double efact;
69  double pxfact;
70  double pyfact;
71  double pzfact;
72  double value;
73 
74  mutable bool cachevalid;
75  mutable int nparams;
76 
78  virtual bool secondDerivatives(int i,
79  int j,
80  double* derivatives
81  ) const override;
83  virtual bool firstDerivatives(int i,
84  double* derivatives
85  ) const override;
86 
87  enum { VAR_BASIS = 0 }; // this means that the constraint knows about E,px,py,pz
88 
89  };
90 
91  }// end OrcaKinFit namespace
93 } // end Belle2 namespace
94 
95 #endif // __MOMENTUMCONSTRAINT_H
Belle2::OrcaKinFit::MomentumConstraint::getDerivatives
virtual void getDerivatives(int idim, double der[]) const override
Get first order derivatives.
Definition: MomentumConstraint.cc:87
Belle2::OrcaKinFit::BaseHardConstraint::derivatives
std::vector< double > derivatives
The derivatives.
Definition: BaseHardConstraint.h:193
Belle2::OrcaKinFit::MomentumConstraint::invalidateCache
virtual void invalidateCache() const override
Invalidates any cached values for the next event.
Definition: MomentumConstraint.cc:107
Belle2::OrcaKinFit::MomentumConstraint::getValue
virtual double getValue() const override
Returns the value of the constraint.
Definition: MomentumConstraint.cc:63
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::OrcaKinFit::MomentumConstraint::secondDerivatives
virtual bool secondDerivatives(int i, int j, double *derivatives) const override
Second derivatives with respect to the 4-vectors of Fit objects i and j; result false if all derivati...
Definition: MomentumConstraint.cc:127
Belle2::OrcaKinFit::MomentumConstraint::firstDerivatives
virtual bool firstDerivatives(int i, double *derivatives) const override
First derivatives with respect to the 4-vector of Fit objects i; result false if all derivatives are ...
Definition: MomentumConstraint.cc:135
Belle2::OrcaKinFit::MomentumConstraint::MomentumConstraint
MomentumConstraint(double efact_=0, double pxfact_=0, double pyfact_=0, double pzfact_=0, double value_=0)
Definition: MomentumConstraint.cc:48