LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
trkf::SurfLine Class Referenceabstract

#include "SurfLine.h"

Inheritance diagram for trkf::SurfLine:
trkf::Surface trkf::SurfYZLine trkf::SurfWireLine

Public Types

enum  TrackDirection { FORWARD, BACKWARD, UNKNOWN }
 Track direction enum. More...
 

Public Member Functions

 SurfLine ()
 Default constructor. More...
 
virtual ~SurfLine ()
 Destructor. More...
 
double PointingError (const TrackVector &vec, const TrackError &err) const
 Get pointing error of track. More...
 
void getStartingError (TrackError &err) const
 Get starting error matrix for Kalman filter. More...
 
virtual Surfaceclone () const =0
 Clone method. More...
 
virtual bool isTrackValid (const TrackVector &vec) const =0
 Surface-specific tests of validity of track parameters. More...
 
virtual void toLocal (const double xyz[3], double uvw[3]) const =0
 Transform global to local coordinates. More...
 
virtual void toGlobal (const double uvw[3], double xyz[3]) const =0
 Transform local to global coordinates. More...
 
virtual TrackVector getDiff (const TrackVector &vec1, const TrackVector &vec2) const
 Calculate difference of two track parameter vectors. More...
 
virtual void getPosition (const TrackVector &vec, double xyz[3]) const =0
 Get position of track. More...
 
virtual TrackDirection getDirection (const TrackVector &, TrackDirection dir=UNKNOWN) const
 Get direction of track (default UNKNOWN). More...
 
virtual void getMomentum (const TrackVector &vec, double mom[3], TrackDirection dir=UNKNOWN) const =0
 Get momentum vector of track. More...
 
virtual bool isParallel (const Surface &surf) const =0
 Test whether two surfaces are parallel, within tolerance. More...
 
virtual double distanceTo (const Surface &surf) const =0
 Find perpendicular forward distance to a parallel surface. More...
 
virtual bool isEqual (const Surface &surf) const =0
 Test two surfaces for equality, within tolerance. More...
 
virtual std::ostream & Print (std::ostream &out) const =0
 Printout. More...
 

Detailed Description

Definition at line 58 of file SurfLine.h.

Member Enumeration Documentation

Track direction enum.

Enumerator
FORWARD 
BACKWARD 
UNKNOWN 

Definition at line 56 of file Surface.h.

Constructor & Destructor Documentation

trkf::SurfLine::SurfLine ( )

Default constructor.

Definition at line 17 of file SurfLine.cxx.

18  {}
trkf::SurfLine::~SurfLine ( )
virtual

Destructor.

Definition at line 21 of file SurfLine.cxx.

22  {}

Member Function Documentation

virtual Surface* trkf::Surface::clone ( ) const
pure virtualinherited

Clone method.

Implemented in trkf::SurfXYZPlane, trkf::SurfYZLine, and trkf::SurfYZPlane.

virtual double trkf::Surface::distanceTo ( const Surface surf) const
pure virtualinherited

Find perpendicular forward distance to a parallel surface.

Implemented in trkf::SurfXYZPlane, trkf::SurfYZLine, and trkf::SurfYZPlane.

Referenced by trkf::Surface::getDirection().

TrackVector trkf::Surface::getDiff ( const TrackVector vec1,
const TrackVector vec2 
) const
virtualinherited

Calculate difference of two track parameter vectors.

Calculate difference of two track parameter vectors. This method has a default implementation which is just the numeric difference. Surfaces that require a more sophisticated difference (e.g. phi-wrap difference) should override this method.

Reimplemented in trkf::SurfYZLine.

Definition at line 33 of file Surface.cxx.

34  {
35  return vec1 - vec2;
36  }
virtual TrackDirection trkf::Surface::getDirection ( const TrackVector ,
TrackDirection  dir = UNKNOWN 
) const
inlinevirtualinherited
virtual void trkf::Surface::getMomentum ( const TrackVector vec,
double  mom[3],
TrackDirection  dir = UNKNOWN 
) const
pure virtualinherited

Get momentum vector of track.

Implemented in trkf::SurfXYZPlane, trkf::SurfYZLine, and trkf::SurfYZPlane.

Referenced by trkf::Surface::getDirection().

virtual void trkf::Surface::getPosition ( const TrackVector vec,
double  xyz[3] 
) const
pure virtualinherited

Get position of track.

Implemented in trkf::SurfXYZPlane, trkf::SurfYZLine, and trkf::SurfYZPlane.

void trkf::SurfLine::getStartingError ( TrackError err) const
virtual

Get starting error matrix for Kalman filter.

Get starting error matrix for Kalman filter.

Arguments:

err - Error matrix.

