LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
TrackingPlane.h
Go to the documentation of this file.
1 #ifndef TRACKINGPLANE_H
2 #define TRACKINGPLANE_H
3 
5 
6 namespace recob {
7  namespace tracking {
8 
36 
37  class Plane {
38 
41  struct TrigCache {
42  public:
43  TrigCache(const Vector_t& planeDir)
44  {
45  const double diryz = std::hypot(planeDir.Y(), planeDir.Z());
46  fCosA = diryz;
47  fSinA = planeDir.X();
48  fCosB = (diryz != 0.0) ? planeDir.Z()/diryz : 1.0;
49  fSinB = (diryz != 0.0) ? -planeDir.Y()/diryz : 0.0;
50  }
51  double fCosA;
52  double fSinA;
53  double fCosB;
54  double fSinB;
55  };
56 
57  public:
58 
61  Plane(const Point_t& planePos, const Vector_t& planeDir)
62  : fPlanePos(planePos), fPlaneDir(planeDir.Unit()), fTrigCache(planeDir.Unit()) { }
63 
66  Point_t const& position() const { return fPlanePos; }
67 
70  Vector_t const& direction() const { return fPlaneDir; }
71 
75  SVector5 Global6DToLocal5DParameters(const SVector6& par6d, const Point_t& planePos, const Vector_t& planeDir, const TrigCache& trigCache) const;
77 
79  inline SVector6 Local5DToGlobal6DParameters(const SVector5& par5d, bool trackAlongPlaneDir = true) const { return Local5DToGlobal6DParameters(par5d, fPlanePos, fPlaneDir, fTrigCache, trackAlongPlaneDir); }
81  SVector6 Local5DToGlobal6DParameters(const SVector5& par5d, const Point_t& planePos, const Vector_t& planeDir, const TrigCache& trigCache, bool trackAlongPlaneDir = true) const;
83 
85  inline SMatrix65 Local5DToGlobal6DJacobian(bool hasMomentum, const Vector_t& trackMomOrDir) const { return Local5DToGlobal6DJacobian(hasMomentum, trackMomOrDir,fPlaneDir,fTrigCache); }
87  SMatrix65 Local5DToGlobal6DJacobian(bool hasMomentum, const Vector_t& trackMomOrDir, const Vector_t& planeDir, const TrigCache& trigCache) const;
89 
91  inline SMatrix56 Global6DToLocal5DJacobian(bool hasMomentum, const Vector_t& trackMomOrDir) const { return Global6DToLocal5DJacobian(hasMomentum, trackMomOrDir,fPlaneDir,fTrigCache); }
93  SMatrix56 Global6DToLocal5DJacobian(bool hasMomentum, const Vector_t& trackMomOrDir, const Vector_t& planeDir, const TrigCache& trigCache) const;
95 
97  inline SMatrixSym66 Local5DToGlobal6DCovariance(SMatrixSym55 cov5d, bool hasMomentum, const Vector_t& trackMomOrDir) const {
98  return Local5DToGlobal6DCovariance(cov5d, hasMomentum,trackMomOrDir,fPlaneDir);
99  }
100 
102  inline SMatrixSym55 Global6DToLocal5DCovariance(SMatrixSym66 cov6d, bool hasMomentum, const Vector_t& trackMomOrDir) const {
103  return Global6DToLocal5DCovariance(cov6d,hasMomentum,trackMomOrDir,fPlaneDir);
104  }
105 
109  Rotation_t Global3DToLocal3DRotation(const Vector_t& planeDir, const TrigCache& trigCache) const;
111 
115  Rotation_t Local3DToGlobal3DRotation(const Vector_t& planeDir, const TrigCache& trigCache) const;
117 
119  double cosAlpha() const { return fTrigCache.fCosA; }
121  double sinAlpha() const { return fTrigCache.fSinA; }
122  double cosBeta() const { return fTrigCache.fCosB; }
123  double sinBeta() const { return fTrigCache.fSinB; }
125 
127  static SVector5 Global6DToLocal5DParameters(const SVector6& par6d, const Point_t& planePos, const Vector_t& planeDir) {
128  Plane p(planePos, planeDir); return p.Global6DToLocal5DParameters(par6d);
129  }
131  static SVector6 Local5DToGlobal6DParameters(const SVector5& par5d, const Point_t& planePos, const Vector_t& planeDir, bool trackAlongPlaneDir = true) {
132  Plane p(planePos, planeDir); return p.Local5DToGlobal6DParameters(par5d, trackAlongPlaneDir);
133  }
135  static SMatrix65 Local5DToGlobal6DJacobian(bool hasMomentum, const Vector_t& trackMomOrDir, const Vector_t& planeDir) {
136  Plane p(Point_t(), planeDir); return p.Local5DToGlobal6DJacobian(hasMomentum, trackMomOrDir);
137  }
139  static SMatrix65 Local5DToGlobal6DJacobian(bool hasMomentum, const SVector6& par6d, const Vector_t& planeDir) {
140  Plane p(Point_t(), planeDir); return p.Local5DToGlobal6DJacobian(hasMomentum, Vector_t(par6d[3],par6d[4],par6d[5]));
141  }
143  static SMatrix56 Global6DToLocal5DJacobian(bool hasMomentum, const Vector_t& trackMomOrDir, const Vector_t& planeDir) {
144  Plane p(Point_t(), planeDir); return p.Global6DToLocal5DJacobian(hasMomentum, trackMomOrDir);
145  }
147  static SMatrix56 Global6DToLocal5DJacobian(bool hasMomentum, const SVector6& par6d, const Vector_t& planeDir) {
148  Plane p(Point_t(), planeDir); return p.Global6DToLocal5DJacobian(hasMomentum, Vector_t(par6d[3],par6d[4],par6d[5]));
149  }
151  static SMatrixSym66 Local5DToGlobal6DCovariance(SMatrixSym55 cov5d, bool hasMomentum, const Vector_t& trackMomOrDir, const Vector_t& planeDir) {
152  return ROOT::Math::Similarity(Local5DToGlobal6DJacobian(hasMomentum,trackMomOrDir,planeDir),cov5d);
153  }
155  static SMatrixSym55 Global6DToLocal5DCovariance(SMatrixSym66 cov6d, bool hasMomentum, const Vector_t& trackMomOrDir, const Vector_t& planeDir) {
156  return ROOT::Math::Similarity(Global6DToLocal5DJacobian(hasMomentum,trackMomOrDir,planeDir),cov6d);
157  }
160  Plane p(Point_t(), planeDir); return p.Global3DToLocal3DRotation();
161  }
164  Plane p(Point_t(), planeDir); return p.Local3DToGlobal3DRotation();
165  }
166 
167  private:
171  };
172 
173  }
174 }
175 
176 #endif
double cosAlpha() const
Return cached values of trigonometric function for angles defining the plane.
Vector_t const & direction() const
Reference direction orthogonal to the plane.
Definition: TrackingPlane.h:70
SMatrix65 Local5DToGlobal6DJacobian(bool hasMomentum, const Vector_t &trackMomOrDir) const
Compute the jacobian to translate track covariance from local to global coordinates. The track momentum (or direction) is needed to compute the jacobian. Local coordinates are on the plane orthogonal to planeDir (it may be the same direction as the momentum, but the function is generic).
Definition: TrackingPlane.h:86
Struct caching trigonometric function results.
Definition: TrackingPlane.h:41
static SMatrix65 Local5DToGlobal6DJacobian(bool hasMomentum, const SVector6 &par6d, const Vector_t &planeDir)
Compute the jacobian to translate track covariance from local to global coordinates. The track momentum (or direction) is needed to compute the jacobian. Local coordinates are on the plane orthogonal to planeDir (it may be the same direction as the momentum, but the function is generic).
Reconstruction base classes.
static SVector6 Local5DToGlobal6DParameters(const SVector5 &par5d, const Point_t &planePos, const Vector_t &planeDir, bool trackAlongPlaneDir=true)
Function to convert parameters from local to global coordinates. Local coordinates are on the plane w...
geo::Point_t Point_t
Type for representation of position in physical 3D space.
Definition: TrackingTypes.h:20
Point_t fPlanePos
Position of a point on the plane.
Rotation_t Global3DToLocal3DRotation() const
Calculate rotation matrices from global (x,y,z) to local (u,v,w) coordinates.
static SMatrixSym55 Global6DToLocal5DCovariance(SMatrixSym66 cov6d, bool hasMomentum, const Vector_t &trackMomOrDir, const Vector_t &planeDir)
Translate track covariance from global to local coordinates. The track momentum (or direction) is nee...
SVector5 Global6DToLocal5DParameters(const SVector6 &par6d) const
Function to convert parameters from global to local coordinates. Local coordinates are on the plane w...
Definition: TrackingPlane.h:74
Plane(const Point_t &planePos, const Vector_t &planeDir)
Constructor from reference position on the plane and direction orthogonal to the plane.
Definition: TrackingPlane.h:61
double cosBeta() const
Return cached values of trigonometric function for angles defining the plane.
TrigCache fTrigCache
Cached trigonometric function values.
static SVector5 Global6DToLocal5DParameters(const SVector6 &par6d, const Point_t &planePos, const Vector_t &planeDir)
Function to convert parameters from global to local coordinates. Local coordinates are on the plane w...
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > SMatrixSym55
Definition: TrackingTypes.h:57
ROOT::Math::SVector< double, 6 > SVector6
Definition: TrackingTypes.h:63
static SMatrix56 Global6DToLocal5DJacobian(bool hasMomentum, const SVector6 &par6d, const Vector_t &planeDir)
Compute the jacobian to translate track covariance from global to local coordinates. The track momentum (or direction) is needed to compute the jacobian. Local coordinates are on the plane orthogonal to planeDir (it may be the same direction as the momentum, but the function is generic). Warning: some information may be lost in degenerate cases, e.g. the unceratinty along z position when converting to a x-y plane (fixed z)
Vector_t fPlaneDir
Direction vector othogonal to the plane.
static Rotation_t Local3DToGlobal3DRotation(const Vector_t &planeDir)
Calculate rotation matrices from local (u,v,w) to global (x,y,z) coordinates.
Point_t const & position() const
Reference position on the plane.
Definition: TrackingPlane.h:66
SMatrixSym66 Local5DToGlobal6DCovariance(SMatrixSym55 cov5d, bool hasMomentum, const Vector_t &trackMomOrDir) const
Translate track covariance from local to global coordinates. The track momentum (or direction) is nee...
Definition: TrackingPlane.h:97
geo::Vector_t Vector_t
Type for representation of momenta in 3D space.
Definition: TrackingTypes.h:23
ROOT::Math::SVector< double, 5 > SVector5
Definition: TrackingTypes.h:64
static SMatrixSym66 Local5DToGlobal6DCovariance(SMatrixSym55 cov5d, bool hasMomentum, const Vector_t &trackMomOrDir, const Vector_t &planeDir)
Translate track covariance from local to global coordinates. The track momentum (or direction) is nee...
SVector6 Local5DToGlobal6DParameters(const SVector5 &par5d, bool trackAlongPlaneDir=true) const
Function to convert parameters from local to global coordinates. Local coordinates are on the plane w...
Definition: TrackingPlane.h:80
ROOT::Math::SMatrix< double, 6, 5 > SMatrix65
Definition: TrackingTypes.h:59
Class defining a plane for tracking. It provides various functionalities to convert track parameters ...
Definition: TrackingPlane.h:37
ROOT::Math::Rotation3D Rotation_t
Type for representation of space rotations.
Definition: TrackingTypes.h:32
TrigCache(const Vector_t &planeDir)
Definition: TrackingPlane.h:43
static Rotation_t Global3DToLocal3DRotation(const Vector_t &planeDir)
Calculate rotation matrices from global (x,y,z) to local (u,v,w) coordinates.
double sinAlpha() const
Return cached values of trigonometric function for angles defining the plane.
SMatrixSym55 Global6DToLocal5DCovariance(SMatrixSym66 cov6d, bool hasMomentum, const Vector_t &trackMomOrDir) const
Translate track covariance from global to local coordinates. The track momentum (or direction) is nee...
double sinBeta() const
Return cached values of trigonometric function for angles defining the plane.
ROOT::Math::SMatrix< double, 5, 6 > SMatrix56
Definition: TrackingTypes.h:60
static SMatrix56 Global6DToLocal5DJacobian(bool hasMomentum, const Vector_t &trackMomOrDir, const Vector_t &planeDir)
Compute the jacobian to translate track covariance from global to local coordinates. The track momentum (or direction) is needed to compute the jacobian. Local coordinates are on the plane orthogonal to planeDir (it may be the same direction as the momentum, but the function is generic). Warning: some information may be lost in degenerate cases, e.g. the unceratinty along z position when converting to a x-y plane (fixed z)
ROOT::Math::SMatrix< double, 6, 6, ROOT::Math::MatRepSym< double, 6 > > SMatrixSym66
Definition: TrackingTypes.h:58
Rotation_t Local3DToGlobal3DRotation() const
Calculate rotation matrices from local (u,v,w) to global (x,y,z) coordinates.
static SMatrix65 Local5DToGlobal6DJacobian(bool hasMomentum, const Vector_t &trackMomOrDir, const Vector_t &planeDir)
Compute the jacobian to translate track covariance from local to global coordinates. The track momentum (or direction) is needed to compute the jacobian. Local coordinates are on the plane orthogonal to planeDir (it may be the same direction as the momentum, but the function is generic).
SMatrix56 Global6DToLocal5DJacobian(bool hasMomentum, const Vector_t &trackMomOrDir) const
Compute the jacobian to translate track covariance from global to local coordinates. The track momentum (or direction) is needed to compute the jacobian. Local coordinates are on the plane orthogonal to planeDir (it may be the same direction as the momentum, but the function is generic). Warning: some information may be lost in degenerate cases, e.g. the unceratinty along z position when converting to a x-y plane (fixed z)
Definition: TrackingPlane.h:92