5 #include <vdt/vdtMath.h>
9 const DirectionType& direction,
25 double px = direction.x();
26 double py = direction.y();
27 double pz = direction.z();
28 double pt2 = px*px+py*py;
29 double p2 = pt2+pz*pz;
30 double pI = 1./
sqrt(p2);
31 double ptI = 1./
sqrt(pt2);
35 theSinTheta = pt2*ptI*pI;
41 std::pair<bool,double>
42 HelixForwardPlaneCrossing::pathLength(
const Plane& plane) {
46 if (
std::abs(theCosTheta/theSinTheta)<FLT_MIN )
return std::pair<bool,double>(
false,0);
48 double dS = (plane.
position().
z()-theZ0) / theCosTheta;
55 return std::pair<bool,double>(
true,dS);
65 if ( s!=theCachedS ) {
67 theCachedDPhi = theCachedS*theRho*theSinTheta;
68 vdt::fast_sincos(theCachedDPhi,theCachedSDPhi,theCachedCDPhi);
78 return PositionTypeDouble(theX0+(-theSinPhi0*(1.-theCachedCDPhi)+theCosPhi0*theCachedSDPhi)*o,
79 theY0+( theCosPhi0*(1.-theCachedCDPhi)+theSinPhi0*theCachedSDPhi)*o,
80 theZ0+theCachedS*theCosTheta);
84 double st = theCachedS*theSinTheta;
85 return PositionType(theX0+(theCosPhi0-st*0.5*theRho*theSinPhi0)*st,
86 theY0+(theSinPhi0+st*0.5*theRho*theCosPhi0)*st,
87 theZ0+st*theCosTheta/theSinTheta);
94 HelixForwardPlaneCrossing::direction (
double s)
const {
98 if ( s!=theCachedS ) {
100 theCachedDPhi = theCachedS*theRho*theSinTheta;
101 theCachedSDPhi =
sin(theCachedDPhi);
102 theCachedCDPhi =
cos(theCachedDPhi);
105 if ( fabs(theCachedDPhi)>1.
e-4 ) {
107 return DirectionType(theCosPhi0*theCachedCDPhi-theSinPhi0*theCachedSDPhi,
108 theSinPhi0*theCachedCDPhi+theCosPhi0*theCachedSDPhi,
109 theCosTheta/theSinTheta);
113 double dph = theCachedS*theRho*theSinTheta;
114 return DirectionType(theCosPhi0-(theSinPhi0+0.5*theCosPhi0*dph)*dph,
115 theSinPhi0+(theCosPhi0-0.5*theSinPhi0*dph)*dph,
116 theCosTheta/theSinTheta);
120 const float HelixForwardPlaneCrossing::theNumericalPrecision = 5.e-7;
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)
Abs< T >::type abs(const T &t)
const PositionType & position() const
*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