25 : fPositions(std::move(positions))
26 , fMomenta(std::move(momenta))
27 , fHasMomentum(hasMomenta)
30 if (fPositions.size() != fMomenta.size()) {
31 throw std::runtime_error(
"recob::Trajectory constructed with "
34 +
" momenta! it requires the same number for both."
37 if (fPositions.size() < 2) {
38 throw std::runtime_error(
"recob::Trajectory constructed with "
40 +
" trajectory points! it requires at least 2."
73 while (next++ != last) {
74 length += (*next - *curr).R();
90 return util::pi<Coord_t>() - std::acos(DirectionAtPoint(p).Y());
102 decltype(
auto) startDir = DirectionAtPoint(p);
103 return std::atan2(startDir.X(), startDir.Z());
120 auto const& mom = MomentumVectorAtPoint(i);
121 return HasMomentum()? (mom / mom.R()): mom;
143 std::ostream& recob::operator <<
145 { traj.Dump(out);
return out; }
Trajectory()=default
Default constructor; do not use it! it's needed by ROOT I/O.
Data product for reconstructed trajectory in space.
Rotation_t Global3DToLocal3DRotation() const
Calculate rotation matrices from global (x,y,z) to local (u,v,w) coordinates.
tracking::Coord_t Coord_t
Type used for coordinates and values in general.
Point_t const & End() const
Returns the position of the last point of the trajectory [cm].
double AzimuthAngle(size_t p=0) const
"Azimuth" angle of trajectory, with respect to the sky.
double ZenithAngle(size_t p=0) const
"Zenith" angle of trajectory, with respect to the vertical axis.
double Length(size_t startAt=0) const
Returns the approximate length of the trajectory.
Rotation_t LocalToGlobalRotationAtPoint(size_t p) const
Returns a rotation matrix bringing relative directions to global.
Vector_t DirectionAtPoint(size_t i) const
Computes and returns the direction of the trajectory at a point.
Rotation_t GlobalToLocalRotationAtPoint(size_t p) const
Returns a rotation matrix that brings trajectory direction along z.
tracking::Vector_t Vector_t
Type for representation of momenta in 3D space.
size_t LastPoint() const
Returns the index of the last point in the trajectory.
Point_t const & LocationAtPoint(size_t i) const
Returns the position at the specified trajectory point.
tracking::Positions_t Positions_t
Type of trajectory point list.
tracking::Momenta_t Momenta_t
Type of momentum list.
A trajectory in space reconstructed from hits.
std::string to_string(WindowPattern const &pattern)
tracking::Point_t Point_t
Type for representation of position in physical 3D space.
Collection of Physical constants used in LArSoft.
Rotation_t Local3DToGlobal3DRotation() const
Calculate rotation matrices from local (u,v,w) to global (x,y,z) coordinates.
tracking::Rotation_t Rotation_t
Type for representation of space rotations.