PmaSegment3D.h
Go to the documentation of this file.
1 /**
2  * @file PmaSegment3D.h
3  *
4  * @author D.Stefan and R.Sulej
5  *
6  * @brief Implementation of the Projection Matching Algorithm
7  *
8  * 3D track segment. See PmaTrack3D.h file for details.
9  */
10 
11 #ifndef PmaSegment3D_h
12 #define PmaSegment3D_h
13 
17 
18 #include "TVector2.h"
19 #include "TVector3.h"
21 
22 namespace pma
23 {
24  class Segment3D;
25  class Track3D; // only declare here to keep "parent" of Segment3D
26 }
27 
29 {
30 public:
31  Segment3D(void) : fParent(0) {}
33 
34  Vector3D Start(void) const
35  {
36  auto const & p = static_cast< Node3D* >(Prev())->Point3D();
37  return Vector3D(p.X(), p.Y(), p.Z());
38  }
39  Vector3D End(void) const
40  {
41  auto const & p = static_cast< Node3D* >(Next())->Point3D();
42  return Vector3D(p.X(), p.Y(), p.Z());
43  }
44 
45  /// Distance [cm] from the 3D segment to the point 3D.
46  double GetDistance2To(const TVector3& p3d) const override;
47 
48  /// Distance [cm] from the 2D point to the object's 2D projection in one of wire views.
49  double GetDistance2To(const TVector2& p2d, unsigned int view) const override;
50 
51  /// Get 3D direction cosines of this segment.
52  pma::Vector3D GetDirection3D(void) const override;
53 
54  /// Get 3D projection of a 2D point from the view.
55  TVector3 GetProjection(const TVector2& p, unsigned int view) const;
56 
57  /// Get 3D projection of a 2D point from the view, no limitations if it falls beyond
58  /// the segment endpoints.
59  TVector3 GetUnconstrainedProj3D(const TVector2& p2d, unsigned int view) const override;
60 
61  /// Set hit 3D position and its 2D projection to the vertex.
62  void SetProjection(pma::Hit3D& h) const override;
63 
64  /// Squared sum of half-lengths of connected 3D segments
65  /// (used in the vertex position optimization).
66  double Length2(void) const override;
67 
68  pma::Track3D* Parent(void) const { return fParent; }
69 
70 private:
71  Segment3D(const pma::Segment3D& src);
72 
73  double SumDist2Hits(void) const override;
74 
76 
77  static double GetDist2(const TVector3& psrc, const TVector3& p0, const TVector3& p1);
78  static double GetDist2(const TVector2& psrc, const TVector2& p0, const TVector2& p1);
79 
80 };
81 
82 #endif
::fhicl::TupleAs< Point(::geo::Length_t,::geo::Length_t,::geo::Length_t)> Point3D
Atom object for reading a 3D point or vector (centimeters).
Implementation of the Projection Matching Algorithm.
double Length2(void) const override
recob::tracking::Vector_t Vector3D
Definition: Utilities.h:31
Vector3D Start(void) const
Definition: PmaSegment3D.h:34
pma::Track3D * fParent
Definition: PmaSegment3D.h:75
Implementation of the Projection Matching Algorithm.
TVector3 GetProjection(const TVector2 &p, unsigned int view) const
Get 3D projection of a 2D point from the view.
p
Definition: test.py:223
Implementation of the Projection Matching Algorithm.
pma::Vector3D GetDirection3D(void) const override
Get 3D direction cosines of this segment.
double GetDistance2To(const TVector3 &p3d) const override
Distance [cm] from the 3D segment to the point 3D.
TVector3 GetUnconstrainedProj3D(const TVector2 &p2d, unsigned int view) const override
virtual pma::SortedObjectBase * Prev(void) const
Definition: SortedObjects.h:44
double SumDist2Hits(void) const override
pma::Track3D * Parent(void) const
Definition: PmaSegment3D.h:68
virtual pma::SortedObjectBase * Next(unsigned int index=0) const
Definition: SortedObjects.h:45
void SetProjection(pma::Hit3D &h) const override
Set hit 3D position and its 2D projection to the vertex.
Implementation of the Projection Matching Algorithm.
static double GetDist2(const TVector3 &psrc, const TVector3 &p0, const TVector3 &p1)
Vector3D End(void) const
Definition: PmaSegment3D.h:39