4 IterativeHelixExtrapolatorToLine::IterativeHelixExtrapolatorToLine
6 const DirectionType& direction,
13 theQuadraticSolutionFromStart(point,direction,curvature,propDir),
23 double px = direction.x();
24 double py = direction.y();
25 double pz = direction.z();
26 double pt = px*px+py*py;
27 double p =
sqrt(pt+pz*pz);
40 std::pair<bool,double> IterativeHelixExtrapolatorToLine::pathLength (
const GlobalPoint& point)
const {
41 return genericPathLength(point);
48 std::pair<bool,double> IterativeHelixExtrapolatorToLine::pathLength (
const Line&
line)
const {
49 return genericPathLength(line);
57 template <
class T> std::pair<bool,double>
58 IterativeHelixExtrapolatorToLine::genericPathLength (
const T&
object)
const {
62 const int maxIterations(100);
67 PositionTypeDouble xnew(theX0,theY0,theZ0);
68 DirectionTypeDouble pnew(theCosPhi0,theSinPhi0,theCosTheta/theSinTheta);
77 double maxDeltaS2 = 2*1.e-4/theSinTheta/theSinTheta/fabs(theRho);
85 return std::pair<bool,double>(
false,0);
91 std::pair<bool,double> deltaS1;
94 deltaS1 = theQuadraticSolutionFromStart.pathLength(
object);
97 HelixExtrapolatorToLine2Order linearCrossing(xnew.x(),xnew.y(),xnew.z(),
99 theCosTheta,theSinTheta,
101 deltaS1 = linearCrossing.pathLength(
object);
103 if ( !deltaS1.first )
return deltaS1;
107 dSTotal += deltaS1.second;
113 if ( newDir!=propDir )
return std::pair<bool,double>(
false,0);
118 if ( deltaS1.second*deltaS1.second<maxDeltaS2 )
break;
122 xnew = positionInDouble(dSTotal);
123 pnew = directionInDouble(dSTotal);
128 return std::pair<bool,double>(
true,dSTotal);
144 IterativeHelixExtrapolatorToLine::positionInDouble (
double s)
const {
148 if ( s!=theCachedS ) {
150 theCachedDPhi = theCachedS*theRho*theSinTheta;
151 theCachedSDPhi =
sin(theCachedDPhi);
152 theCachedCDPhi =
cos(theCachedDPhi);
159 if ( fabs(theCachedDPhi)>1.
e-4 ) {
161 return PositionTypeDouble(theX0+(-theSinPhi0*(1.-theCachedCDPhi)+theCosPhi0*theCachedSDPhi)/theRho,
162 theY0+(theCosPhi0*(1.-theCachedCDPhi)+theSinPhi0*theCachedSDPhi)/theRho,
163 theZ0+theCachedS*theCosTheta);
175 return theQuadraticSolutionFromStart.positionInDouble(theCachedS);
183 IterativeHelixExtrapolatorToLine::direction (
double s)
const {
187 return DirectionType(directionInDouble(s));
194 IterativeHelixExtrapolatorToLine::directionInDouble (
double s)
const {
198 if ( s!=theCachedS ) {
200 theCachedDPhi = theCachedS*theRho*theSinTheta;
201 theCachedSDPhi =
sin(theCachedDPhi);
202 theCachedCDPhi =
cos(theCachedDPhi);
205 if ( fabs(theCachedDPhi)>1.
e-4 ) {
207 return DirectionTypeDouble(theCosPhi0*theCachedCDPhi-theSinPhi0*theCachedSDPhi,
208 theSinPhi0*theCachedCDPhi+theCosPhi0*theCachedSDPhi,
209 theCosTheta/theSinTheta);
213 return theQuadraticSolutionFromStart.directionInDouble(theCachedS);
Sin< T >::type sin(const T &t)
static int position[TOTALCHAMBERS][3]
Point3DBase< Scalar, GlobalTag > PositionType
T curvature(T InversePt, const edm::EventSetup &iSetup)
Cos< T >::type cos(const T &t)
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point