CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
FastCircle Class Reference

#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)
 
GlobalPoint const & innerPoint () const
 
bool isValid () const
 
double n1 () const
 
double n2 () const
 
GlobalPoint const & outerPoint () const
 
double rho () const
 
GlobalPoint const & vertexPoint () const
 
double x0 () const
 
double y0 () const
 
 ~FastCircle ()
 

Private Member Functions

void createCircleParameters ()
 

Private Attributes

double theC
 
GlobalPoint theInnerPoint
 
double theN1
 
double theN2
 
double theNorm
 
GlobalPoint theOuterPoint
 
double theRho
 
bool theValid
 
GlobalPoint theVertexPoint
 
double theX0
 
double theY0
 

Detailed Description

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.

Constructor & Destructor Documentation

FastCircle::FastCircle ( const GlobalPoint outerHit,
const GlobalPoint middleHit,
const GlobalPoint aVertex 
)

Definition at line 4 of file FastCircle.cc.

References createCircleParameters().

6  :
7  theOuterPoint(outerHit),
8  theInnerPoint(middleHit),
9  theVertexPoint(aVertex),
10  theNorm(128.),
11  theX0(0.),
12  theY0(0.),
13  theRho(0.),
14  theN1(0.),
15  theN2(0.),
16  theC(0.),
17  theValid(true) {
18 
20 
21 }
double theNorm
Definition: FastCircle.h:76
void createCircleParameters()
Definition: FastCircle.cc:62
bool theValid
Definition: FastCircle.h:86
double theY0
Definition: FastCircle.h:79
double theC
Definition: FastCircle.h:84
double theN2
Definition: FastCircle.h:83
double theX0
Definition: FastCircle.h:78
GlobalPoint theInnerPoint
Definition: FastCircle.h:74
double theRho
Definition: FastCircle.h:80
GlobalPoint theOuterPoint
Definition: FastCircle.h:73
GlobalPoint theVertexPoint
Definition: FastCircle.h:75
double theN1
Definition: FastCircle.h:82
FastCircle::FastCircle ( const GlobalPoint outerHit,
const GlobalPoint middleHit,
const GlobalPoint aVertex,
double  norm 
)

Definition at line 23 of file FastCircle.cc.

References createCircleParameters().

26  :
27  theOuterPoint(outerHit),
28  theInnerPoint(middleHit),
29  theVertexPoint(aVertex),
30  theNorm(norm),
31  theX0(0.),
32  theY0(0.),
33  theRho(0.),
34  theN1(0.),
35  theN2(0.),
36  theC(0.),
37  theValid(true) {
38 
40 
41 }
double theNorm
Definition: FastCircle.h:76
void createCircleParameters()
Definition: FastCircle.cc:62
bool theValid
Definition: FastCircle.h:86
double theY0
Definition: FastCircle.h:79
double theC
Definition: FastCircle.h:84
double theN2
Definition: FastCircle.h:83
double theX0
Definition: FastCircle.h:78
GlobalPoint theInnerPoint
Definition: FastCircle.h:74
double theRho
Definition: FastCircle.h:80
GlobalPoint theOuterPoint
Definition: FastCircle.h:73
GlobalPoint theVertexPoint
Definition: FastCircle.h:75
double theN1
Definition: FastCircle.h:82
FastCircle::~FastCircle ( )
inline

Definition at line 46 of file FastCircle.h.

46 {}

Member Function Documentation

double FastCircle::c ( ) const
inline

Definition at line 64 of file FastCircle.h.

References theC.

Referenced by createCircleParameters().

64 {return theC;}
double theC
Definition: FastCircle.h:84
void FastCircle::createCircleParameters ( )
private

Definition at line 62 of file FastCircle.cc.

References c(), alignCSCRings::e, mag2(), n, rho(), mathSSE::sqrt(), theC, theInnerPoint, theN1, theN2, theNorm, theOuterPoint, theRho, theValid, theVertexPoint, theX0, theY0, create_public_lumi_plots::transform, x, x0(), detailsBasic3DVector::y, y0(), and detailsBasic3DVector::z.

Referenced by FastCircle().

