LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
SurfLine.cxx
Go to the documentation of this file.
1 
12 #include <cmath>
13 
14 namespace trkf {
15 
18 
21 
34  double SurfLine::PointingError(const TrackVector& vec, const TrackError& err) const
35  {
36  // Get slope parameters and error matrix.
37 
38  double phi = vec(2);
39  double eta = vec(3);
40  double epp = err(2, 2); // sigma^2(phi,phi)
41  double ehh = err(3, 3); // sigma^2(eta,eta)
42  double ehp = err(3, 2); // sigma^2(eta,phi)
43 
44  // Calculate error matrix of pointing unit vector in some coordinate system.
45 
46  double sh = 1. / std::cosh(eta); // sech(eta)
47  double sh2 = sh * sh;
48  double sh3 = sh * sh2;
49  double sh4 = sh * sh3;
50 
51  double th = std::tanh(eta);
52  double th2 = th * th;
53 
54  double cphi = std::cos(phi);
55  double cphi2 = cphi * cphi;
56 
57  double sphi = std::sin(phi);
58  double sphi2 = sphi * sphi;
59 
60  double vxx = sh2 * th2 * cphi2 * ehh + sh2 * sphi2 * epp + 2. * sh2 * th * sphi * cphi * ehp;
61  double vyy = sh2 * th2 * sphi2 * ehh + sh2 * cphi2 * epp - 2. * sh2 * th * sphi * cphi * ehp;
62  double vzz = sh4 * epp;
63 
64  double vxy =
65  sh2 * th2 * sphi * cphi * ehh - sh2 * sphi * cphi * epp - sh2 * th * (cphi2 - sphi2) * ehp;
66  double vyz = -sh3 * th * sphi * ehh + sh3 * cphi * ehp;
67  double vxz = -sh3 * th * cphi * ehh - sh3 * sphi * ehp;
68 
69  // For debugging. The determinant of the error matrix should be zero.
70 
71  // double det = vxx*vyy*vzz + 2.*vxy*vyz*vxz - vxx*vyz*vyz - vyy*vxz*vxz - vzz*vxy*vxy;
72 
73  // Calculate square root of the largest eigenvalue of error matrix.
74 
75  double ddd2 = vxx * vxx + vyy * vyy + vzz * vzz - 2. * vxx * vyy - 2. * vxx * vzz -
76  2. * vyy * vzz + 4. * vxy * vxy + 4. * vyz * vyz + 4. * vxz * vxz;
77  double ddd = sqrt(ddd2 > 0. ? ddd2 : 0.);
78  double lambda2 = 0.5 * (vxx + vyy + vzz + ddd);
79  double lambda = sqrt(lambda2 > 0. ? lambda2 : 0.);
80 
81  return lambda;
82  }
83 
91  {
92  err.resize(5, false);
93  err.clear();
94  err(0, 0) = 1000.;
95  err(1, 1) = 1000.;
96  err(2, 2) = 10.;
97  err(3, 3) = 10.;
98  err(4, 4) = 10.;
99  }
100 
101 } // end namespace trkf
KSymMatrix< 5 >::type TrackError
Track error matrix, dimension 5x5.
void getStartingError(TrackError &err) const
Get starting error matrix for Kalman filter.
Definition: SurfLine.cxx:90
KVector< 5 >::type TrackVector
Track state vector, dimension 5.
double PointingError(const TrackVector &vec, const TrackError &err) const
Get pointing error of track.
Definition: SurfLine.cxx:34
Base class for Kalman filter line surfaces.
SurfLine()
Default constructor.
Definition: SurfLine.cxx:17
virtual ~SurfLine()
Destructor.
Definition: SurfLine.cxx:20