CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
FastCircle.cc
Go to the documentation of this file.
2 
4  const GlobalPoint& middleHit,
5  const GlobalPoint& aVertex) :
6  theOuterPoint(outerHit),
7  theInnerPoint(middleHit),
8  theVertexPoint(aVertex),
9  theNorm(100.),
10  theX0(0.),
11  theY0(0.),
12  theRho(0.),
13  theN1(0.),
14  theN2(0.),
15  theC(0.),
16  theValid(true) {
17 
19 
20 }
21 
23  const GlobalPoint& middleHit,
24  const GlobalPoint& aVertex,
25  double norm) :
26  theOuterPoint(outerHit),
27  theInnerPoint(middleHit),
28  theVertexPoint(aVertex),
29  theNorm(norm),
30  theX0(0.),
31  theY0(0.),
32  theRho(0.),
33  theN1(0.),
34  theN2(0.),
35  theC(0.),
36  theValid(true) {
37 
39 
40 }
41 
43 
47 
49 
50  n[0] = x[1]*(y[2] - z[2]) + y[1]*(z[2] - x[2]) + z[1]*(x[2] - y[2]);
51  n[1] = -(x[0]*(y[2] - z[2]) + y[0]*(z[2] - x[2]) + z[0]*(x[2] - y[2]));
52  n[2] = x[0]*(y[1] - z[1]) + y[0]*(z[1] - x[1]) + z[0]*(x[1] - y[1]);
53 
54  double mag2 = n[0]*n[0]+n[1]*n[1]+n[2]*n[2];
55  if (mag2 < 1.e-20) {
56  theValid = false;
57  return;
58  }
59  n.Unit(); // reduce n to a unit vector
60  double c = -(n[0]*x[0] + n[1]*x[1] + n[2]*x[2]);
61  // c = -(n[0]*y[0] + n[1]*y[1] + n[2]*y[2]);
62  // c = -(n[0]*z[0] + n[1]*z[1] + n[2]*z[2]);
63 
64  theN1 = n[0];
65  theN2 = n[1];
66  theC = c;
67 
68  if(fabs(c + n[2]) < 1.e-5) {
69  // numeric limit
70  // circle is more a straight line...
71  theValid = false;
72  return;
73  }
74 
75  double x0 = -n[0] / (2.*(c + n[2]));
76  double y0 = -n[1] / (2.*(c + n[2]));
77  double rho =
78  sqrt((n[0]*n[0] + n[1]*n[1] - 4.*c*(c + n[2]))) / fabs(2.*(c + n[2]));
79 
80  theX0 = theNorm*x0;
81  theY0 = theNorm*y0;
82  theRho = theNorm*rho;
83 
84 }
85 
87 
88  AlgebraicVector3 riemannPoint;
89 
90  double R = aPoint.perp();
91  R /= theNorm;
92  double phi = 0.;
93  if(R > 0.) phi = aPoint.phi();
94 
95  double fact = R/(1+R*R); // let's factorize the common factor out
96  riemannPoint[0] = fact*cos(phi);
97  riemannPoint[1] = fact*sin(phi);
98  riemannPoint[2] = fact*R;
99 
100  return riemannPoint;
101 }
double theNorm
Definition: FastCircle.h:71
T perp() const
Definition: PV3DBase.h:71
double x0() const
Definition: FastCircle.h:50
void createCircleParameters()
Definition: FastCircle.cc:42
FastCircle(const GlobalPoint &outerHit, const GlobalPoint &middleHit, const GlobalPoint &aVertex)
Definition: FastCircle.cc:3
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Geom::Phi< T > phi() const
Definition: PV3DBase.h:68
double rho() const
Definition: FastCircle.h:54
double double double z
bool theValid
Definition: FastCircle.h:81
AlgebraicVector3 transform(const GlobalPoint &aPoint) const
Definition: FastCircle.cc:86
double theY0
Definition: FastCircle.h:74
double theC
Definition: FastCircle.h:79
double c() const
Definition: FastCircle.h:64
T sqrt(T t)
Definition: SSEVec.h:46
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
T mag2() const
The vector magnitude squared. Equivalent to vec.dot(vec)
double theN2
Definition: FastCircle.h:78
ROOT::Math::SVector< double, 3 > AlgebraicVector3
double theX0
Definition: FastCircle.h:73
GlobalPoint theInnerPoint
Definition: FastCircle.h:69
double theRho
Definition: FastCircle.h:75
GlobalPoint theOuterPoint
Definition: FastCircle.h:68
double y0() const
Definition: FastCircle.h:52
GlobalPoint theVertexPoint
Definition: FastCircle.h:70
double theN1
Definition: FastCircle.h:77
Definition: DDAxes.h:10
Definition: DDAxes.h:10