8 if((momentum.num_row() != 4)||(deviation.num_row() != 4))
9 throw VertexException(
"FourMomentumKinematicConstraint::vector of wrong size passed as 4-Momentum or Deviations");
12 deviation_l(6) = momentum(3);
13 deviation_l(5) = momentum(2);
14 deviation_l(4) = momentum(1);
16 double mass_sq = momentum(4)*momentum(4) - momentum(3)*momentum(3)
17 -momentum(2)*momentum(2) - momentum(1)*momentum(1);
19 if(mass_sq == 0.)
throw VertexException(
"FourMomentumKinematicConstraint::the constraint vector passed corresponds to 0 mass");
22 deviation_l(7) = momentum(4)*momentum(4)*deviation(4)/mass_sq
23 + momentum(3)*momentum(3)*deviation(3)/mass_sq
24 + momentum(2)*momentum(2)*deviation(2)/mass_sq
25 + momentum(1)*momentum(1)*deviation(1)/mass_sq;
33 if(exPoint.num_row() ==0 )
throw VertexException(
"FourMomentumKinematicConstraint::value requested for zero Linearization point");
36 int inSize = exPoint.num_row();
37 if((inSize%7) !=0)
throw VertexException(
"FourMomentumKinematicConstraint::linearization point has a wrong dimension");
38 int nStates = inSize/7;
39 if(nStates != 1)
throw VertexException(
"FourMomentumKinematicConstraint::Multi particle refit is not supported in this version");
42 vl(1) += (pr(4) -
mm(1));
43 vl(2) += (pr(5) -
mm(2));
44 vl(3) += (pr(6) -
mm(3));
45 vl(7) += (
sqrt(pr(4)*pr(4)+pr(5)*pr(5)+pr(6)*pr(6)+pr(7)*pr(7)) -
mm(4));
47 return std::pair<AlgebraicVector,AlgebraicVector>(vl,pr);
52 if(exPoint.num_row() ==0)
throw VertexException(
"FourMomentumKinematicConstraint::value requested for zero Linearization point");
55 int inSize = exPoint.num_row();
56 if((inSize%7) !=0)
throw VertexException(
"FourMomentumKinematicConstraint::linearization point has a wrong dimension");
57 int nStates = inSize/7;
58 if(nStates != 1)
throw VertexException(
"FourMomentumKinematicConstraint::Multi particle refit is not supported in this version");
65 dr(4,7) = pr(7)/
sqrt(pr(4)*pr(4)+pr(5)*pr(5)+pr(6)*pr(6)+pr(7)*pr(7));
67 return std::pair<AlgebraicMatrix,AlgebraicVector>(dr,pr);
72 int nStates = par.size();
73 if(nStates == 0)
throw VertexException(
"FourMomentumKinematicConstraint::Empty vector of particles passed");
74 if(nStates != 1)
throw VertexException(
"FourMomentumKinematicConstraint::Multi particle refit is not supported in this version");
75 AlgebraicVector pr = asHepVector<7>(par.front()->currentState().kinematicParameters().vector());
78 vl(1) = pr(4) -
mm(1);
79 vl(2) = pr(5) -
mm(2);
80 vl(3) = pr(6) -
mm(3);
81 vl(7) =
sqrt(pr(4)*pr(4)+pr(5)*pr(5)+pr(6)*pr(6)+pr(7)*pr(7)) -
mm(4);
83 return std::pair<AlgebraicVector,AlgebraicVector>(vl,pr);
88 int nStates = par.size();
89 if(nStates == 0)
throw VertexException(
"FourMomentumKinematicConstraint::Empty vector of particles passed");
90 if(nStates != 1)
throw VertexException(
"FourMomentumKinematicConstraint::Multi particle refit is not supported in this version");
93 AlgebraicVector pr = asHepVector<7>(par.front()->currentState().kinematicParameters().vector());
97 dr(4,7) = - pr(7)/
sqrt(pr(4)*pr(4)+pr(5)*pr(5)+pr(6)*pr(6)+pr(7)*pr(7));
99 return std::pair<AlgebraicMatrix,AlgebraicVector>(dr,pr);
104 if(nStates == 0)
throw VertexException(
"FourMomentumKinematicConstraint::Empty vector of particles passed");
105 if(nStates != 1)
throw VertexException(
"FourMomentumKinematicConstraint::Multi particle refit is not supported in this version");
virtual std::pair< AlgebraicMatrix, AlgebraicVector > derivative(const AlgebraicVector &exPoint) const
virtual std::pair< AlgebraicVector, AlgebraicVector > value(const AlgebraicVector &exPoint) const
CLHEP::HepMatrix AlgebraicMatrix
virtual AlgebraicVector deviations(int nStates) const
virtual int numberOfEquations() const
CLHEP::HepVector AlgebraicVector
FourMomentumKinematicConstraint(const AlgebraicVector &momentum, const AlgebraicVector &deviation)