1 #ifndef ColinearityKinematicConstraintT_H
2 #define ColinearityKinematicConstraintT_H
22 template <enum colinearityKinematic::Constra
intDim Dim>
39 void init(
const std::vector<KinematicState>& states,
42 if (states.size() != 2)
43 throw VertexException(
"ColinearityKinematicConstraint::<2 states passed");
47 a_1 = -states[0].particleCharge() * fieldValue.
z();
48 a_2 = -states[1].particleCharge() * fieldValue.
z();
50 p1 = states[0].kinematicParameters().vector();
51 p2 = states[1].kinematicParameters().vector();
86 template <enum colinearityKinematic::Constra
intDim Dim>
90 double p1vx =
p1(3) - a_1 * (
point.y() -
p1(1));
91 double p1vy =
p1(4) + a_1 * (
point.x() -
p1(0));
93 double p2vx =
p2(3) - a_2 * (
point.y() -
p2(1));
94 double p2vy =
p2(4) + a_2 * (
point.x() -
p2(0));
97 vl(0) = atan2(p1vy, p1vx) - atan2(p2vy, p2vx);
106 vl(1) = atan2(
pt1,
p1(5)) - atan2(
pt2,
p2(5));
114 template <enum colinearityKinematic::Constra
intDim Dim>
118 double p1vx =
p1(3) - a_1 * (
point.y() -
p1(1));
119 double p1vy =
p1(4) + a_1 * (
point.x() -
p1(0));
120 double k1 = 1.0 / (p1vx * p1vx + p1vy * p1vy);
122 double p2vx =
p2(3) - a_2 * (
point.y() -
p2(1));
123 double p2vy =
p2(4) + a_2 * (
point.x() -
p2(0));
124 double k2 = 1.0 / (p2vx * p2vx + p2vy * p2vy);
129 jac_d(0, 0) = -k1 * a_1 * p1vx;
130 jac_d(0, 7) = k2 * a_2 * p2vx;
133 jac_d(0, 1) = -k1 * a_1 * p1vy;
134 jac_d(0, 8) = k2 * a_2 * p2vy;
141 jac_d(0, 3) = -k1 * p1vy;
142 jac_d(0, 10) = k2 * p2vy;
145 jac_d(0, 4) = k1 * p1vx;
146 jac_d(0, 11) = -k2 * p2vx;
157 double pTot1 =
p1(3) *
p1(3) +
p1(4) *
p1(4) +
p1(5) *
p1(5);
159 double pTot2 =
p2(3) *
p2(3) +
p2(4) *
p2(4) +
p2(5) *
p2(5);
174 jac_d(1, 3) =
p1(3) * (
p1(5) / (pTot1 *
pt1));
175 jac_d(1, 10) =
p2(3) * (-
p2(5) / (pTot2 *
pt2));
178 jac_d(1, 4) =
p1(4) * (
p1(5) / (pTot1 *
pt1));
179 jac_d(1, 11) =
p2(4) * (-
p2(5) / (pTot2 *
pt2));
182 jac_d(1, 5) = -
pt1 / pTot1;
183 jac_d(1, 12) =
pt2 / pTot2;
191 template <enum colinearityKinematic::Constra
intDim Dim>
195 double p1vx =
p1(3) - a_1 * (
point.y() -
p1(1));
196 double p1vy =
p1(4) + a_1 * (
point.x() -
p1(0));
197 double k1 = 1.0 / (p1vx * p1vx + p1vy * p1vy);
199 double p2vx =
p2(3) - a_2 * (
point.y() -
p2(1));
200 double p2vy =
p2(4) + a_2 * (
point.x() -
p2(0));
201 double k2 = 1.0 / (p2vx * p2vx + p2vy * p2vy);
206 jac_e(0, 0) = k1 * a_1 * p1vx - k2 * a_2 * p2vx;
209 jac_e(0, 1) = k1 * a_1 * p1vy - k2 * a_2 * p2vy;