CMS 3D CMS Logo

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 isLine () 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
 
bool theIsLine
 
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() [1/2]

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

Definition at line 4 of file FastCircle.cc.

References createCircleParameters().

5  : theOuterPoint(outerHit),
6  theInnerPoint(middleHit),
7  theVertexPoint(aVertex),
8  theNorm(128.),
9  theX0(0.),
10  theY0(0.),
11  theRho(0.),
12  theN1(0.),
13  theN2(0.),
14  theC(0.),
15  theValid(true),
16  theIsLine(false) {
18 }
double theNorm
Definition: FastCircle.h:69
void createCircleParameters()
Definition: FastCircle.cc:55
bool theValid
Definition: FastCircle.h:79
double theY0
Definition: FastCircle.h:72
double theC
Definition: FastCircle.h:77
double theN2
Definition: FastCircle.h:76
double theX0
Definition: FastCircle.h:71
GlobalPoint theInnerPoint
Definition: FastCircle.h:67
double theRho
Definition: FastCircle.h:73
GlobalPoint theOuterPoint
Definition: FastCircle.h:66
GlobalPoint theVertexPoint
Definition: FastCircle.h:68
double theN1
Definition: FastCircle.h:75
bool theIsLine
Definition: FastCircle.h:80

◆ FastCircle() [2/2]

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

Definition at line 20 of file FastCircle.cc.

References createCircleParameters().

24  : theOuterPoint(outerHit),
25  theInnerPoint(middleHit),
26  theVertexPoint(aVertex),
27  theNorm(norm),
28  theX0(0.),
29  theY0(0.),
30  theRho(0.),
31  theN1(0.),
32  theN2(0.),
33  theC(0.),
34  theValid(true),
35  theIsLine(false) {
37 }
double theNorm
Definition: FastCircle.h:69
void createCircleParameters()
Definition: FastCircle.cc:55
bool theValid
Definition: FastCircle.h:79
double theY0
Definition: FastCircle.h:72
double theC
Definition: FastCircle.h:77
double theN2
Definition: FastCircle.h:76
double theX0
Definition: FastCircle.h:71
GlobalPoint theInnerPoint
Definition: FastCircle.h:67
double theRho
Definition: FastCircle.h:73
GlobalPoint theOuterPoint
Definition: FastCircle.h:66
GlobalPoint theVertexPoint
Definition: FastCircle.h:68
double theN1
Definition: FastCircle.h:75
bool theIsLine
Definition: FastCircle.h:80

◆ ~FastCircle()

FastCircle::~FastCircle ( )
inline

Definition at line 39 of file FastCircle.h.

39 {}

Member Function Documentation

◆ c()

double FastCircle::c ( ) const
inline

Definition at line 59 of file FastCircle.h.

References theC.

Referenced by createCircleParameters().

59 { return theC; }
double theC
Definition: FastCircle.h:77

◆ createCircleParameters()

void FastCircle::createCircleParameters ( )
private

Definition at line 55 of file FastCircle.cc.

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

Referenced by FastCircle().

55  {
59 
61 
62  n[0] = x[1] * (y[2] - z[2]) + y[1] * (z[2] - x[2]) + z[1] * (x[2] - y[2]);
63  n[1] = -(x[0] * (y[2] - z[2]) + y[0] * (z[2] - x[2]) + z[0] * (x[2] - y[2]));
64  n[2] = x[0] * (y[1] - z[1]) + y[0] * (z[1] - x[1]) + z[0] * (x[1] - y[1]);
65 
66  double mag2 = n[0] * n[0] + n[1] * n[1] + n[2] * n[2];
67  if (mag2 < 1.e-20) {
68  theValid = false;
69  return;
70  }
71  n.Unit(); // reduce n to a unit vector
72  double c = -(n[0] * x[0] + n[1] * x[1] + n[2] * x[2]);
73  // c = -(n[0]*y[0] + n[1]*y[1] + n[2]*y[2]);
74  // c = -(n[0]*z[0] + n[1]*z[1] + n[2]*z[2]);
75 
76  theN1 = n[0];
77  theN2 = n[1];
78  theC = c;
79 
80  if (fabs(c + n[2]) < 1.e-5) {
81  // numeric limit
82  // circle is more a straight line...
83  theValid = false;
84  theIsLine = true;
85  return;
86  }
87 
88  double x0 = -n[0] / (2. * (c + n[2]));
89  double y0 = -n[1] / (2. * (c + n[2]));
90  double rho = sqrt((n[0] * n[0] + n[1] * n[1] - 4. * c * (c + n[2]))) / fabs(2. * (c + n[2]));
91 
92  theX0 = theNorm * x0;
93  theY0 = theNorm * y0;
94  theRho = theNorm * rho;
95 }
double theNorm
Definition: FastCircle.h:69
double c() const
Definition: FastCircle.h:59
bool theValid
Definition: FastCircle.h:79
double theY0
Definition: FastCircle.h:72
double theC
Definition: FastCircle.h:77
T sqrt(T t)
Definition: SSEVec.h:23
double theN2
Definition: FastCircle.h:76
double theX0
Definition: FastCircle.h:71
GlobalPoint theInnerPoint
Definition: FastCircle.h:67
double theRho
Definition: FastCircle.h:73
GlobalPoint theOuterPoint
Definition: FastCircle.h:66
T mag2() const
The vector magnitude squared. Equivalent to vec.dot(vec)
double y0() const
Definition: FastCircle.h:45
GlobalPoint theVertexPoint
Definition: FastCircle.h:68
double rho() const
Definition: FastCircle.h:47
ROOT::Math::SVector< double, 3 > AlgebraicVector3
double theN1
Definition: FastCircle.h:75
bool theIsLine
Definition: FastCircle.h:80
double x0() const
Definition: FastCircle.h:43
unsigned transform(const HcalDetId &id, unsigned transformCode)

