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  //
21  // Components of direction vector (with correct normalisation)
22  //
23  double px = direction.x();
24  double py = direction.y();
25  double pz = direction.z();
26  double pt2 = px*px+py*py;
27  double p2 = pt2+pz*pz;
28  double pI = 1./sqrt(p2);
29  double ptI = 1./sqrt(pt2);
30  theCosPhi0 = px*ptI;
31  theSinPhi0 = py*ptI;
32  theCosTheta = pz*pI;
33  theSinTheta = pt2*ptI*pI;
34 
35 }
36 
37 //
38 // Position on helix after a step of path length s.
39 //
42  //
43  // Calculate delta phi (if not already available)
44  //
45  if ( s!=theCachedS ) {
46  theCachedS = s;
49  }
50  //
51  // Calculate with appropriate formulation of full helix formula or with
52  // 2nd order approximation.
53  //
54  if ( std::abs(theCachedDPhi)>1.e-4 ) {
55  // "standard" helix formula
56  double o = 1./theRho;
58  theY0+( theCosPhi0*(1.-theCachedCDPhi)+theSinPhi0*theCachedSDPhi)*o,
60  }
61  else {
62  // 2nd order
63  double st = theCachedS*theSinTheta;
64  return PositionType(theX0+(theCosPhi0-st*0.5*theRho*theSinPhi0)*st,
65  theY0+(theSinPhi0+st*0.5*theRho*theCosPhi0)*st,
66  theZ0+st*theCosTheta/theSinTheta);
67  }
68 }
69 //
70 // Direction vector on helix after a step of path length s.
71 //
74  //
75  // Calculate delta phi (if not already available)
76  //
77  if ( s!=theCachedS ) {
78  theCachedS = s;
81  }
82 
83  if ( fabs(theCachedDPhi)>1.e-4 ) {
84  // full helix formula
86  theSinPhi0*theCachedCDPhi+theCosPhi0*theCachedSDPhi,
88  }
89  else {
90  // 2nd order
91  double dph = theCachedS*theRho*theSinTheta;
92  return DirectionType(theCosPhi0-(theSinPhi0+0.5*theCosPhi0*dph)*dph,
93  theSinPhi0+(theCosPhi0-0.5*theSinPhi0*dph)*dph,
94  theCosTheta/theSinTheta);
95  }
96 }
97 
T y() const
Cartesian y coordinate.
T x() const
Cartesian x coordinate.
virtual PositionType position(double s) const
PropagationDirection
float float float z
T x() const
Cartesian x coordinate.
static const float theNumericalPrecision
T curvature(T InversePt, const edm::EventSetup &iSetup)
T z() const
Cartesian z coordinate.
T sqrt(T t)
Definition: SSEVec.h:18
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
double p2[4]
Definition: TauolaWrapper.h:90
Basic3DVector< double > PositionTypeDouble
virtual DirectionType direction(double s) 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
Definition: invegas.h:5