10 #include <tracking/modules/fitter/timeEstimator/PlaneTriggerTrackTimeEstimatorModule.h>
12 #include <tracking/dataobjects/RecoTrack.h>
13 #include <framework/dataobjects/Helix.h>
14 #include <framework/geometry/BFieldManager.h>
23 addParam(
"triggerPlanePosition", m_param_triggerPlanePosition,
"3-Position of the plane of the trigger.",
24 m_param_triggerPlanePosition);
26 addParam(
"triggerPlaneDirection", m_param_triggerPlaneNormalDirection,
"3-Normal direction of the plane of the trigger.",
27 m_param_triggerPlaneNormalDirection);
34 B2ASSERT(
"Position must have 3 components.", m_param_triggerPlanePosition.size() == 3);
35 B2ASSERT(
"Normal direction must have 3 components.", m_param_triggerPlaneNormalDirection.size() == 3);
37 TVector3 triggerPlanePosition(m_param_triggerPlanePosition[0], m_param_triggerPlanePosition[1], m_param_triggerPlanePosition[2]);
38 TVector3 triggerPlaneNormalDirection(m_param_triggerPlaneNormalDirection[0], m_param_triggerPlaneNormalDirection[1],
39 m_param_triggerPlaneNormalDirection[2]);
43 triggerPlaneNormalDirection)));
48 B2WARNING(
"Extrapolation failed: " << e.what());
54 double PlaneTriggerTrackTimeEstimatorModule::estimateFlightLengthUsingSeedInformation(
const RecoTrack& recoTrack)
const
56 B2ASSERT(
"Position must have 3 components.", m_param_triggerPlanePosition.size() == 3);
57 B2ASSERT(
"Normal direction must have 3 components.", m_param_triggerPlaneNormalDirection.size() == 3);
63 const double bZ = BFieldManager::getField(0, 0, 0).Z() / Unit::T;
64 const Helix h(position, momentum, charge, bZ);
66 const double arcLengthAtPosition = h.getArcLength2DAtXY(position.X(), position.Y());
68 double arcLengthOfIntersection = NAN;
70 TVector3 triggerPlanePosition(m_param_triggerPlanePosition[0], m_param_triggerPlanePosition[1], m_param_triggerPlanePosition[2]);
71 TVector3 triggerPlaneNormalDirection(m_param_triggerPlaneNormalDirection[0], m_param_triggerPlaneNormalDirection[1],
72 m_param_triggerPlaneNormalDirection[2]);
76 if (triggerPlaneNormalDirection.X() == 0 and triggerPlaneNormalDirection.Y() == 0) {
78 arcLengthOfIntersection = (triggerPlanePosition.Z() - h.getZ0()) / h.getTanLambda();
79 }
else if (triggerPlaneNormalDirection.Z() == 0) {
86 triggerPlaneNormalDirection.RotateZ(-h.getPhi0());
87 triggerPlanePosition.RotateZ(-h.getPhi0());
89 const double n_x = triggerPlaneNormalDirection.X();
90 const double n_y = triggerPlaneNormalDirection.Y();
93 const double alpha = triggerPlanePosition.Dot(triggerPlaneNormalDirection);
96 if (fabs(h.getOmega()) < 1e-3) {
98 const double arcLengthOfTrigger = (alpha + n_y * h.getD0()) / n_x;
100 arcLengthOfIntersection = arcLengthAtPosition - arcLengthOfTrigger;
103 const double beta = n_y * h.getOmega() * h.getD0() + alpha * h.getOmega();
110 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) /
111 (n_x * n_x + n_y * n_y);
112 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) /
113 (n_x * n_x + n_y * n_y);
115 const double x1_unrotated = -A1 / h.getOmega();
116 const double y1_unrotated = -(1 - sqrt(1 - A1 * A1)) / h.getOmega() - h.getD0();
117 const double x2_unrotated = -A2 / h.getOmega();
118 const double y2_unrotated = -(1 - sqrt(1 - A2 * A2)) / h.getOmega() - h.getD0();
120 const double x1_rotated = h.getCosPhi0() * x1_unrotated + h.getSinPhi0() * y1_unrotated;
121 const double y1_rotated = -h.getSinPhi0() * x1_unrotated + h.getCosPhi0() * y1_unrotated;
122 const double x2_rotated = h.getCosPhi0() * x2_unrotated + h.getSinPhi0() * y2_unrotated;
123 const double y2_rotated = -h.getSinPhi0() * x2_unrotated + h.getCosPhi0() * y2_unrotated;
126 const double arcLengthOfTrigger1 = h.getArcLength2DAtXY(x1_rotated, y1_rotated);
127 const double arcLengthOfTrigger2 = h.getArcLength2DAtXY(x2_rotated, y2_rotated);
129 const double arcLengthOfIntersection1 = arcLengthAtPosition - arcLengthOfTrigger1;
130 const double arcLengthOfIntersection2 = arcLengthAtPosition - arcLengthOfTrigger2;
132 arcLengthOfIntersection = fabs(arcLengthOfIntersection1) < fabs(arcLengthOfIntersection2) ? arcLengthOfIntersection1 :
133 arcLengthOfIntersection2;
138 B2FATAL(
"This case for the normal direction is not implemented for using tracking seeds!");
141 const double s = arcLengthOfIntersection * hypot(1, h.getTanLambda());