CMS 3D CMS Logo

HelixForwardPlaneCrossing.cc
Go to the documentation of this file.
2 
3 #include <cmath>
4 #include <vdt/vdtMath.h>
5 
7  const DirectionType& direction,
8  const float curvature,
9  const PropagationDirection propDir)
10  : theX0(point.x()),
11  theY0(point.y()),
12  theZ0(point.z()),
13  theRho(curvature),
14  thePropDir(propDir),
15  theCachedS(0),
16  theCachedDPhi(0.),
17  theCachedSDPhi(0.),
18  theCachedCDPhi(1.) {
19  //
20  // Components of direction vector (with correct normalisation)
21  //
22  double px = direction.x();
23  double py = direction.y();
24  double pz = direction.z();
25  double pt2 = px * px + py * py;
26  double p2 = pt2 + pz * pz;
27  double pI = 1. / sqrt(p2);
28  double ptI = 1. / sqrt(pt2);
29  theCosPhi0 = px * ptI;
30  theSinPhi0 = py * ptI;
31  theCosTheta = pz * pI;
32  theSinTheta = pt2 * ptI * pI;
33 }
34 
35 //
36 // Position on helix after a step of path length s.
37 //
39  //
40  // Calculate delta phi (if not already available)
41  //
42  if (s != theCachedS) {
43  theCachedS = s;
46  }
47  //
48  // Calculate with appropriate formulation of full helix formula or with
49  // 2nd order approximation.
50  //
51  if (std::abs(theCachedDPhi) > 1.e-4) {
52  // "standard" helix formula
53  double o = 1. / theRho;
57  } else {
58  // 2nd order
59  double st = theCachedS * theSinTheta;
60  return PositionType(theX0 + (theCosPhi0 - st * 0.5 * theRho * theSinPhi0) * st,
61  theY0 + (theSinPhi0 + st * 0.5 * theRho * theCosPhi0) * st,
62  theZ0 + st * theCosTheta / theSinTheta);
63  }
64 }
65 //
66 // Direction vector on helix after a step of path length s.
67 //
69  //
70  // Calculate delta phi (if not already available)
71  //
72  if (s != theCachedS) {
73  theCachedS = s;
76  }
77 
78  if (fabs(theCachedDPhi) > 1.e-4) {
79  // full helix formula
83  } else {
84  // 2nd order
85  double dph = theCachedS * theRho * theSinTheta;
86  return DirectionType(theCosPhi0 - (theSinPhi0 + 0.5 * theCosPhi0 * dph) * dph,
87  theSinPhi0 + (theCosPhi0 - 0.5 * theSinPhi0 * dph) * dph,
89  }
90 }
91 
T x() const
Cartesian x coordinate.
PropagationDirection
T y() const
Cartesian y coordinate.
T curvature(T InversePt, const MagneticField &field)
static const float theNumericalPrecision
DirectionType direction(double s) const override
T sqrt(T t)
Definition: SSEVec.h:23
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
HelixForwardPlaneCrossing(const PositionType &point, const DirectionType &direction, const float curvature, const PropagationDirection propDir=alongMomentum)
Basic3DVector< float > PositionType
the helix is passed to the constructor and does not appear in the interface
Basic3DVector< float > DirectionType
Basic3DVector< double > PositionTypeDouble
T z() const
Cartesian z coordinate.
float x
PositionType position(double s) const override
void fast_sincos(const MPF &a, MPF &s, MPF &c)
*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
Definition: invegas.h:5