LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
SurfPlane.cxx
Go to the documentation of this file.
1 
12 #include <cmath>
13 
14 namespace trkf {
15 
18 
21 
34  double SurfPlane::PointingError(const TrackVector& vec, const TrackError& err) const
35  {
36  // Get slope parameters and error matrix.
37 
38  double xp = vec(2);
39  double yp = vec(3);
40  double exx = err(2, 2);
41  double eyy = err(3, 3);
42  double exy = err(3, 2);
43 
44  // Calculate error matrix of pointing unit vector in some coordinate system.
45 
46  double den = 1. + xp * xp + yp * yp;
47  double den3 = den * den * den;
48 
49  double vxx = ((1. + yp * yp) * (1. + yp * yp) * exx + xp * xp * yp * yp * eyy -
50  2. * xp * yp * (1. + yp * yp) * exy) /
51  den3;
52  double vyy = (xp * xp * yp * yp * exx + (1. + xp * xp) * (1. + xp * xp) * eyy -
53  2. * xp * yp * (1. + xp * xp) * exy) /
54  den3;
55  double vzz = (xp * xp * exx + yp * yp * eyy + 2. * xp * yp * exy) / den3;
56 
57  double vxy = (-xp * yp * (1. + yp * yp) * exx - xp * yp * (1. + xp * xp) * eyy +
58  (1. + xp * xp + yp * yp + 2. * xp * xp * yp * yp) * exy) /
59  den3;
60  double vyz =
61  (xp * xp * yp * exx - yp * (1. + xp * xp) * eyy - xp * (1. + xp * xp - yp * yp) * exy) / den3;
62  double vxz =
63  (-xp * (1. + yp * yp) * exx + xp * yp * yp * eyy - yp * (1. - xp * xp + yp * yp) * exy) /
64  den3;
65 
66  // Calculate square root of the largest eigenvalue of error matrix.
67 
68  double ddd2 = vxx * vxx + vyy * vyy + vzz * vzz - 2. * vxx * vyy - 2. * vxx * vzz -
69  2. * vyy * vzz + 4. * vxy * vxy + 4. * vyz * vyz + 4. * vxz * vxz;
70  double ddd = sqrt(ddd2 > 0. ? ddd2 : 0.);
71  double lambda2 = 0.5 * (vxx + vyy + vzz + ddd);
72  double lambda = sqrt(lambda2 > 0. ? lambda2 : 0.);
73 
74  return lambda;
75  }
76 
84  {
85  err.resize(5, false);
86  err.clear();
87  err(0, 0) = 1000.;
88  err(1, 1) = 1000.;
89  err(2, 2) = 0.25;
90  err(3, 3) = 0.25;
91  err(4, 4) = 10.;
92  }
93 
94 } // end namespace trkf
void getStartingError(TrackError &err) const
Get starting error matrix for Kalman filter.
Definition: SurfPlane.cxx:83
KSymMatrix< 5 >::type TrackError
Track error matrix, dimension 5x5.
Float_t den
Definition: plot.C:35
SurfPlane()
Default constructor.
Definition: SurfPlane.cxx:17
KVector< 5 >::type TrackVector
Track state vector, dimension 5.
double PointingError(const TrackVector &vec, const TrackError &err) const
Get pointing error of track.
Definition: SurfPlane.cxx:34
Base class for Kalman filter planar surfaces.
virtual ~SurfPlane()
Destructor.
Definition: SurfPlane.cxx:20