Belle II Software development
HoughTransformationCircle.cc
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
9//-----------------------------------------------------------------------------
10// Description : A class to represent circle Hough transformation.
11//-----------------------------------------------------------------------------
12
13#include <math.h>
14#include "trg/trg/Point2D.h"
15#include "trg/cdc/HoughTransformationCircle.h"
16
17
18
19namespace Belle2 {
26 const std::string& name)
28 {
29 }
30
32 {
33 }
34
35 float
36 TRGCDCHoughTransformationCircle::y(float xReal, float yReal, float x) const
37 {
38// return log10((xReal * xReal + yReal * yReal) /
39// (2 * xReal * cos(x) + 2 * yReal * sin(x)));
40 const float r = (xReal * xReal + yReal * yReal) /
41 (2 * xReal * cos(x) + 2 * yReal * sin(x));
42 if (r > 0)
43 return log10(r);
44 else
45 return 0;
46 }
47
50 {
51// return TRGPoint2D(pow(10, p.y()), p.x());
52 return TRGPoint2D(p.x(), pow(10, p.y()));
53 }
54
57 {
58 return TRGPoint2D(p.x(), log10(p.y()));
59 }
60
61 bool
63 float yReal,
64 float x0,
65 float x1) const
66 {
67 static const float PI2 = 2 * M_PI;
68
69 //...Divergence points...
70 float d0 = atan(- xReal / yReal);
71 if (d0 < 0) d0 += PI2;
72 float d1 = d0 + M_PI;
73 if (d1 > PI2) d1 -= PI2;
74
75 //...In region ?...
76 if ((x0 < d0) && (d0 < x1)) return true;
77 if ((x0 < d1) && (d1 < x1)) return true;
78
79 return false;
80 }
81
82 bool
84 float yReal,
85 float x0,
86 float x1) const
87 {
88 return diverge(xReal, yReal, x0, x1);
89 }
90
91 bool
93 float yReal,
94 float x0,
95 float x1) const
96 {
97 return diverge(xReal, yReal, x0, x1);
98 }
99
101} // namespace Belle2
An abstract class to represent a Hough transformation.
A class to represent a point in 2D.
Definition: Point2D.h:27
double atan(double a)
atan for double
Definition: beamHelpers.h:34
virtual TRGPoint2D circleCenter(const TRGPoint2D &) const
returns Point2D(phi, r) of a circle in real plane.
virtual TRGPoint2D convert(const TRGPoint2D &) const override
converts Point2D(phi, r) in real plane into Point2D(phi, r) in Hough plane.
virtual bool diverge(float xReal, float yReal, float x0, float x1) const override
returns true if Y diverges in given region.
virtual float y(float xReal, float yReal, float x) const override
returns Y coordinate in a Hough parameter plane.
virtual bool positiveDiverge(float xReal, float yReal, float x0, float x1) const override
returns true if Y diverges in given region.
TRGCDCHoughTransformationCircle(const std::string &name)
Contructor.
virtual bool negativeDiverge(float xReal, float yReal, float x0, float x1) const override
returns true if Y diverges in given region.
Abstract base class for different kinds of events.