CMS 3D CMS Logo

FastCircle.cc
Go to the documentation of this file.
3 
5  const GlobalPoint& middleHit,
6  const GlobalPoint& aVertex) :
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  theIsLine(false) {
19 
21 
22 }
23 
25  const GlobalPoint& middleHit,
26  const GlobalPoint& aVertex,
27  double norm) :
28  theOuterPoint(outerHit),
29  theInnerPoint(middleHit),
30  theVertexPoint(aVertex),
31  theNorm(norm),
32  theX0(0.),
33  theY0(0.),
34  theRho(0.),
35  theN1(0.),
36  theN2(0.),
37  theC(0.),
38  theValid(true),
39  theIsLine(false) {
40 
42 
43 }
44 
45 namespace {
46  inline
47  AlgebraicVector3 transform(const GlobalPoint& aPoint, float norm) {
48 
49  AlgebraicVector3 riemannPoint;
50 
51  auto p = aPoint.basicVector()/norm;
52  float R2 = p.perp2();
53  float fact = 1.f/(1.f+R2); // let's factorize the common factor out
54  riemannPoint[0] = fact*p.x();
55  riemannPoint[1] = fact*p.y();
56  riemannPoint[2] = fact*R2;
57 
58  return riemannPoint;
59  }
60 
61 
62 }
63 
65 
69 
71 
72  n[0] = x[1]*(y[2] - z[2]) + y[1]*(z[2] - x[2]) + z[1]*(x[2] - y[2]);
73  n[1] = -(x[0]*(y[2] - z[2]) + y[0]*(z[2] - x[2]) + z[0]*(x[2] - y[2]));
74  n[2] = x[0]*(y[1] - z[1]) + y[0]*(z[1] - x[1]) + z[0]*(x[1] - y[1]);
75 
76  double mag2 = n[0]*n[0]+n[1]*n[1]+n[2]*n[2];
77  if (mag2 < 1.e-20) {
78  theValid = false;
79  return;
80  }
81  n.Unit(); // reduce n to a unit vector
82  double c = -(n[0]*x[0] + n[1]*x[1] + n[2]*x[2]);
83  // c = -(n[0]*y[0] + n[1]*y[1] + n[2]*y[2]);
84  // c = -(n[0]*z[0] + n[1]*z[1] + n[2]*z[2]);
85 
86  theN1 = n[0];
87  theN2 = n[1];
88  theC = c;
89 
90  if(fabs(c + n[2]) < 1.e-5) {
91  // numeric limit
92  // circle is more a straight line...
93  theValid = false;
94  theIsLine = true;
95  return;
96  }
97 
98  double x0 = -n[0] / (2.*(c + n[2]));
99  double y0 = -n[1] / (2.*(c + n[2]));
100  double rho =
101  sqrt((n[0]*n[0] + n[1]*n[1] - 4.*c*(c + n[2]))) / fabs(2.*(c + n[2]));
102 
103  theX0 = theNorm*x0;
104  theY0 = theNorm*y0;
105  theRho = theNorm*rho;
106 
107 }
108 
double theNorm
Definition: FastCircle.h:78
double x0() const
Definition: FastCircle.h:50
void createCircleParameters()
Definition: FastCircle.cc:64
FastCircle(const GlobalPoint &outerHit, const GlobalPoint &middleHit, const GlobalPoint &aVertex)
Definition: FastCircle.cc:4
double rho() const
Definition: FastCircle.h:54
bool theValid
Definition: FastCircle.h:88
double theY0
Definition: FastCircle.h:81
double theC
Definition: FastCircle.h:86
double c() const
Definition: FastCircle.h:66
T sqrt(T t)
Definition: SSEVec.h:18
T mag2() const
The vector magnitude squared. Equivalent to vec.dot(vec)
double theN2
Definition: FastCircle.h:85
ROOT::Math::SVector< double, 3 > AlgebraicVector3
double theX0
Definition: FastCircle.h:80
GlobalPoint theInnerPoint
Definition: FastCircle.h:76
double theRho
Definition: FastCircle.h:82
GlobalPoint theOuterPoint
Definition: FastCircle.h:75
const double fact
double y0() const
Definition: FastCircle.h:52
GlobalPoint theVertexPoint
Definition: FastCircle.h:77
double theN1
Definition: FastCircle.h:84
const BasicVectorType & basicVector() const
Definition: PV3DBase.h:56
bool theIsLine
Definition: FastCircle.h:89