Implements trkf::Surface.

Definition at line 92 of file SurfLine.cxx.

92  {
93  err.resize(5, false);
94  err.clear();
95  err(0, 0) = 1000.;
96  err(1, 1) = 1000.;
97  err(2, 2) = 10.;
98  err(3, 3) = 10.;
99  err(4, 4) = 10.;
100  }
virtual bool trkf::Surface::isEqual ( const Surface surf) const
pure virtualinherited

Test two surfaces for equality, within tolerance.

Implemented in trkf::SurfXYZPlane, trkf::SurfYZLine, and trkf::SurfYZPlane.

Referenced by trkf::Surface::getDirection().

virtual bool trkf::Surface::isParallel ( const Surface surf) const
pure virtualinherited

Test whether two surfaces are parallel, within tolerance.

Implemented in trkf::SurfXYZPlane, trkf::SurfYZLine, and trkf::SurfYZPlane.

Referenced by trkf::Surface::getDirection().

virtual bool trkf::Surface::isTrackValid ( const TrackVector vec) const
pure virtualinherited

Surface-specific tests of validity of track parameters.

Implemented in trkf::SurfXYZPlane, trkf::SurfYZLine, and trkf::SurfYZPlane.

double trkf::SurfLine::PointingError ( const TrackVector vec,
const TrackError err 
) const
virtual

Get pointing error of track.

Get pointing error of track.

Arguments:

vec - Track parameters. err - Track error matrix.

Returns: Pointing error.

This method calculates the track pointing error based on the slope track paramers and errors (parameters 2 and 3).

Implements trkf::Surface.

Definition at line 36 of file SurfLine.cxx.

37  {
38  // Get slope parameters and error matrix.
39 
40  double phi = vec(2);
41  double eta = vec(3);
42  double epp = err(2, 2); // sigma^2(phi,phi)
43  double ehh = err(3, 3); // sigma^2(eta,eta)
44  double ehp = err(3, 2); // sigma^2(eta,phi)
45 
46  // Calculate error matrix of pointing unit vector in some coordinate system.
47 
48  double sh = 1./std::cosh(eta); // sech(eta)
49  double sh2 = sh*sh;
50  double sh3 = sh*sh2;
51  double sh4 = sh*sh3;
52 
53  double th = std::tanh(eta);
54  double th2 = th*th;
55 
56  double cphi = std::cos(phi);
57  double cphi2 = cphi*cphi;
58 
59  double sphi = std::sin(phi);
60  double sphi2 = sphi*sphi;
61 
62  double vxx = sh2*th2*cphi2 * ehh + sh2*sphi2 * epp + 2.*sh2*th*sphi*cphi * ehp;
63  double vyy = sh2*th2*sphi2 * ehh + sh2*cphi2 * epp - 2.*sh2*th*sphi*cphi * ehp;
64  double vzz = sh4 * epp;
65 
66  double vxy = sh2*th2*sphi*cphi * ehh - sh2*sphi*cphi * epp - sh2*th*(cphi2-sphi2) * ehp;
67  double vyz = -sh3*th*sphi * ehh + sh3*cphi * ehp;
68  double vxz = -sh3*th*cphi * ehh - sh3*sphi * ehp;
69 
70  // For debugging. The determinant of the error matrix should be zero.
71 
72  // double det = vxx*vyy*vzz + 2.*vxy*vyz*vxz - vxx*vyz*vyz - vyy*vxz*vxz - vzz*vxy*vxy;
73 
74  // Calculate square root of the largest eigenvalue of error matrix.
75 
76  double ddd2 = vxx*vxx + vyy*vyy + vzz*vzz
77  - 2.*vxx*vyy - 2.*vxx*vzz - 2.*vyy*vzz
78  + 4.*vxy*vxy + 4.*vyz*vyz + 4.*vxz*vxz;
79  double ddd = sqrt(ddd2 > 0. ? ddd2 : 0.);
80  double lambda2 = 0.5 * ( vxx + vyy + vzz + ddd);
81  double lambda = sqrt(lambda2 > 0. ? lambda2 : 0.);
82 
83  return lambda;
84  }
virtual std::ostream& trkf::Surface::Print ( std::ostream &  out) const
pure virtualinherited
virtual void trkf::Surface::toGlobal ( const double  uvw[3],
double  xyz[3] 
) const
pure virtualinherited
virtual void trkf::Surface::toLocal ( const double  xyz[3],
double  uvw[3] 
) const
pure virtualinherited

Transform global to local coordinates.

Implemented in trkf::SurfXYZPlane, trkf::SurfYZLine, and trkf::SurfYZPlane.


The documentation for this class was generated from the following files: