30 template <
typename Matrix>
31 TMatrixD fillTMatrixD(Matrix
const&
mat, TMatrixD& Tmat) {
32 ROOT::Math::Rotation3D asMat(mat);
34 asMat.GetRotationMatrix(Tmat);
43 : fPositions(std::move(positions))
44 , fMomenta(std::move(momenta))
45 , fHasMomentum(hasMomenta)
48 if (fPositions.size() != fMomenta.size()) {
49 throw std::runtime_error(
"recob::Trajectory constructed with " 52 +
" momenta! it requires the same number for both." 55 if (fPositions.size() < 2) {
56 throw std::runtime_error(
"recob::Trajectory constructed with " 58 +
" trajectory points! it requires at least 2." 66 (
size_t i, TVector3& pos, TVector3&
dir)
const 68 if (!HasPoint(i))
return false;
70 auto const& origPos = LocationAtPoint(i);
71 decltype(
auto) origDir = DirectionAtPoint(i);
73 pos.SetXYZ(origPos.X(), origPos.Y(), origPos.Z());
74 dir.SetXYZ(origDir.X(), origDir.Y(), origDir.Z());
81 (std::vector<double>& start, std::vector<double>&
end)
const 113 while (next++ != last) {
114 length += (*next - *curr).
R();
143 return std::atan2(startDir.X(), startDir.Z());
181 (
unsigned int p, TMatrixD& rot)
const 184 fillTMatrixD(trackRot, rot);
198 (
unsigned int p, TMatrixD &rot)
const 201 fillTMatrixD(trackRot, rot);
206 std::ostream& recob::operator <<
208 { 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.
std::pair< Vector_t, Vector_t > Direction() const
Returns the trajectory directions at first and last point.
Vector_t EndDirection() const
Returns the direction of the trajectory at the last point.
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].
bool TrajectoryAtPoint(size_t i, TVector3 &pos, TVector3 &dir) const
Fills position and direction at the specified trajectory point.
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.
std::pair< Point_t, Point_t > Extent() const
Returns a copy of the first and last point in the trajectory.
typename BeginEndPackage< L >::End End
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.
Vector_t const & MomentumVectorAtPoint(size_t i) const
Returns the momentum vector at a point.
Vector_t StartDirection() const
Returns the direction of the trajectory at the first point.
A trajectory in space reconstructed from hits.
std::string to_string(Flag_t< Storage > const flag)
Convert a flag into a stream (shows its index).
bool HasMomentum() const
Returns whether information about the momentum is available.
tracking::Point_t Point_t
Type for representation of position in physical 3D space.
std::vector< evd::details::RawDigitInfo_t >::const_iterator end(RawDigitCacheDataClass const &cache)
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.
void FillTwoVectors(SrcVect const &firstSource, SrcVect const &secondSource, DestVect &&firstDest, DestVect &&secondDest)
Converts two vectors into another type of vector using FillVector.