HoughPoint.h
Go to the documentation of this file.
1 #ifndef HOUGHPOINT_H
2 #define HOUGHPOINT_H
3 
4 #include "TVector2.h"
5 
6 /********************************************************************
7  * The HoughPoint class represents the point of intersection of *
8  * two trajectories in in hough space. The class contains the two *
9  * data points which are transformed into trajectories as well as *
10  * the resulting hough parameters. This allows for easy mapping *
11  * between the accumulation in the hough space and the data points *
12  * back in the normal data space. *
13  * *
14  * This version is optimized for a 2D linear hough transform. *
15  * *
16  * anorman@fnal.gov *
17  ********************************************************************/
18 
19 namespace novaddt {
20 
21  class DAQHit;
22 
23  class HoughPoint;
24 }
25 
26 // Notes and suggestions:
27 //
28 // Holding a shared pointer to a HoughData was a false economy: a
29 // HoughPoint below is two pointers, and two floats: a shared pointer as
30 // before was multiple contained classes and lots of reference-counting
31 // machinery.
32 //
33 // Use compiler-default methods whenever possible. Here, two hits are
34 // used rather than an array of hits to allow this.
35 //
36 // reset() is usually the term used for what you had as clear(). clear()
37 // usually refers to containers.
38 //
39 // size() is similarly used by containers and could confuse someone who
40 // expected the answer 2 (two hits). If someone wants sizeof(), they'll
41 // use sizeof().
42 //
43 // I haven't changed it, but rather than print(), a more versatile idiom
44 // is to implement a free operator << () which can be used with any
45 // stream. This often calls a member function with ostream
46 // &print(ostream &, <type>).
47 //
48 // calc() is void: no point in returning something you're not going to
49 // use.
50 //
51 // By taking calc() private, having reset(...) instead of setPoint() and
52 // relying on compiler-generated copy/asignment, we now have a class
53 // invariant: _cosv and _doca will always be correct for the given
54 // (_p1, _p2).
56  public:
57  HoughPoint();
58 #ifndef __GCCXML__
59  HoughPoint(DAQHit const & p1, TVector2 const & coord1, DAQHit const & p2, TVector2 const & coord2);
60  // Use default copy/move constructors and assignment.
61 
62  /// Initialization of Data members
63  void reset(DAQHit const & p1, TVector2 const & coord1, DAQHit const & p2, TVector2 const & coord2);
64  void reset();
65 
66  void print() const;
67 #endif
68  ~HoughPoint();
69 
70  float const & getCosv() const { return _cosv; };
71  float const & getDoca() const { return _doca; };
72 
73  float const & getDist() const { return _dist; };
74  float const & getVpro() const { return _vpro; };
75 
76  DAQHit const & getCh1() const { return *_p1; };
77  DAQHit const & getCh2() const { return *_p2; };
78 
79 private:
80  void calc();
81 
82  DAQHit const * _p1; // Non-owning: consider cet::exempt_ptr.
83  TVector2 const * _coord1;
84  DAQHit const * _p2; // Non-owning: consider cet::exempt_ptr.
85  TVector2 const * _coord2;
86 
87  // Computed data members
88  float _cosv;
89  float _doca;
90 
91  float _dist;
92  float _vpro;
93 
94 };
95 
96 #endif /* DAQHIT_H */
float const & getCosv() const
Definition: HoughPoint.h:70
void print() const
Definition: HoughPoint.cxx:62
float const & getDoca() const
Definition: HoughPoint.h:71
DAQHit const & getCh2() const
Definition: HoughPoint.h:77
TVector2 const * _coord1
Definition: HoughPoint.h:83
float const & getDist() const
Definition: HoughPoint.h:73
DAQHit const * _p1
Definition: HoughPoint.h:82
DAQHit const * _p2
Definition: HoughPoint.h:84
TVector2 const * _coord2
Definition: HoughPoint.h:85
DAQHit const & getCh1() const
Definition: HoughPoint.h:76
float const & getVpro() const
Definition: HoughPoint.h:74