00001 #include "RecoTracker/TkSeedGenerator/interface/FastLine.h"
00002
00003 FastLine::FastLine(const GlobalPoint& outerHit,
00004 const GlobalPoint& innerHit) :
00005 theOuterHit(outerHit),
00006 theInnerHit(innerHit),
00007 theRho(0.),
00008 theN1(0.),
00009 theN2(0.),
00010 theC(0.),
00011 theValid(true) {
00012
00013 createLineParameters();
00014
00015 }
00016
00017 FastLine::FastLine(const GlobalPoint& outerHit,
00018 const GlobalPoint& innerHit,
00019 double rho) :
00020 theOuterHit(outerHit),
00021 theInnerHit(innerHit),
00022 theRho(rho),
00023 theN1(0.),
00024 theN2(0.),
00025 theC(0.),
00026 theValid(true) {
00027
00028 createLineParameters();
00029
00030 }
00031
00032 void FastLine::createLineParameters() {
00033
00034 double rphi0 = 0., rphi1 = 0.;
00035
00036 if(theRho > 0.) {
00037 if (fabs( 1. - theInnerHit.perp2()/(2.*theRho*theRho) ) > 1.) rphi0 = theInnerHit.perp();
00038 else rphi0 = theRho*acos(1. - theInnerHit.perp2()/(2.*theRho*theRho));
00039 if (fabs(1. - theOuterHit.perp2()/(2.*theRho*theRho) ) >1.) rphi1 = theOuterHit.perp();
00040 else rphi1 = theRho*acos(1. - theOuterHit.perp2()/(2.*theRho*theRho));
00041 } else {
00042 rphi0 = theInnerHit.perp();
00043 rphi1 = theOuterHit.perp();
00044 }
00045
00046 double n1 = theInnerHit.z() - theOuterHit.z();
00047 double n2 = -(rphi0 - rphi1);
00048 double norm = sqrt(n1*n1 + n2*n2);
00049 theN1 = n1/norm;
00050 theN2= n2/norm;
00051 theC = -(theN1*rphi0 + theN2*theInnerHit.z());
00052
00053
00054 }
00055
00056
00057
00058
00059
00060