6 if ((momentum.num_row() != 4) || (deviation.num_row() != 4))
7 throw VertexException(
"FourMomentumKinematicConstraint::vector of wrong size passed as 4-Momentum or Deviations");
10 deviation_l(6) = momentum(3);
11 deviation_l(5) = momentum(2);
12 deviation_l(4) = momentum(1);
15 momentum(4) * momentum(4) - momentum(3) * momentum(3) - momentum(2) * momentum(2) - momentum(1) * momentum(1);
18 throw VertexException(
"FourMomentumKinematicConstraint::the constraint vector passed corresponds to 0 mass");
22 momentum(4) * momentum(4) * deviation(4) / mass_sq + momentum(3) * momentum(3) * deviation(3) / mass_sq +
23 momentum(2) * momentum(2) * deviation(2) / mass_sq + momentum(1) * momentum(1) * deviation(1) / mass_sq;
31 if (exPoint.num_row() == 0)
32 throw VertexException(
"FourMomentumKinematicConstraint::value requested for zero Linearization point");
35 int inSize = exPoint.num_row();
36 if ((inSize % 7) != 0)
37 throw VertexException(
"FourMomentumKinematicConstraint::linearization point has a wrong dimension");
38 int nStates = inSize / 7;
40 throw VertexException(
"FourMomentumKinematicConstraint::Multi particle refit is not supported in this version");
43 vl(1) += (pr(4) -
mm(1));
44 vl(2) += (pr(5) -
mm(2));
45 vl(3) += (pr(6) -
mm(3));
46 vl(7) += (
sqrt(pr(4) * pr(4) + pr(5) * pr(5) + pr(6) * pr(6) + pr(7) * pr(7)) -
mm(4));
48 return std::pair<AlgebraicVector, AlgebraicVector>(vl, pr);
53 if (exPoint.num_row() == 0)
54 throw VertexException(
"FourMomentumKinematicConstraint::value requested for zero Linearization point");
57 int inSize = exPoint.num_row();
58 if ((inSize % 7) != 0)
59 throw VertexException(
"FourMomentumKinematicConstraint::linearization point has a wrong dimension");
60 int nStates = inSize / 7;
62 throw VertexException(
"FourMomentumKinematicConstraint::Multi particle refit is not supported in this version");
69 dr(4, 7) = pr(7) /
sqrt(pr(4) * pr(4) + pr(5) * pr(5) + pr(6) * pr(6) + pr(7) * pr(7));
71 return std::pair<AlgebraicMatrix, AlgebraicVector>(
dr, pr);
75 const std::vector<RefCountedKinematicParticle>& par)
const {
76 int nStates = par.size();
78 throw VertexException(
"FourMomentumKinematicConstraint::Empty vector of particles passed");
80 throw VertexException(
"FourMomentumKinematicConstraint::Multi particle refit is not supported in this version");
81 AlgebraicVector pr = asHepVector<7>(par.front()->currentState().kinematicParameters().vector());
84 vl(1) = pr(4) -
mm(1);
85 vl(2) = pr(5) -
mm(2);
86 vl(3) = pr(6) -
mm(3);
87 vl(7) =
sqrt(pr(4) * pr(4) + pr(5) * pr(5) + pr(6) * pr(6) + pr(7) * pr(7)) -
mm(4);
89 return std::pair<AlgebraicVector, AlgebraicVector>(vl, pr);
93 const std::vector<RefCountedKinematicParticle>& par)
const {
94 int nStates = par.size();
96 throw VertexException(
"FourMomentumKinematicConstraint::Empty vector of particles passed");
98 throw VertexException(
"FourMomentumKinematicConstraint::Multi particle refit is not supported in this version");
101 AlgebraicVector pr = asHepVector<7>(par.front()->currentState().kinematicParameters().vector());
105 dr(4, 7) = -pr(7) /
sqrt(pr(4) * pr(4) + pr(5) * pr(5) + pr(6) * pr(6) + pr(7) * pr(7));
107 return std::pair<AlgebraicMatrix, AlgebraicVector>(
dr, pr);
112 throw VertexException(
"FourMomentumKinematicConstraint::Empty vector of particles passed");
114 throw VertexException(
"FourMomentumKinematicConstraint::Multi particle refit is not supported in this version");
std::pair< AlgebraicVector, AlgebraicVector > value(const AlgebraicVector &exPoint) const override
int numberOfEquations() const override
std::pair< AlgebraicMatrix, AlgebraicVector > derivative(const AlgebraicVector &exPoint) const override
CLHEP::HepMatrix AlgebraicMatrix
AlgebraicVector deviations(int nStates) const override
CLHEP::HepVector AlgebraicVector
FourMomentumKinematicConstraint(const AlgebraicVector &momentum, const AlgebraicVector &deviation)