#include <FastCircle.h>
Public Member Functions | |
double | c () const |
FastCircle (const GlobalPoint &outerHit, const GlobalPoint &middleHit, const GlobalPoint &aVertex) | |
FastCircle (const GlobalPoint &outerHit, const GlobalPoint &middleHit, const GlobalPoint &aVertex, double norm) | |
bool | isValid () const |
double | n1 () const |
double | n2 () const |
double | rho () const |
double | x0 () const |
double | y0 () const |
~FastCircle () | |
Private Member Functions | |
void | createCircleParameters () |
AlgebraicVector3 | transform (const GlobalPoint &aPoint) const |
Private Attributes | |
double | theC |
GlobalPoint | theInnerPoint |
double | theN1 |
double | theN2 |
double | theNorm |
GlobalPoint | theOuterPoint |
double | theRho |
bool | theValid |
GlobalPoint | theVertexPoint |
double | theX0 |
double | theY0 |
Calculate circle parameters (x0, y0, rho) for a circle: (x-x0)^2 + (y-y0)^2 = rho^2 in Global Cartesian Coordinates in the (x,y) plane for a given set of GlobalPoints. It is done by mapping the points onto the Riemann Sphere and fit a plane to the transformed coordinates of the points. The method is described in:
A.Strandlie, J.Wroldsen, R.Fruehwirth, B.Lillekjendlie: Particle tracks fitted on the Riemann sphere Computer Physics Communications 131 (2000) 95-108, 18 January 2000
Implementation: Matthias Winkler, 14 February 2001
This implementation is a specialized version of the general Circle class for three points.
Update 14.02.2001: For 3 Points (2 RecHits + Vertex) the plain parameters n1*x + n2*y + n3*z + c = 0 are analytically calculable. Update 14.02.2001: In the case that a circle fit is not possible (points are along a straight line) the parameters of the straight line can be used: c + n1*x + n2*y = 0
Definition at line 33 of file FastCircle.h.
FastCircle::FastCircle | ( | const GlobalPoint & | outerHit, |
const GlobalPoint & | middleHit, | ||
const GlobalPoint & | aVertex | ||
) |
Definition at line 3 of file FastCircle.cc.
References createCircleParameters().
: theOuterPoint(outerHit), theInnerPoint(middleHit), theVertexPoint(aVertex), theNorm(100.), theX0(0.), theY0(0.), theRho(0.), theN1(0.), theN2(0.), theC(0.), theValid(true) { createCircleParameters(); }
FastCircle::FastCircle | ( | const GlobalPoint & | outerHit, |
const GlobalPoint & | middleHit, | ||
const GlobalPoint & | aVertex, | ||
double | norm | ||
) |
Definition at line 22 of file FastCircle.cc.
References createCircleParameters().
: theOuterPoint(outerHit), theInnerPoint(middleHit), theVertexPoint(aVertex), theNorm(norm), theX0(0.), theY0(0.), theRho(0.), theN1(0.), theN2(0.), theC(0.), theValid(true) { createCircleParameters(); }
FastCircle::~FastCircle | ( | ) | [inline] |
Definition at line 46 of file FastCircle.h.
{}
double FastCircle::c | ( | ) | const [inline] |
Definition at line 64 of file FastCircle.h.
References theC.
Referenced by createCircleParameters().
{return theC;}
void FastCircle::createCircleParameters | ( | ) | [private] |
Definition at line 42 of file FastCircle.cc.
References c(), mag2(), n, rho(), mathSSE::sqrt(), theC, theInnerPoint, theN1, theN2, theNorm, theOuterPoint, theRho, theValid, theVertexPoint, theX0, theY0, transform(), x, x0(), detailsBasic3DVector::y, y0(), and z.
Referenced by FastCircle().
{ AlgebraicVector3 x = transform(theOuterPoint); AlgebraicVector3 y = transform(theInnerPoint); AlgebraicVector3 z = transform(theVertexPoint); AlgebraicVector3 n; n[0] = x[1]*(y[2] - z[2]) + y[1]*(z[2] - x[2]) + z[1]*(x[2] - y[2]); n[1] = -(x[0]*(y[2] - z[2]) + y[0]*(z[2] - x[2]) + z[0]*(x[2] - y[2])); n[2] = x[0]*(y[1] - z[1]) + y[0]*(z[1] - x[1]) + z[0]*(x[1] - y[1]); double mag2 = n[0]*n[0]+n[1]*n[1]+n[2]*n[2]; if (mag2 < 1.e-20) { theValid = false; return; } n.Unit(); // reduce n to a unit vector double c = -(n[0]*x[0] + n[1]*x[1] + n[2]*x[2]); // c = -(n[0]*y[0] + n[1]*y[1] + n[2]*y[2]); // c = -(n[0]*z[0] + n[1]*z[1] + n[2]*z[2]); theN1 = n[0]; theN2 = n[1]; theC = c; if(fabs(c + n[2]) < 1.e-5) { // numeric limit // circle is more a straight line... theValid = false; return; } double x0 = -n[0] / (2.*(c + n[2])); double y0 = -n[1] / (2.*(c + n[2])); double rho = sqrt((n[0]*n[0] + n[1]*n[1] - 4.*c*(c + n[2]))) / fabs(2.*(c + n[2])); theX0 = theNorm*x0; theY0 = theNorm*y0; theRho = theNorm*rho; }
bool FastCircle::isValid | ( | void | ) | const [inline] |
Definition at line 56 of file FastCircle.h.
References theValid.
Referenced by FastHelix::isValid(), ConversionFastHelix::makeHelix(), RoadSearchCircleSeed::RoadSearchCircleSeed(), and TangentCircle::TangentCircle().
{return theValid;}
double FastCircle::n1 | ( | ) | const [inline] |
Definition at line 60 of file FastCircle.h.
References theN1.
Referenced by FastHelix::helixStateAtVertex(), ConversionFastHelix::straightLineStateAtVertex(), and FastHelix::straightLineStateAtVertex().
{return theN1;}
double FastCircle::n2 | ( | ) | const [inline] |
Definition at line 62 of file FastCircle.h.
References theN2.
Referenced by FastHelix::helixStateAtVertex(), ConversionFastHelix::straightLineStateAtVertex(), and FastHelix::straightLineStateAtVertex().
{return theN2;}
double FastCircle::rho | ( | ) | const [inline] |
Definition at line 54 of file FastCircle.h.
References theRho.
Referenced by createCircleParameters(), SimpleCosmicBONSeeder::goodTriplet(), ConversionFastHelix::helixStateAtVertex(), FastHelix::helixStateAtVertex(), SimpleCosmicBONSeeder::pqFromHelixFit(), GenericTripletGenerator::qualityFilter(), SeedFromGenericPairOrTriplet::qualityFilter(), RoadSearchCircleSeed::RoadSearchCircleSeed(), and TangentCircle::TangentCircle().
{return theRho;}
AlgebraicVector3 FastCircle::transform | ( | const GlobalPoint & | aPoint | ) | const [private] |
Definition at line 86 of file FastCircle.cc.
References funct::cos(), PV3DBase< T, PVType, FrameType >::perp(), PV3DBase< T, PVType, FrameType >::phi(), phi, dttmaxenums::R, funct::sin(), and theNorm.
Referenced by createCircleParameters().
{ AlgebraicVector3 riemannPoint; double R = aPoint.perp(); R /= theNorm; double phi = 0.; if(R > 0.) phi = aPoint.phi(); double fact = R/(1+R*R); // let's factorize the common factor out riemannPoint[0] = fact*cos(phi); riemannPoint[1] = fact*sin(phi); riemannPoint[2] = fact*R; return riemannPoint; }
double FastCircle::x0 | ( | ) | const [inline] |
Definition at line 50 of file FastCircle.h.
References theX0.
Referenced by createCircleParameters(), ConversionFastHelix::helixStateAtVertex(), FastHelix::helixStateAtVertex(), SimpleCosmicBONSeeder::pqFromHelixFit(), RoadSearchCircleSeed::RoadSearchCircleSeed(), and TangentCircle::TangentCircle().
{return theX0;}
double FastCircle::y0 | ( | ) | const [inline] |
Definition at line 52 of file FastCircle.h.
References theY0.
Referenced by createCircleParameters(), ConversionFastHelix::helixStateAtVertex(), FastHelix::helixStateAtVertex(), SimpleCosmicBONSeeder::pqFromHelixFit(), RoadSearchCircleSeed::RoadSearchCircleSeed(), and TangentCircle::TangentCircle().
{return theY0;}
double FastCircle::theC [private] |
Definition at line 79 of file FastCircle.h.
Referenced by c(), and createCircleParameters().
GlobalPoint FastCircle::theInnerPoint [private] |
Definition at line 69 of file FastCircle.h.
Referenced by createCircleParameters().
double FastCircle::theN1 [private] |
Definition at line 77 of file FastCircle.h.
Referenced by createCircleParameters(), and n1().
double FastCircle::theN2 [private] |
Definition at line 78 of file FastCircle.h.
Referenced by createCircleParameters(), and n2().
double FastCircle::theNorm [private] |
Definition at line 71 of file FastCircle.h.
Referenced by createCircleParameters(), and transform().
GlobalPoint FastCircle::theOuterPoint [private] |
Definition at line 68 of file FastCircle.h.
Referenced by createCircleParameters().
double FastCircle::theRho [private] |
Definition at line 75 of file FastCircle.h.
Referenced by createCircleParameters(), and rho().
bool FastCircle::theValid [private] |
Definition at line 81 of file FastCircle.h.
Referenced by createCircleParameters(), and isValid().
GlobalPoint FastCircle::theVertexPoint [private] |
Definition at line 70 of file FastCircle.h.
Referenced by createCircleParameters().
double FastCircle::theX0 [private] |
Definition at line 73 of file FastCircle.h.
Referenced by createCircleParameters(), and x0().
double FastCircle::theY0 [private] |
Definition at line 74 of file FastCircle.h.
Referenced by createCircleParameters(), and y0().