LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
Track.cxx
Go to the documentation of this file.
1 //
3 // \brief Definition of track object for LArSoft
4 //
5 // \author brebel@fnal.gov
6 //
8 
11 
12 #include <iomanip>
13 #include <iostream>
14 
15 namespace recob {
16 
17  //----------------------------------------------------------------------
18  // ostream operator.
19  //
20  std::ostream& operator<<(std::ostream& stream, Track const& a)
21  {
22  auto const& start = a.VertexDirection();
23  auto const& end = a.EndDirection();
24  stream << std::setiosflags(std::ios::fixed) << std::setprecision(3) << "\n Track ID "
25  << std::setw(4) << std::right << a.ID() << " Theta = " << std::setw(6) << std::right
26  << a.Theta() << " Phi = " << std::setw(6) << std::right << a.Phi()
27  << "\n StartCosines : ( " << start.X() << " ; " << start.Y() << " ; " << start.Z()
28  << ") EndCosines : ( " << end.X() << " ; " << end.Y() << " ; " << end.Z() << ")"
29  << "\n #Position and Direction = " << std::setw(5) << std::right
31  stream << std::endl;
32 
33  return stream;
34  }
35 
36  //----------------------------------------------------------------------------
37  bool operator<(const Track& a, const Track& b)
38  {
39  if (a.ID() != b.ID()) return a.ID() < b.ID();
40 
41  return false; //They are equal
42  }
43 
44  //----------------------------------------------------------------------------
46  {
47  Track::SVector6 result;
48  result[0] = Vertex().X();
49  result[1] = Vertex().Y();
50  result[2] = Vertex().Z();
51  result[3] = VertexDirection().X();
52  result[4] = VertexDirection().Y();
53  result[5] = VertexDirection().Z();
54  return result;
55  }
56 
58  {
59  Track::SVector6 result;
60  result[0] = End().X();
61  result[1] = End().Y();
62  result[2] = End().Z();
63  result[3] = EndDirection().X();
64  result[4] = EndDirection().Y();
65  result[5] = EndDirection().Z();
66  return result;
67  }
68 
70  {
71  //return tracking::Plane::Global6DToLocal5DParameters(VertexParametersGlobal6D(), fTraj.Vertex(), fTraj.VertexDirection());
72  return Track::SVector5(0., 0., 0., 0., (HasMomentum() ? 1. / VertexMomentum() : 1.));
73  }
74 
76  {
77  //return tracking::Plane::Global6DToLocal5DParameters(EndParametersGlobal6D(), fTraj.End(), fTraj.EndDirection());
78  return Track::SVector5(0., 0., 0., 0., (HasMomentum() ? 1. / EndMomentum() : 1.));
79  }
80 
82  {
85  }
86 
88  {
91  }
92 
93 }
TrackTrajectory fTraj
Stored trajectory data member.
Definition: Track.h:70
SVector6 EndParametersGlobal6D() const
Accessors to track parameters and covariance matrices in Local5D and Global6D coordinates.
Definition: Track.cxx:57
double EndMomentum() const
Definition: Track.h:178
double VertexMomentum() const
Definition: Track.h:176
constexpr auto const & right(const_AssnsIter< L, R, D, Dir > const &a, const_AssnsIter< L, R, D, Dir > const &b)
Definition: AssnsIter.h:102
tracking::SVector5 SVector5
Definition: Track.h:64
SMatrixSym55 fCovVertex
Covariance matrix (local 5D representation) at start point (vertex)
Definition: Track.h:75
Reconstruction base classes.
SMatrixSym55 fCovEnd
Covariance matrix (local 5D representation) at end point.
Definition: Track.h:76
bool operator<(Cluster const &a, Cluster const &b)
Definition: Cluster.cxx:188
SMatrixSym66 EndCovarianceGlobal6D() const
Accessors to track parameters and covariance matrices in Local5D and Global6D coordinates.
Definition: Track.cxx:87
bool HasMomentum() const
Definition: Track.h:174
size_t NumberTrajectoryPoints() const
Various functions related to the presence and the number of (valid) points.
Definition: Track.h:136
Vector_t const & VertexMomentumVector() const
Returns the momentum of the trajectory at the first valid point [GeV/c].
Vector_t VertexDirection() const
Access to track direction at different points.
Definition: Track.h:166
tracking::SMatrixSym66 SMatrixSym66
Definition: Track.h:60
tracking::SVector6 SVector6
Definition: Track.h:63
SMatrixSym66 VertexCovarianceGlobal6D() const
Accessors to track parameters and covariance matrices in Local5D and Global6D coordinates.
Definition: Track.cxx:81
decltype(auto) constexpr end(T &&obj)
ADL-aware version of std::end.
Definition: StdUtils.h:77
Vector_t VertexDirection() const
Returns the direction of the trajectory at the first point.
SVector5 EndParametersLocal5D() const
Accessors to track parameters and covariance matrices in Local5D and Global6D coordinates.
Definition: Track.cxx:75
double Phi() const
Access to spherical or geographical angles at vertex or at any point.
Definition: Track.h:218
double Theta() const
Access to spherical or geographical angles at vertex or at any point.
Definition: Track.h:216
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...
Point_t const & Vertex() const
Access to track position at different points.
Definition: Track.h:158
Provides recob::Track data product.
Vector_t EndDirection() const
Returns the direction of the trajectory at the last point.
int ID() const
Definition: Track.h:244
SVector6 VertexParametersGlobal6D() const
Accessors to track parameters and covariance matrices in Local5D and Global6D coordinates.
Definition: Track.cxx:45
Vector_t const & EndMomentumVector() const
Returns the momentum of the trajectory at the last valid point [GeV/c].
Vector_t EndDirection() const
Access to track direction at different points.
Definition: Track.h:167
SVector5 VertexParametersLocal5D() const
Accessors to track parameters and covariance matrices in Local5D and Global6D coordinates.
Definition: Track.cxx:69
Point_t const & End() const
Access to track position at different points.
Definition: Track.h:159
Track from a non-cascading particle.A recob::Track consists of a recob::TrackTrajectory, plus additional members relevant for a "fitted" track:
Definition: Track.h:49
std::ostream & operator<<(std::ostream &o, Cluster const &c)
Definition: Cluster.cxx:168