Main Page
Namespaces
Classes
Package Documentation
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Pages
src
RecoPixelVertexing
PixelTrackFitting
src
CircleFromThreePoints.cc
Go to the documentation of this file.
1
#include "
CircleFromThreePoints.h
"
2
3
CircleFromThreePoints::CircleFromThreePoints
(
const
GlobalPoint
&
inner
,
4
const
GlobalPoint
& mid,
5
const
GlobalPoint
&
outer
,
6
double
precision)
7
{
8
// move to frame where inner.x() == inner.y() == 0;
9
Vector2D
b
( mid.
x
()-inner.
x
(), mid.
y
()-inner.
y
());
10
Vector2D
c
( outer.
x
()-inner.
x
(), outer.
y
()-inner.
y
());
11
init
(
b
,
c
,
Vector2D
( inner.
x
(), inner.
y
()), precision);
12
}
13
14
void
CircleFromThreePoints::init
(
const
Vector2D
&
b
,
const
Vector2D
&
c
,
15
const
Vector2D
&
offset
,
double
precision)
16
{
17
double
b2 = b.
mag2
();
18
double
c2 = c.
mag2
();
19
20
double
oX(0), oY(0);
21
bool
solved =
false
;
22
if
(fabs(b.
x
()) > fabs(b.
y
())) {
// solve for y first
23
double
k
= c.
x
()/b.
x
();
24
double
div = 2*(k*b.
y
() - c.
y
());
25
if
(fabs(div) < precision)
theCurvature
= 0;
// if the 3 points lie on a line
26
else
{
27
oY = (k*b2 - c2) / div;
28
oX = b2/(2*b.
x
()) - b.
y
()/b.
x
() * oY;
29
solved =
true
;
30
}
31
}
32
else
{
// solve for x first
33
double
k
= c.
y
()/b.
y
();
34
double
div = 2*(k*b.
x
()-c.
x
());
35
if
(fabs(div) < precision)
theCurvature
= 0;
// if the 3 points lie on a line
36
else
{
37
oX = (k*b2 - c2) / div;
38
oY = b2/(2*b.
y
()) - b.
x
()/b.
y
() * oX;
39
solved =
true
;
40
}
41
}
42
if
(solved) {
43
theCurvature
= 1./
sqrt
(oX*oX + oY*oY);
44
double
xC = oX + offset.
x
();
45
double
yC = oY + offset.
y
();
46
theCenter
=
Vector2D
( xC, yC);
47
// thePhi = acos(xC/sqrt(xC*xC + yC*yC));
48
49
// if (xC<0.) thePhi = thePhi - PI;
50
// cout << setiosflags(ios::showpoint | ios::fixed);
51
//
52
// cout << "CircleFromThreePoints::init curv = " << theCurvature << endl;
53
// cout << "CircleFromThreePoints::init center prime = " << oX << " " << oY << endl;
54
// cout << "CircleFromThreePoints::init offset = " << offset.x() << " " << offset.y() << endl;
55
// cout << "CircleFromThreePoints::init center = " << theCenter.x()<< " " << theCenter.y() << endl;
56
//
57
// float d = sqrt(theCenter.x()*theCenter.x()+theCenter.y()*theCenter.y());
58
// cout << "CircleFromThreePoints::init dfloat = " << setw(10) << setprecision(5) << d << endl;
59
// cout << "CircleFromThreePoints::init radius = " << 1/theCurvature << endl;
60
}
61
}
62
Basic2DVector< float >
SurfaceOrientation::outer
Definition:
Surface.h:26
PV3DBase::y
T y() const
Definition:
PV3DBase.h:63
CircleFromThreePoints::theCurvature
float theCurvature
Definition:
CircleFromThreePoints.h:56
CircleFromThreePoints::CircleFromThreePoints
CircleFromThreePoints()
dummy
Definition:
CircleFromThreePoints.h:22
SurfaceOrientation::inner
Definition:
Surface.h:26
mathSSE::sqrt
T sqrt(T t)
Definition:
SSEVec.h:48
CircleFromThreePoints::theCenter
Vector2D theCenter
Definition:
CircleFromThreePoints.h:57
evf::evtn::offset
unsigned int offset(bool)
Definition:
GlobalEventNumber.cc:66
Basic2DVector::y
T y() const
Cartesian y coordinate.
Definition:
extBasic2DVector.h:67
gen::k
int k[5][pyjets_maxn]
Definition:
Cascade2Hadronizer.cc:79
CircleFromThreePoints::init
void init(const Vector2D &b, const Vector2D &c, const Vector2D &offset, double precision)
Definition:
CircleFromThreePoints.cc:14
CircleFromThreePoints.h
b
double b
Definition:
hdecay.h:120
trackerHits.c
tuple c
Definition:
trackerHits.py:26
Basic2DVector::mag2
T mag2() const
The vector magnitude squared. Equivalent to vec.dot(vec)
Definition:
extBasic2DVector.h:70
Point3DBase< float, GlobalTag >
CircleFromThreePoints::Vector2D
Basic2DVector< float > Vector2D
Definition:
CircleFromThreePoints.h:24
PV3DBase::x
T x() const
Definition:
PV3DBase.h:62
Basic2DVector::x
T x() const
Cartesian x coordinate.
Definition:
extBasic2DVector.h:64
Generated for CMSSW Reference Manual by
1.8.5