Belle II Software  release-05-01-25
HoughTransformationCircle.cc
1 //-----------------------------------------------------------------------------
2 // $Id$
3 //-----------------------------------------------------------------------------
4 // Filename : HoughTransformationCircle.cc
5 // Section : TRG CDC
6 // Owner : Yoshihito Iwasaki
7 // Email : yoshihito.iwasaki@kek.jp
8 //-----------------------------------------------------------------------------
9 // Description : A class to represent circle Hough transformation.
10 //-----------------------------------------------------------------------------
11 // $Log$
12 //-----------------------------------------------------------------------------
13 
14 #include <math.h>
15 #include "trg/trg/Point2D.h"
16 #include "trg/cdc/HoughTransformationCircle.h"
17 
18 
19 
20 namespace Belle2 {
27  const std::string& name)
29  {
30  }
31 
33  {
34  }
35 
36  float
37  TRGCDCHoughTransformationCircle::y(float xReal, float yReal, float x) const
38  {
39 // return log10((xReal * xReal + yReal * yReal) /
40 // (2 * xReal * cos(x) + 2 * yReal * sin(x)));
41  const float r = (xReal * xReal + yReal * yReal) /
42  (2 * xReal * cos(x) + 2 * yReal * sin(x));
43  if (r > 0)
44  return log10(r);
45  else
46  return 0;
47  }
48 
51  {
52 // return TRGPoint2D(pow(10, p.y()), p.x());
53  return TRGPoint2D(p.x(), pow(10, p.y()));
54  }
55 
58  {
59  return TRGPoint2D(p.x(), log10(p.y()));
60  }
61 
62  bool
64  float yReal,
65  float x0,
66  float x1) const
67  {
68  static const float PI2 = 2 * M_PI;
69 
70  //...Divergence points...
71  float d0 = atan(- xReal / yReal);
72  if (d0 < 0) d0 += PI2;
73  float d1 = d0 + M_PI;
74  if (d1 > PI2) d1 -= PI2;
75 
76  //...In region ?...
77  if ((x0 < d0) && (d0 < x1)) return true;
78  if ((x0 < d1) && (d1 < x1)) return true;
79 
80  return false;
81  }
82 
83  bool
85  float yReal,
86  float x0,
87  float x1) const
88  {
89  return diverge(xReal, yReal, x0, x1);
90  }
91 
92  bool
94  float yReal,
95  float x0,
96  float x1) const
97  {
98  return diverge(xReal, yReal, x0, x1);
99  }
100 
102 } // namespace Belle2
Belle2::TRGCDCHoughTransformationCircle::convert
virtual TRGPoint2D convert(const TRGPoint2D &) const override
converts Point2D(phi, r) in real plane into Point2D(phi, r) in Hough plane.
Definition: HoughTransformationCircle.cc:57
Belle2::TRGPoint2D
A class to represent a point in 2D.
Definition: Point2D.h:32
Belle2::TRGCDCHoughTransformationCircle::~TRGCDCHoughTransformationCircle
virtual ~TRGCDCHoughTransformationCircle()
Destructor.
Definition: HoughTransformationCircle.cc:32
Belle2::TRGCDCHoughTransformation
An abstract class to represent a Hough transformation.
Definition: HoughTransformation.h:32
Belle2::TRGCDCHoughTransformationCircle::diverge
virtual bool diverge(float xReal, float yReal, float x0, float x1) const override
returns true if Y diverges in given region.
Definition: HoughTransformationCircle.cc:63
Belle2::TRGCDCHoughTransformationCircle::negativeDiverge
virtual bool negativeDiverge(float xReal, float yReal, float x0, float x1) const override
returns true if Y diverges in given region.
Definition: HoughTransformationCircle.cc:93
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::TRGCDCHoughTransformationCircle::circleCenter
virtual TRGPoint2D circleCenter(const TRGPoint2D &) const
returns Point2D(phi, r) of a circle in real plane.
Definition: HoughTransformationCircle.cc:50
Belle2::TRGCDCHoughTransformationCircle::TRGCDCHoughTransformationCircle
TRGCDCHoughTransformationCircle(const std::string &name)
Contructor.
Definition: HoughTransformationCircle.cc:26
Belle2::TRGCDCHoughTransformationCircle::y
virtual float y(float xReal, float yReal, float x) const override
returns Y coordinate in a Hough parameter plane.
Definition: HoughTransformationCircle.cc:37
Belle2::TRGCDCHoughTransformationCircle::positiveDiverge
virtual bool positiveDiverge(float xReal, float yReal, float x0, float x1) const override
returns true if Y diverges in given region.
Definition: HoughTransformationCircle.cc:84