CGEM BOSS 6.6.5.i
BESIII Offline Software System
Loading...
Searching...
No Matches
TLine2D.h
Go to the documentation of this file.
1//-----------------------------------------------------------------------------
2// $Id: TLine2D.h,v 1.5 2010/03/31 09:58:59 liucy Exp $
3//-----------------------------------------------------------------------------
4// Filename : TLine2D.h
5// Section : Tracking
6// Owner : Yoshi Iwasaki
7// Email : [email protected]
8//-----------------------------------------------------------------------------
9// Description : A class to represent a line in 2D.
10// See http://bsunsrv1.kek.jp/~yiwasaki/tracking/
11//-----------------------------------------------------------------------------
12
13#ifndef TLINE2D_FLAG_
14#define TLINE2D_FLAG_
15
16#ifdef TRKRECO_DEBUG_DETAIL
17#ifndef TRKRECO_DEBUG
18#define TRKRECO_DEBUG
19#endif
20#endif
21class TPoint2D;
22template <class T> class CAList;
23
24/// A class to represent a line in 2D.
25class TLine2D {
26
27 public:
28 /// Constructors
29 TLine2D();
30 TLine2D(double slope, double yOffset);
31 TLine2D(const AList<TPoint2D> &);
32
33 /// Destructor
34 virtual ~TLine2D();
35
36 public:// Selectors
37 double slope(void) const;
38 double yOffset(void) const;
39 double xOffset(void) const;
40
41 public:// Modifiers
42 double slope(double);
43 double yOffset(double);
44
45 public:// Fitting
46 int fit(void);
47 double det(void) const;
48
49 public:// Geometry
50 double distance(const TPoint2D &) const;
51
52 public:// Point members
53 void append(const TPoint2D &);
54 void remove(const TPoint2D &);
55 const CAList<TPoint2D> & list(void) const;
56
57 private:
58 double _slope;
59 double _yOffset;
60 double _det;
61 mutable CAList<TPoint2D> * _list;
62};
63
64//-----------------------------------------------------------------------------
65
66#ifdef TLINE2D_NO_INLINE
67#define inline
68#else
69#undef inline
70#define TLINE2D_INLINE_DEFINE_HERE
71#endif
72#ifdef TLINE2D_INLINE_DEFINE_HERE
73
74inline
75double
76TLine2D::slope(void) const {
77 return _slope;
78}
79
80inline
81double
82TLine2D::yOffset(void) const {
83 return _yOffset;
84}
85
86inline
87double
88TLine2D::xOffset(void) const {
89 return - _yOffset / _slope;
90}
91
92inline
93double
94TLine2D::slope(double a) {
95 return _slope = a;
96}
97
98inline
99double
101 return _yOffset = a;
102}
103
104#endif
105#undef inline
106
107#endif /* TLINE2D_FLAG_ */
A class to represent a line in 2D.
Definition TLine2D.h:25
TLine2D()
Constructors.
Definition TLine2D.cxx:31
double distance(const TPoint2D &) const
Definition TLine2D.cxx:112
double yOffset(void) const
Definition TLine2D.h:82
const CAList< TPoint2D > & list(void) const
Definition TLine2D.cxx:64
double slope(void) const
Definition TLine2D.h:76
double xOffset(void) const
Definition TLine2D.h:88
void append(const TPoint2D &)
Definition TLine2D.cxx:51
double det(void) const
virtual ~TLine2D()
Destructor.
Definition TLine2D.cxx:46
void remove(const TPoint2D &)
Definition TLine2D.cxx:58
int fit(void)
Definition TLine2D.cxx:71
A class to represent a point in 2D.
Definition TPoint2D.h:37