Belle II Software  release-08-01-10
Constraint Class Reference

class to manage the order of constraints and their filtering More...

#include <Constraint.h>

Inheritance diagram for Constraint:
Collaboration diagram for Constraint:

Public Types

enum  Type {
  unknown = 0 ,
  beamenergy ,
  beamspot ,
  beam ,
  origin ,
  lifetime ,
  resonance ,
  composite ,
  track ,
  photon ,
  klong ,
  conversion ,
  kinematic ,
  geometric ,
  mass ,
  massEnergy ,
  merged ,
  ntypes ,
  helix
}
 type of constraints the order of these constraints is important: it is the order in which they are applied.
 

Public Member Functions

bool operator< (const Constraint &rhs) const
 operator used to sort the constraints
 
bool operator== (const Constraint &rhs) const
 operator
 
Type type () const
 get type of constraint
 
unsigned int dim () const
 get dimension of constraint
 
bool isLinear () const
 is this a linear constraint
 
unsigned int nIter () const
 get maximum number of iterations for non in constraint
 
 Constraint ()
 constructor

 
 Constraint (const ParticleBase *node, Type type, int depth, unsigned int dim, int maxniter=1)
 constructor
 
virtual ~Constraint ()
 destructor
 
virtual ErrCode project (const FitParams &fitpar, Projection &p) const
 call the constraints projection function
 
virtual ErrCode filter (FitParams &fitpar)
 filter this constraint More...
 
virtual ErrCode filterWithReference (FitParams &fitpar, const FitParams &oldState)
 filter this constraint More...
 
std::string name () const
 get name of constraint

 
void setWeight (int w)
 used to be able to weight the constraints
 

Protected Member Functions

 Constraint (Constraint::Type type)
 constructor
 
void setDim (unsigned int d)
 set dimension of constraint
 
void setNIter (unsigned int d)
 set max number of iterations for non lin constraint

 

Private Attributes

const ParticleBasem_node
 particle behind the constraint

 
int m_depth
 chi2 coming from the constraint More...
 
Type m_type
 type of constraint
 
unsigned int m_dim
 dimension of constraint
 
int m_weight
 weight of this constraint currently we set them all to unity

 
int m_maxNIter
 maximum number of iterations for non-linear constraints

 

Detailed Description

class to manage the order of constraints and their filtering

Definition at line 20 of file Constraint.h.

Member Function Documentation

◆ filter()

ErrCode filter ( FitParams fitpar)
virtual

filter this constraint

We don't have reference state yet so we use the k-1 last state to linearize non-linear constraints

Definition at line 28 of file Constraint.cc.

29  {
34  ErrCode status;
35  Projection p(fitpar.getDimensionOfState(), m_dim);
36  KalmanCalculator kalman(m_dim, fitpar.getDimensionOfState());
37 
38  double chisq(0);
39  int iter(0);
40  bool finished(false) ;
41 
42  double accumulated_chi2 = 0;
43  while (!finished && !status.failure()) {
44 
45  p.resetProjection();
46  status |= project(fitpar, p);
47 
48  if (!status.failure()) {
49 
50  status |= kalman.calculateGainMatrix(
51  p.getResiduals(),
52  p.getH(),
53  fitpar,
54  &p.getV(),
55  1
56  );
57 
58  if (!status.failure()) {
59  kalman.updateState(fitpar);
60 
61  // r R^-1 r
62  double newchisq = kalman.getChiSquare();
63 
64  double dchisqconverged = 0.001 ;
65 
66  double dchisq = newchisq - chisq;
67  bool diverging = iter > 0 && dchisq > 0;
68  bool converged = std::abs(dchisq) < dchisqconverged;
69  finished = ++iter >= m_maxNIter || diverging || converged;
70  chisq = newchisq;
71  accumulated_chi2 += newchisq;
72  }
73  }
74  }
75 
76  const unsigned int number_of_constraints = kalman.getConstraintDim();
77  fitpar.addChiSquare(accumulated_chi2, number_of_constraints);
78 
79  kalman.updateCovariance(fitpar);
80  return status;
81  }
unsigned int m_dim
dimension of constraint
Definition: Constraint.h:143
int m_maxNIter
maximum number of iterations for non-linear constraints
Definition: Constraint.h:149
virtual ErrCode project(const FitParams &fitpar, Projection &p) const
call the constraints projection function
Definition: Constraint.cc:23

◆ filterWithReference()

ErrCode filterWithReference ( FitParams fitpar,
const FitParams oldState 
)
virtual

filter this constraint

We now linearise around the last iteration \alpha (const FitParams& oldState) In this implementation we can no longer linearize non-linear constraints but we ensured by the linearisation around the last state that the step size is small enough so we just use them as if they were linear

here we project the old state and use only the change with respect to the new state instead of the new state in the update . the advantage is more stable fit Downside: non-linear constraints can't be filtered multiple times anymore.

Definition at line 83 of file Constraint.cc.

Member Data Documentation

◆ m_depth

int m_depth
private

chi2 coming from the constraint

depth of the constraint in the tree (determines for example the order of the track constraints)

Definition at line 137 of file Constraint.h.


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