CMS 3D CMS Logo

MassKinematicConstraint.cc
Go to the documentation of this file.
3 
5  mass = m;
6  AlgebraicVector deviation_l(7, 0);
7  deviation_l(7) = sigma * sigma;
8  dd = deviation_l;
9 }
10 
11 std::pair<AlgebraicVector, AlgebraicVector> MassKinematicConstraint::value(const AlgebraicVector& exPoint) const {
12  //we have only one equation and only one track, means the constraint value
13  //for track parameters is just a single number
14  if (exPoint.num_row() == 0)
15  throw VertexException("MomentumKinematicConstraint::value requested for zero Linearization point");
16 
17  //security check for extended cartesian parametrization
18  int inSize = exPoint.num_row();
19  if ((inSize % 7) != 0)
20  throw VertexException("MomentumKinematicConstraint::linearization point has a wrong dimension");
21  int nStates = inSize / 7;
22  if (nStates != 1)
23  throw VertexException("MassKinematicConstraint::multiple state refit is not supported in this version");
24  AlgebraicVector vl(1, 0);
25  AlgebraicVector point = exPoint;
26  vl(1) = point(7) - mass;
27  return std::pair<AlgebraicVector, AlgebraicVector>(vl, point);
28 }
29 
30 std::pair<AlgebraicMatrix, AlgebraicVector> MassKinematicConstraint::derivative(const AlgebraicVector& exPoint) const {
31  if (exPoint.num_row() == 0)
32  throw VertexException("MomentumKinematicConstraint::deriavtive requested for zero Linearization point");
33 
34  //security check for extended cartesian parametrization
35  int inSize = exPoint.num_row();
36  if ((inSize % 7) != 0)
37  throw VertexException("MomentumKinematicConstraint::linearization point has a wrong dimension");
38  int nStates = inSize / 7;
39  if (nStates != 1)
40  throw VertexException("MassKinematicConstraint::multiple state refit is not supported in this version");
41  AlgebraicMatrix dr(1, 7, 0);
42  dr(1, 7) = 1;
43  AlgebraicVector point = exPoint;
44  return std::pair<AlgebraicMatrix, AlgebraicVector>(dr, point);
45 }
46 
47 std::pair<AlgebraicVector, AlgebraicVector> MassKinematicConstraint::value(
48  const std::vector<RefCountedKinematicParticle>& par) const {
49  int nStates = par.size();
50  if (nStates == 0)
51  throw VertexException("MassKinematicConstraint::empty vector of particles passed");
52  if (nStates != 1)
53  throw VertexException("MassKinematicConstraint::multiple state refit is not supported in this version");
54 
55  AlgebraicVector point = asHepVector<7>(par.front()->currentState().kinematicParameters().vector());
56  AlgebraicVector vl(1, 0);
57  vl(1) = point(7) - mass;
58  return std::pair<AlgebraicVector, AlgebraicVector>(vl, point);
59 }
60 
61 std::pair<AlgebraicMatrix, AlgebraicVector> MassKinematicConstraint::derivative(
62  const std::vector<RefCountedKinematicParticle>& par) const {
63  int nStates = par.size();
64  if (nStates == 0)
65  throw VertexException("MassKinematicConstraint::empty vector of particles passed");
66  if (nStates != 1)
67  throw VertexException("MassKinematicConstraint::multiple state refit is not supported in this version");
68 
69  AlgebraicVector point = asHepVector<7>(par.front()->currentState().kinematicParameters().vector());
70  AlgebraicMatrix dr(1, 7, 0);
71  dr(1, 7) = 1;
72  return std::pair<AlgebraicMatrix, AlgebraicVector>(dr, point);
73 }
74 
76  if (nStates == 0)
77  throw VertexException("MassKinematicConstraint::empty vector of particles passed");
78  if (nStates != 1)
79  throw VertexException("MassKinematicConstraint::multiple state refit is not supported in this version");
81  return res;
82 }
83 
std::pair< AlgebraicMatrix, AlgebraicVector > derivative(const AlgebraicVector &exPoint) const override
Common base class.
double ParticleMass
Definition: ParticleMass.h:4
AlgebraicVector deviations(int nStates) const override
Definition: Electron.h:6
CLHEP::HepMatrix AlgebraicMatrix
int numberOfEquations() const override
CLHEP::HepVector AlgebraicVector
std::pair< AlgebraicVector, AlgebraicVector > value(const AlgebraicVector &exPoint) const override
MassKinematicConstraint(const ParticleMass &m, const float sigma)
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
Definition: invegas.h:5