Surface.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 ///
3 /// \file Surface.h
4 ///
5 /// \brief Base class for Kalman filter surface.
6 ///
7 /// \author H. Greenlee
8 ///
9 /// Surfaces may have the following distinct uses in the context
10 /// of the Kalman filter.
11 ///
12 /// 1. Destination for track propagation.
13 /// 2. Define a local 3D coordinate systems.
14 /// 3. Have a standard set of track parameters, which are meaningful
15 /// in the local coordinate system.
16 ///
17 /// Larsoft global coordinates are (x,y,z).
18 ///
19 /// Surface local coordinates are called (u,v,w), where w=0 is the
20 /// surface, and (u,v) are the local coordinates within the surface.
21 ///
22 /// Notes about track and surface directions:
23 ///
24 /// 1. Surfaces are in general orientable, which means that a track
25 /// that is located at a surface can be propagating in the forward
26 /// direction with respect to the surface (dw/ds > 0) or in the
27 /// backward direction (dw/ds < 0).
28 /// 2. For some kinds surfaces and track parameters, the track
29 /// direction is implied by the track parameters themselves.
30 /// For others it isn't, and must be supplied externally.
31 /// 3. A surface can be queried to find the track direction implied
32 /// by track parameters, (via method Surface::getDirection), with
33 /// result returned via enum TrackDirection (possible values FORWARD,
34 /// BACKWARD, UNKNOWN).
35 /// 4. In all situations, a direction implied by track parameters
36 /// has precedence over an externally supplied one.
37 ///
38 /// This class doesn't have any attributes of its own, but it provides
39 /// several virtual methods that derived classes can or must override.
40 ///
41 ////////////////////////////////////////////////////////////////////////
42 
43 #ifndef SURFACE_H
44 #define SURFACE_H
45 
46 #include <iosfwd>
48 
49 namespace trkf {
50 
51  class Surface
52  {
53  public:
54 
55  /// Track direction enum.
57 
58  /// Default constructor.
59  Surface();
60 
61  /// Destructor.
62  virtual ~Surface();
63 
64  // Virtual methods.
65 
66  /// Clone method.
67  virtual Surface* clone() const = 0;
68 
69  /// Surface-specific tests of validity of track parameters.
70  virtual bool isTrackValid(const TrackVector& vec) const = 0;
71 
72  /// Transform global to local coordinates.
73  virtual void toLocal(const double xyz[3], double uvw[3]) const = 0;
74 
75  /// Transform local to global coordinates.
76  virtual void toGlobal(const double uvw[3], double xyz[3]) const = 0;
77 
78  /// Calculate difference of two track parameter vectors.
79  virtual TrackVector getDiff(const TrackVector& vec1, const TrackVector& vec2) const;
80 
81  /// Get position of track.
82  virtual void getPosition(const TrackVector& vec, double xyz[3]) const = 0;
83 
84  /// Get direction of track (default UNKNOWN).
85  virtual TrackDirection getDirection(const TrackVector& /* vec */,
86  TrackDirection dir=UNKNOWN) const {return dir;}
87 
88  /// Get momentum vector of track.
89  virtual void getMomentum(const TrackVector& vec, double mom[3],
90  TrackDirection dir=UNKNOWN) const = 0;
91 
92  /// Get pointing error of track.
93  virtual double PointingError(const TrackVector& vec, const TrackError& err) const = 0;
94 
95  /// Get starting error matrix for Kalman filter.
96  virtual void getStartingError(TrackError& err) const = 0;
97 
98  /// Test whether two surfaces are parallel, within tolerance.
99  virtual bool isParallel(const Surface& surf) const = 0;
100 
101  /// Find perpendicular forward distance to a parallel surface
102  virtual double distanceTo(const Surface& surf) const = 0;
103 
104  /// Test two surfaces for equality, within tolerance.
105  virtual bool isEqual(const Surface& surf) const = 0;
106 
107  /// Printout
108  virtual std::ostream& Print(std::ostream& out) const = 0;
109  };
110 
111  /// Output operator.
112  std::ostream& operator<<(std::ostream& out, const Surface& surf);
113 }
114 
115 #endif
virtual void getStartingError(TrackError &err) const =0
Get starting error matrix for Kalman filter.
TrackDirection
Track direction enum.
Definition: Surface.h:56
virtual std::ostream & Print(std::ostream &out) const =0
Printout.
virtual double PointingError(const TrackVector &vec, const TrackError &err) const =0
Get pointing error of track.
KSymMatrix< 5 >::type TrackError
Track error matrix, dimension 5x5.
virtual bool isTrackValid(const TrackVector &vec) const =0
Surface-specific tests of validity of track parameters.
virtual Surface * clone() const =0
Clone method.
string dir
virtual bool isEqual(const Surface &surf) const =0
Test two surfaces for equality, within tolerance.
virtual bool isParallel(const Surface &surf) const =0
Test whether two surfaces are parallel, within tolerance.
virtual TrackVector getDiff(const TrackVector &vec1, const TrackVector &vec2) const
Calculate difference of two track parameter vectors.
Definition: Surface.cxx:33
std::ostream & operator<<(std::ostream &out, const KGTrack &trg)
Output operator.
Definition: KGTrack.cxx:309
virtual void toLocal(const double xyz[3], double uvw[3]) const =0
Transform global to local coordinates.
KVector< 5 >::type TrackVector
Track state vector, dimension 5.
virtual double distanceTo(const Surface &surf) const =0
Find perpendicular forward distance to a parallel surface.
void err(const char *fmt,...)
Definition: message.cpp:226
Kalman filter linear algebra typedefs.
Surface()
Default constructor.
Definition: Surface.cxx:16
virtual void getMomentum(const TrackVector &vec, double mom[3], TrackDirection dir=UNKNOWN) const =0
Get momentum vector of track.
virtual ~Surface()
Destructor.
Definition: Surface.cxx:20
virtual TrackDirection getDirection(const TrackVector &, TrackDirection dir=UNKNOWN) const
Get direction of track (default UNKNOWN).
Definition: Surface.h:85
virtual void getPosition(const TrackVector &vec, double xyz[3]) const =0
Get position of track.
virtual void toGlobal(const double uvw[3], double xyz[3]) const =0
Transform local to global coordinates.