62 const Helix h(position, momentum, charge, bZ);
64 const double arcLengthAtPosition = h.getArcLength2DAtXY(position.X(), position.Y());
66 double arcLengthOfIntersection = NAN;
74 if (triggerPlaneNormalDirection.
X() == 0 and triggerPlaneNormalDirection.
Y() == 0) {
76 arcLengthOfIntersection = (triggerPlanePosition.
Z() - h.getZ0()) / h.getTanLambda();
77 }
else if (triggerPlaneNormalDirection.
Z() == 0) {
84 triggerPlaneNormalDirection.
RotateZ(-h.getPhi0());
85 triggerPlanePosition.
RotateZ(-h.getPhi0());
87 const double n_x = triggerPlaneNormalDirection.
X();
88 const double n_y = triggerPlaneNormalDirection.
Y();
91 const double alpha = triggerPlanePosition.
Dot(triggerPlaneNormalDirection);
94 if (fabs(h.getOmega()) < 1e-3) {
96 const double arcLengthOfTrigger = (alpha + n_y * h.getD0()) / n_x;
98 arcLengthOfIntersection = arcLengthAtPosition - arcLengthOfTrigger;
101 const double beta = n_y * h.getOmega() * h.getD0() + alpha * h.getOmega();
108 const double A1 = (
sqrt(n_x * n_x * n_y * n_y - 2 * beta * n_y * n_y * n_y - beta * beta * n_y * n_y) - beta * n_x - n_x * n_y) /
109 (n_x * n_x + n_y * n_y);
110 const double A2 = (-
sqrt(n_x * n_x * n_y * n_y - 2 * beta * n_y * n_y * n_y - beta * beta * n_y * n_y) - beta * n_x - n_x * n_y) /
111 (n_x * n_x + n_y * n_y);
113 const double x1_unrotated = -A1 / h.getOmega();
114 const double y1_unrotated = -(1 -
sqrt(1 - A1 * A1)) / h.getOmega() - h.getD0();
115 const double x2_unrotated = -A2 / h.getOmega();
116 const double y2_unrotated = -(1 -
sqrt(1 - A2 * A2)) / h.getOmega() - h.getD0();
118 const double x1_rotated = h.getCosPhi0() * x1_unrotated + h.getSinPhi0() * y1_unrotated;
119 const double y1_rotated = -h.getSinPhi0() * x1_unrotated + h.getCosPhi0() * y1_unrotated;
120 const double x2_rotated = h.getCosPhi0() * x2_unrotated + h.getSinPhi0() * y2_unrotated;
121 const double y2_rotated = -h.getSinPhi0() * x2_unrotated + h.getCosPhi0() * y2_unrotated;
124 const double arcLengthOfTrigger1 = h.getArcLength2DAtXY(x1_rotated, y1_rotated);
125 const double arcLengthOfTrigger2 = h.getArcLength2DAtXY(x2_rotated, y2_rotated);
127 const double arcLengthOfIntersection1 = arcLengthAtPosition - arcLengthOfTrigger1;
128 const double arcLengthOfIntersection2 = arcLengthAtPosition - arcLengthOfTrigger2;
130 arcLengthOfIntersection = fabs(arcLengthOfIntersection1) < fabs(arcLengthOfIntersection2) ? arcLengthOfIntersection1 :
131 arcLengthOfIntersection2;
136 B2FATAL(
"This case for the normal direction is not implemented for using tracking seeds!");
139 const double s = arcLengthOfIntersection * hypot(1, h.getTanLambda());
void addParam(const std::string &name, T ¶mVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.