File indexing completed on 2023-10-25 10:03:05
0001 #include "RecoTracker/TkSeedGenerator/interface/FastLine.h"
0002
0003 FastLine::FastLine(const GlobalPoint& outerHit, const GlobalPoint& innerHit)
0004 : theOuterHit(outerHit), theInnerHit(innerHit), theRho(0.), theN1(0.), theN2(0.), theC(0.), theValid(true) {
0005 createLineParameters();
0006 }
0007
0008 FastLine::FastLine(const GlobalPoint& outerHit, const GlobalPoint& innerHit, double rho)
0009 : theOuterHit(outerHit), theInnerHit(innerHit), theRho(rho), theN1(0.), theN2(0.), theC(0.), theValid(true) {
0010 createLineParameters();
0011 }
0012
0013 void FastLine::createLineParameters() {
0014 double rphi0 = 0., rphi1 = 0.;
0015
0016 if (theRho > 0.) {
0017 if (fabs(1. - theInnerHit.perp2() / (2. * theRho * theRho)) > 1.)
0018 rphi0 = theInnerHit.perp();
0019 else
0020 rphi0 = theRho * acos(1. - theInnerHit.perp2() / (2. * theRho * theRho));
0021 if (fabs(1. - theOuterHit.perp2() / (2. * theRho * theRho)) > 1.)
0022 rphi1 = theOuterHit.perp();
0023 else
0024 rphi1 = theRho * acos(1. - theOuterHit.perp2() / (2. * theRho * theRho));
0025 } else {
0026 rphi0 = theInnerHit.perp();
0027 rphi1 = theOuterHit.perp();
0028 }
0029
0030 double n1 = theInnerHit.z() - theOuterHit.z();
0031 double n2 = -(rphi0 - rphi1);
0032 double norm = sqrt(n1 * n1 + n2 * n2);
0033 theN1 = n1 / norm;
0034 theN2 = n2 / norm;
0035 theC = -(theN1 * rphi0 + theN2 * theInnerHit.z());
0036
0037 }