◆ innerPoint()

GlobalPoint const& FastCircle::innerPoint ( ) const
inline

Definition at line 62 of file FastCircle.h.

References theInnerPoint.

Referenced by FastHelix::middleHit().

62 { return theInnerPoint; }
GlobalPoint theInnerPoint
Definition: FastCircle.h:67

◆ isLine()

bool FastCircle::isLine ( ) const
inline

Definition at line 51 of file FastCircle.h.

References theIsLine.

Referenced by PixelClusterShapeSeedComparitor::compatible(), and StripSubClusterShapeSeedFilter::compatible().

51 { return theIsLine; }
bool theIsLine
Definition: FastCircle.h:80

◆ isValid()

bool FastCircle::isValid ( void  ) const
inline

◆ n1()

double FastCircle::n1 ( ) const
inline

Definition at line 55 of file FastCircle.h.

References theN1.

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

55 { return theN1; }
double theN1
Definition: FastCircle.h:75

◆ n2()

double FastCircle::n2 ( ) const
inline

Definition at line 57 of file FastCircle.h.

References theN2.

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

57 { return theN2; }
double theN2
Definition: FastCircle.h:76

◆ outerPoint()

GlobalPoint const& FastCircle::outerPoint ( ) const
inline

Definition at line 61 of file FastCircle.h.

References theOuterPoint.

Referenced by FastHelix::outerHit().

61 { return theOuterPoint; }
GlobalPoint theOuterPoint
Definition: FastCircle.h:66

◆ rho()

double FastCircle::rho ( ) const
inline

◆ vertexPoint()

GlobalPoint const& FastCircle::vertexPoint ( ) const
inline

Definition at line 63 of file FastCircle.h.

References theVertexPoint.

Referenced by FastHelix::vertex().

63 { return theVertexPoint; }
GlobalPoint theVertexPoint
Definition: FastCircle.h:68

◆ x0()

double FastCircle::x0 ( ) const
inline

◆ y0()

double FastCircle::y0 ( ) const
inline

Member Data Documentation

◆ theC

double FastCircle::theC
private

Definition at line 77 of file FastCircle.h.

Referenced by c(), and createCircleParameters().

◆ theInnerPoint

GlobalPoint FastCircle::theInnerPoint
private

Definition at line 67 of file FastCircle.h.

Referenced by createCircleParameters(), and innerPoint().

◆ theIsLine

bool FastCircle::theIsLine
private

Definition at line 80 of file FastCircle.h.

Referenced by createCircleParameters(), and isLine().

◆ theN1

double FastCircle::theN1
private

Definition at line 75 of file FastCircle.h.

Referenced by createCircleParameters(), and n1().

◆ theN2

double FastCircle::theN2
private

Definition at line 76 of file FastCircle.h.

Referenced by createCircleParameters(), and n2().

◆ theNorm

double FastCircle::theNorm
private

Definition at line 69 of file FastCircle.h.

Referenced by createCircleParameters().

◆ theOuterPoint

GlobalPoint FastCircle::theOuterPoint
private

Definition at line 66 of file FastCircle.h.

Referenced by createCircleParameters(), and outerPoint().

◆ theRho

double FastCircle::theRho
private

Definition at line 73 of file FastCircle.h.

Referenced by createCircleParameters(), and rho().

◆ theValid

bool FastCircle::theValid
private

Definition at line 79 of file FastCircle.h.

Referenced by createCircleParameters(), and isValid().

◆ theVertexPoint

GlobalPoint FastCircle::theVertexPoint
private

Definition at line 68 of file FastCircle.h.

Referenced by createCircleParameters(), and vertexPoint().

◆ theX0

double FastCircle::theX0
private

Definition at line 71 of file FastCircle.h.

Referenced by createCircleParameters(), and x0().

◆ theY0

double FastCircle::theY0
private

Definition at line 72 of file FastCircle.h.

Referenced by createCircleParameters(), and y0().