CMS 3D CMS Logo

FastCircle.cc
Go to the documentation of this file.
3 
4 FastCircle::FastCircle(const GlobalPoint& outerHit, const GlobalPoint& middleHit, const GlobalPoint& aVertex)
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 }
19 
21  const GlobalPoint& middleHit,
22  const GlobalPoint& aVertex,
23  double norm)
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 }
38 
39 namespace {
40  inline AlgebraicVector3 transform(const GlobalPoint& aPoint, float norm) {
41  AlgebraicVector3 riemannPoint;
42 
43  auto p = aPoint.basicVector() / norm;
44  float R2 = p.perp2();
45  float fact = 1.f / (1.f + R2); // let's factorize the common factor out
46  riemannPoint[0] = fact * p.x();
47  riemannPoint[1] = fact * p.y();
48  riemannPoint[2] = fact * R2;
49 
50  return riemannPoint;
51  }
52 
53 } // namespace
54 
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 }
FastCircle::theInnerPoint
GlobalPoint theInnerPoint
Definition: FastCircle.h:67
DDAxes::y
AlgebraicVector3
ROOT::Math::SVector< double, 3 > AlgebraicVector3
Definition: AlgebraicROOTObjects.h:12
FastCircle::theN2
double theN2
Definition: FastCircle.h:76
FastCircle::theRho
double theRho
Definition: FastCircle.h:73
funct::false
false
Definition: Factorize.h:29
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
FastCircle::theX0
double theX0
Definition: FastCircle.h:71
FastCircle::theOuterPoint
GlobalPoint theOuterPoint
Definition: FastCircle.h:66
FastCircle::y0
double y0() const
Definition: FastCircle.h:45
DDAxes::x
FastCircle::theVertexPoint
GlobalPoint theVertexPoint
Definition: FastCircle.h:68
FastCircle::rho
double rho() const
Definition: FastCircle.h:47
FastCircle::theIsLine
bool theIsLine
Definition: FastCircle.h:80
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
DDAxes::z
FastCircle::theN1
double theN1
Definition: FastCircle.h:75
HcalDetIdTransform::transform
unsigned transform(const HcalDetId &id, unsigned transformCode)
Definition: HcalDetIdTransform.cc:7
Point3DBase< float, GlobalTag >
FastCircle::x0
double x0() const
Definition: FastCircle.h:43
funct::true
true
Definition: Factorize.h:173
AlCaHLTBitMon_ParallelJobs.p
def p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
FastCircle::theNorm
double theNorm
Definition: FastCircle.h:69
fact
const double fact
Definition: NuclearInteractionFTFSimulator.cc:74
mag2
T mag2() const
The vector magnitude squared. Equivalent to vec.dot(vec)
Definition: Basic3DVectorLD.h:124
FastCircle::c
double c() const
Definition: FastCircle.h:59
FastCircle::createCircleParameters
void createCircleParameters()
Definition: FastCircle.cc:55
PV3DBase::basicVector
const BasicVectorType & basicVector() const
Definition: PV3DBase.h:53
FastCircle::FastCircle
FastCircle(const GlobalPoint &outerHit, const GlobalPoint &middleHit, const GlobalPoint &aVertex)
Definition: FastCircle.cc:4
FastCircle::theValid
bool theValid
Definition: FastCircle.h:79
FastCircle::theC
double theC
Definition: FastCircle.h:77
AlgebraicROOTObjects.h
FastCircle.h
FastCircle::theY0
double theY0
Definition: FastCircle.h:72
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37