62  {
63 
67 
69 
70  n[0] = x[1]*(y[2] - z[2]) + y[1]*(z[2] - x[2]) + z[1]*(x[2] - y[2]);
71  n[1] = -(x[0]*(y[2] - z[2]) + y[0]*(z[2] - x[2]) + z[0]*(x[2] - y[2]));
72  n[2] = x[0]*(y[1] - z[1]) + y[0]*(z[1] - x[1]) + z[0]*(x[1] - y[1]);
73 
74  double mag2 = n[0]*n[0]+n[1]*n[1]+n[2]*n[2];
75  if (mag2 < 1.e-20) {
76  theValid = false;
77  return;
78  }
79  n.Unit(); // reduce n to a unit vector
80  double c = -(n[0]*x[0] + n[1]*x[1] + n[2]*x[2]);
81  // c = -(n[0]*y[0] + n[1]*y[1] + n[2]*y[2]);
82  // c = -(n[0]*z[0] + n[1]*z[1] + n[2]*z[2]);
83 
84  theN1 = n[0];
85  theN2 = n[1];
86  theC = c;
87 
88  if(fabs(c + n[2]) < 1.e-5) {
89  // numeric limit
90  // circle is more a straight line...
91  theValid = false;
92  return;
93  }
94 
95  double x0 = -n[0] / (2.*(c + n[2]));
96  double y0 = -n[1] / (2.*(c + n[2]));
97  double rho =
98  sqrt((n[0]*n[0] + n[1]*n[1] - 4.*c*(c + n[2]))) / fabs(2.*(c + n[2]));
99 
100  theX0 = theNorm*x0;
101  theY0 = theNorm*y0;
102  theRho = theNorm*rho;
103 
104 }
double theNorm
Definition: FastCircle.h:76
double x0() const
Definition: FastCircle.h:50
double rho() const
Definition: FastCircle.h:54
float float float z
bool theValid
Definition: FastCircle.h:86
double theY0
Definition: FastCircle.h:79
double theC
Definition: FastCircle.h:84
double c() const
Definition: FastCircle.h:64
T sqrt(T t)
Definition: SSEVec.h:48
T mag2() const
The vector magnitude squared. Equivalent to vec.dot(vec)
double theN2
Definition: FastCircle.h:83
ROOT::Math::SVector< double, 3 > AlgebraicVector3
double theX0
Definition: FastCircle.h:78
GlobalPoint theInnerPoint
Definition: FastCircle.h:74
double theRho
Definition: FastCircle.h:80
GlobalPoint theOuterPoint
Definition: FastCircle.h:73
double y0() const
Definition: FastCircle.h:52
GlobalPoint theVertexPoint
Definition: FastCircle.h:75
double theN1
Definition: FastCircle.h:82
Definition: DDAxes.h:10
GlobalPoint const& FastCircle::innerPoint ( ) const
inline

Definition at line 67 of file FastCircle.h.

References theInnerPoint.

Referenced by FastHelix::middleHit().

67 { return theInnerPoint;}
GlobalPoint theInnerPoint
Definition: FastCircle.h:74
bool FastCircle::isValid ( void  ) const
inline

Definition at line 56 of file FastCircle.h.

References theValid.

Referenced by FastHelix::isValid(), ConversionFastHelix::makeHelix(), and TangentCircle::TangentCircle().

56 {return theValid;}
bool theValid
Definition: FastCircle.h:86
double FastCircle::n1 ( ) const
inline

Definition at line 60 of file FastCircle.h.

References theN1.

Referenced by ConversionFastHelix::straightLineStateAtVertex(), and FastHelix::straightLineStateAtVertex().

60 {return theN1;}
double theN1
Definition: FastCircle.h:82
double FastCircle::n2 ( ) const
inline

Definition at line 62 of file FastCircle.h.

References theN2.

Referenced by ConversionFastHelix::straightLineStateAtVertex(), and FastHelix::straightLineStateAtVertex().

62 {return theN2;}
double theN2
Definition: FastCircle.h:83
GlobalPoint const& FastCircle::outerPoint ( ) const
inline

Definition at line 66 of file FastCircle.h.

References theOuterPoint.

Referenced by FastHelix::outerHit().

66 { return theOuterPoint;}
GlobalPoint theOuterPoint
Definition: FastCircle.h:73
double FastCircle::rho ( ) const
inline
GlobalPoint const& FastCircle::vertexPoint ( ) const
inline

Definition at line 68 of file FastCircle.h.

References theVertexPoint.

Referenced by FastHelix::vertex().

68 { return theVertexPoint;}
GlobalPoint theVertexPoint
Definition: FastCircle.h:75
double FastCircle::x0 ( ) const
inline
double FastCircle::y0 ( ) const
inline

Member Data Documentation

double FastCircle::theC
private

Definition at line 84 of file FastCircle.h.

Referenced by c(), and createCircleParameters().

GlobalPoint FastCircle::theInnerPoint
private

Definition at line 74 of file FastCircle.h.

Referenced by createCircleParameters(), and innerPoint().

double FastCircle::theN1
private

Definition at line 82 of file FastCircle.h.

Referenced by createCircleParameters(), and n1().

double FastCircle::theN2
private

Definition at line 83 of file FastCircle.h.

Referenced by createCircleParameters(), and n2().

double FastCircle::theNorm
private

Definition at line 76 of file FastCircle.h.

Referenced by createCircleParameters().

GlobalPoint FastCircle::theOuterPoint
private

Definition at line 73 of file FastCircle.h.

Referenced by createCircleParameters(), and outerPoint().

double FastCircle::theRho
private

Definition at line 80 of file FastCircle.h.

Referenced by createCircleParameters(), and rho().

bool FastCircle::theValid
private

Definition at line 86 of file FastCircle.h.

Referenced by createCircleParameters(), and isValid().

GlobalPoint FastCircle::theVertexPoint
private

Definition at line 75 of file FastCircle.h.

Referenced by createCircleParameters(), and vertexPoint().

double FastCircle::theX0
private

Definition at line 78 of file FastCircle.h.

Referenced by createCircleParameters(), and x0().

double FastCircle::theY0
private

Definition at line 79 of file FastCircle.h.

Referenced by createCircleParameters(), and y0().