All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TrackingTypes.h
Go to the documentation of this file.
1 #ifndef TRACKINGTYPE_H
2 #define TRACKINGTYPE_H
3 
4 // LArSoft libraries
6 
7 // ROOT libraries
8 #include "Math/GenVector/Rotation3D.h"
9 #include "Math/GenVector/AxisAngle.h"
10 #include "Math/SMatrix.h"
11 #include "TVector3.h"
12 
13 namespace recob {
14 
15  namespace tracking {
16 
17  /**
18  * Type used for coordinates and values in general.
19  * Double32_t is type that matches a 64-bits double when in memory, but is converted to a 32-bit float when written to disk.
20  * Given the size and resolution of LArTPC detectors, single-precision floats are sufficient to store the results of tracking
21  * algorithms, but it's safer to perform calculations in double precision.
22  */
23  using Coord_t = Double32_t;
24 
25  /// Type for representation of position in physical 3D space. See recob::tracking::Coord_t for more details on the actual type used.
26  using Point_t = ROOT::Math::PositionVector3D<ROOT::Math::Cartesian3D<Coord_t>, ROOT::Math::GlobalCoordinateSystemTag>;
27 
28  /// Type for representation of momenta in 3D space. See recob::tracking::Coord_t for more details on the actual type used.
29  using Vector_t = ROOT::Math::DisplacementVector3D <ROOT::Math::Cartesian3D<Coord_t>, ROOT::Math::GlobalCoordinateSystemTag>;
30 
31  /// Type of trajectory point list.
32  using Positions_t = std::vector<Point_t>;
33 
34  /// Type of momentum list.
35  using Momenta_t = std::vector<Vector_t>;
36 
37  /// Type for representation of space rotations.
38  using Rotation_t = ROOT::Math::Rotation3D;
39 
40  /// @{
41  /// Tools to aide the conversion from TVector3 to Point_t and Vector_t
42  template <typename To, typename From> std::vector<To> convertVec(std::vector<From> const& in) {
43  std::vector<To> out;
44  out.reserve(in.size());
45  for (auto& i : in) out.push_back(To(i));
46  return out;
47  }
48  template <typename From> std::vector<TVector3> convertVecPointToTVec3(std::vector<From> const& in) {
49  std::vector<TVector3> out;
50  out.reserve(in.size());
51  for (auto& i : in) out.push_back(TVector3(i.X(),i.Y(),i.Z()));
52  return out;
53  }
54  template <typename Point> Point_t toPoint(Point const& p) { return geo::vect::convertTo<Point_t>(p); }
55  template <typename Point> std::vector<Point_t> convertCollToPoint (std::vector<Point> const& coll)
56  { return geo::vect::convertCollTo<Point_t>(coll); }
57  template <typename Vector> Vector_t toVector(Vector const& p) { return geo::vect::convertTo<Vector_t>(p); }
58  template <typename Vector> std::vector<Vector_t> convertCollToVector (std::vector<Vector> const& coll)
59  { return geo::vect::convertCollTo<Vector_t>(coll); }
60  /// @}
61 
62  /// A point in the trajectory, with position and momentum.
64 
65  Point_t position; ///< position in the trajectory [cm].
66  Vector_t momentum; ///< momentum at the trajectory [GeV/c].
67 
68  /// Default constructor: sets at origin with no momentum.
69  TrajectoryPoint_t() = default;
70 
71  /// Constructor: assigns position and momentum.
73  : position(pos), momentum(mom) {}
74 
75  /// Returns the direction of the trajectory (unit vector of the momentum).
77  { return momentum.Unit(); }
78 
79  }; // TrajectoryPoint_t
80 
81  /// @{
82  /// SMatrix and SVector
83  using SMatrixSym22 = ROOT::Math::SMatrix<Double32_t,2,2,ROOT::Math::MatRepSym<Double32_t,2> >;
84  using SMatrixSym33 = ROOT::Math::SMatrix<Double32_t,3,3,ROOT::Math::MatRepSym<Double32_t,3> >;
85  using SMatrixSym55 = ROOT::Math::SMatrix<Double32_t,5,5,ROOT::Math::MatRepSym<Double32_t,5> >;
86  using SMatrixSym66 = ROOT::Math::SMatrix<Double32_t,6,6,ROOT::Math::MatRepSym<Double32_t,6> >;
87  using SMatrix65 = ROOT::Math::SMatrix<Double32_t,6,5>;
88  using SMatrix56 = ROOT::Math::SMatrix<Double32_t,5,6>;
89  using SMatrix55 = ROOT::Math::SMatrix<Double32_t,5,5>;
90  using SMatrix66 = ROOT::Math::SMatrix<Double32_t,6,6>;
91  using SVector6 = ROOT::Math::SVector<Double32_t,6>;
92  using SVector5 = ROOT::Math::SVector<Double32_t,5>;
93  using SVector3 = ROOT::Math::SVector<Double32_t,3>;
94  using SVector2 = ROOT::Math::SVector<Double32_t,2>;
95  /// @}
96 
97  }
98 
99 }
100 
101 #endif
Double32_t Coord_t
Definition: TrackingTypes.h:23
A point in the trajectory, with position and momentum.
Definition: TrackingTypes.h:63
ROOT::Math::SMatrix< Double32_t, 5, 5 > SMatrix55
Definition: TrackingTypes.h:89
ROOT::Math::SMatrix< Double32_t, 5, 5, ROOT::Math::MatRepSym< Double32_t, 5 > > SMatrixSym55
Definition: TrackingTypes.h:85
std::vector< Vector_t > convertCollToVector(std::vector< Vector > const &coll)
Definition: TrackingTypes.h:58
pdgs p
Definition: selectors.fcl:22
TrajectoryPoint_t(Point_t pos, Vector_t mom)
Constructor: assigns position and momentum.
Definition: TrackingTypes.h:72
Point_t toPoint(Point const &p)
Definition: TrackingTypes.h:54
ROOT::Math::SMatrix< Double32_t, 6, 6 > SMatrix66
Definition: TrackingTypes.h:90
ROOT::Math::SMatrix< Double32_t, 3, 3, ROOT::Math::MatRepSym< Double32_t, 3 > > SMatrixSym33
Definition: TrackingTypes.h:84
ROOT::Math::SVector< Double32_t, 3 > SVector3
Definition: TrackingTypes.h:93
ROOT::Math::SMatrix< Double32_t, 5, 6 > SMatrix56
Definition: TrackingTypes.h:88
ROOT::Math::SVector< Double32_t, 5 > SVector5
Definition: TrackingTypes.h:92
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< Coord_t >, ROOT::Math::GlobalCoordinateSystemTag > Vector_t
Type for representation of momenta in 3D space. See recob::tracking::Coord_t for more details on the ...
Definition: TrackingTypes.h:29
std::tuple< double, double, const reco::ClusterHit3D * > Point
Definitions used by the VoronoiDiagram algorithm.
Definition: DCEL.h:44
ROOT::Math::SVector< Double32_t, 2 > SVector2
Definition: TrackingTypes.h:94
Utilities to extend the interface of geometry vectors.
Vector_t momentum
momentum at the trajectory [GeV/c].
Definition: TrackingTypes.h:66
std::vector< Vector_t > Momenta_t
Type of momentum list.
Definition: TrackingTypes.h:35
std::vector< Point_t > convertCollToPoint(std::vector< Point > const &coll)
Definition: TrackingTypes.h:55
std::vector< To > convertVec(std::vector< From > const &in)
Definition: TrackingTypes.h:42
std::vector< TVector3 > convertVecPointToTVec3(std::vector< From > const &in)
Definition: TrackingTypes.h:48
TrajectoryPoint_t()=default
Default constructor: sets at origin with no momentum.
ROOT::Math::Rotation3D Rotation_t
Type for representation of space rotations.
Definition: TrackingTypes.h:38
Vector_t direction() const
Returns the direction of the trajectory (unit vector of the momentum).
Definition: TrackingTypes.h:76
ROOT::Math::SMatrix< Double32_t, 6, 6, ROOT::Math::MatRepSym< Double32_t, 6 > > SMatrixSym66
Definition: TrackingTypes.h:86
std::vector< Point_t > Positions_t
Type of trajectory point list.
Definition: TrackingTypes.h:32
if &&[-z"$BASH_VERSION"] then echo Attempting to switch to bash bash shellSwitch exit fi &&["$1"= 'shellSwitch'] shift declare a IncludeDirectives for Dir in
ROOT::Math::SMatrix< Double32_t, 2, 2, ROOT::Math::MatRepSym< Double32_t, 2 > > SMatrixSym22
Definition: TrackingTypes.h:83
ROOT::Math::SVector< Double32_t, 6 > SVector6
Definition: TrackingTypes.h:91
Vector_t toVector(Vector const &p)
Definition: TrackingTypes.h:57
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< Coord_t >, ROOT::Math::GlobalCoordinateSystemTag > Point_t
Type for representation of position in physical 3D space. See recob::tracking::Coord_t for more detai...
Definition: TrackingTypes.h:26
ROOT::Math::SMatrix< Double32_t, 6, 5 > SMatrix65
Definition: TrackingTypes.h:87
Point_t position
position in the trajectory [cm].
Definition: TrackingTypes.h:65