8 #include <tracking/modules/fitter/timeEstimator/PlaneTriggerTrackTimeEstimatorModule.h>
10 #include <tracking/dataobjects/RecoTrack.h>
11 #include <framework/dataobjects/Helix.h>
12 #include <framework/geometry/BFieldManager.h>
21 addParam(
"triggerPlanePosition", m_param_triggerPlanePosition,
"3-Position of the plane of the trigger.",
22 m_param_triggerPlanePosition);
24 addParam(
"triggerPlaneDirection", m_param_triggerPlaneNormalDirection,
"3-Normal direction of the plane of the trigger.",
25 m_param_triggerPlaneNormalDirection);
32 B2ASSERT(
"Position must have 3 components.", m_param_triggerPlanePosition.size() == 3);
33 B2ASSERT(
"Normal direction must have 3 components.", m_param_triggerPlaneNormalDirection.size() == 3);
35 TVector3 triggerPlanePosition(m_param_triggerPlanePosition[0], m_param_triggerPlanePosition[1], m_param_triggerPlanePosition[2]);
36 TVector3 triggerPlaneNormalDirection(m_param_triggerPlaneNormalDirection[0], m_param_triggerPlaneNormalDirection[1],
37 m_param_triggerPlaneNormalDirection[2]);
41 triggerPlaneNormalDirection)));
46 B2WARNING(
"Extrapolation failed: " << e.what());
52 double PlaneTriggerTrackTimeEstimatorModule::estimateFlightLengthUsingSeedInformation(
const RecoTrack& recoTrack)
const
54 B2ASSERT(
"Position must have 3 components.", m_param_triggerPlanePosition.size() == 3);
55 B2ASSERT(
"Normal direction must have 3 components.", m_param_triggerPlaneNormalDirection.size() == 3);
61 const double bZ = BFieldManager::getField(0, 0, 0).Z() / Unit::T;
62 const Helix h(position, momentum, charge, bZ);
64 const double arcLengthAtPosition = h.getArcLength2DAtXY(position.X(), position.Y());
66 double arcLengthOfIntersection = NAN;
68 TVector3 triggerPlanePosition(m_param_triggerPlanePosition[0], m_param_triggerPlanePosition[1], m_param_triggerPlanePosition[2]);
69 TVector3 triggerPlaneNormalDirection(m_param_triggerPlaneNormalDirection[0], m_param_triggerPlaneNormalDirection[1],
70 m_param_triggerPlaneNormalDirection[2]);
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());
Base Module estimating the track time of RecoTracks - before or after the fit.
Module estimating the track time of RecoTracks - before or after the fit.
This is the Reconstruction Event-Data Model Track.
TVector3 getMomentumSeed() const
Return the momentum seed stored in the reco track. ATTENTION: This is not the fitted momentum.
TVector3 getPositionSeed() const
Return the position seed stored in the reco track. ATTENTION: This is not the fitted position.
short int getChargeSeed() const
Return the charge seed stored in the reco track. ATTENTION: This is not the fitted charge.
Exception class for error handling in GENFIT (provides storage for diagnostic information)
#StateOnPlane with additional covariance matrix.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Abstract base class for different kinds of events.
std::shared_ptr< genfit::DetPlane > SharedPlanePtr
Shared Pointer to a DetPlane.