CMS 3D CMS Logo

HelixForwardPlaneCrossing Class Reference

Calculates intersections of a helix with planes perpendicular to the z-axis. More...

#include <TrackingTools/GeomPropagators/interface/HelixForwardPlaneCrossing.h>

Inheritance diagram for HelixForwardPlaneCrossing:

HelixPlaneCrossing

List of all members.

Public Member Functions

virtual DirectionType direction (double s) const
 Direction at pathlength s from the starting point.
 HelixForwardPlaneCrossing (const PositionType &point, const DirectionType &direction, const float curvature, const PropagationDirection propDir=alongMomentum)
 Constructor using point, direction and (transverse!) curvature.
virtual std::pair< bool, double > pathLength (const Plane &plane)
 Propagation status (true if valid) and (signed) path length along the helix from the starting point to the plane.
virtual PositionType position (double s) const
 Position at pathlength s from the starting point.
virtual ~HelixForwardPlaneCrossing ()

Private Types

typedef Basic3DVector< double > DirectionTypeDouble
typedef Basic3DVector< double > PositionTypeDouble

Private Attributes

double theCachedCDPhi
double theCachedDPhi
double theCachedS
double theCachedSDPhi
double theCosPhi0
double theCosTheta
const PropagationDirection thePropDir
const double theRho
double theSinPhi0
double theSinTheta
const double theX0
const double theY0
const double theZ0

Static Private Attributes

static const float theNumericalPrecision = 5.e-7


Detailed Description

Calculates intersections of a helix with planes perpendicular to the z-axis.

Definition at line 10 of file HelixForwardPlaneCrossing.h.


Member Typedef Documentation

typedef Basic3DVector<double> HelixForwardPlaneCrossing::DirectionTypeDouble [private]

Definition at line 39 of file HelixForwardPlaneCrossing.h.

typedef Basic3DVector<double> HelixForwardPlaneCrossing::PositionTypeDouble [private]

Definition at line 38 of file HelixForwardPlaneCrossing.h.


Constructor & Destructor Documentation

HelixForwardPlaneCrossing::HelixForwardPlaneCrossing ( const PositionType point,
const DirectionType direction,
const float  curvature,
const PropagationDirection  propDir = alongMomentum 
)

Constructor using point, direction and (transverse!) curvature.

Definition at line 7 of file HelixForwardPlaneCrossing.cc.

References p, funct::sqrt(), theCosPhi0, theCosTheta, theSinPhi0, theSinTheta, Basic3DVector< T >::x(), Basic3DVector< T >::y(), and Basic3DVector< T >::z().

00010                                                                                          :
00011   theX0(point.x()),
00012   theY0(point.y()),
00013   theZ0(point.z()),
00014   theRho(curvature),
00015   thePropDir(propDir),
00016   theCachedS(0),
00017   theCachedDPhi(0.),
00018   theCachedSDPhi(0.),
00019   theCachedCDPhi(1.)
00020 {
00021   //
00022   // Components of direction vector (with correct normalisation)
00023   //
00024   double px = direction.x();
00025   double py = direction.y();
00026   double pz = direction.z();
00027   double pt = px*px+py*py;
00028   double p = sqrt(pt+pz*pz);
00029   pt = sqrt(pt);
00030   theCosPhi0 = px/pt;
00031   theSinPhi0 = py/pt;
00032   theCosTheta = pz/p;
00033   theSinTheta = pt/p;
00034 }
//

virtual HelixForwardPlaneCrossing::~HelixForwardPlaneCrossing (  )  [inline, virtual]

Definition at line 19 of file HelixForwardPlaneCrossing.h.

00019 {}


Member Function Documentation

HelixPlaneCrossing::DirectionType HelixForwardPlaneCrossing::direction ( double  s  )  const [virtual]

Direction at pathlength s from the starting point.

Implements HelixPlaneCrossing.

Definition at line 88 of file HelixForwardPlaneCrossing.cc.

References funct::cos(), e, funct::sin(), theCachedCDPhi, theCachedDPhi, theCachedS, theCachedSDPhi, theCosPhi0, theCosTheta, theRho, theSinPhi0, and theSinTheta.

00088                                                     {
00089   //
00090   // Calculate delta phi (if not already available)
00091   //
00092   if ( s!=theCachedS ) {
00093     theCachedS = s;
00094     theCachedDPhi = theCachedS*theRho*theSinTheta;
00095     theCachedSDPhi = sin(theCachedDPhi);
00096     theCachedCDPhi = cos(theCachedDPhi);
00097   }
00098 
00099   if ( fabs(theCachedDPhi)>1.e-4 ) {
00100     // full helix formula
00101     return DirectionType(theCosPhi0*theCachedCDPhi-theSinPhi0*theCachedSDPhi,
00102                          theSinPhi0*theCachedCDPhi+theCosPhi0*theCachedSDPhi,
00103                          theCosTheta/theSinTheta);
00104   }
00105   else {
00106     // 2nd order
00107     double dph = theCachedS*theRho*theSinTheta;
00108     return DirectionType(theCosPhi0-(theSinPhi0+0.5*theCosPhi0*dph)*dph,
00109                          theSinPhi0+(theCosPhi0-0.5*theSinPhi0*dph)*dph,
00110                          theCosTheta/theSinTheta);
00111   }
00112 }

std::pair< bool, double > HelixForwardPlaneCrossing::pathLength ( const Plane plane  )  [virtual]

Propagation status (true if valid) and (signed) path length along the helix from the starting point to the plane.

Implements HelixPlaneCrossing.

Definition at line 39 of file HelixForwardPlaneCrossing.cc.

References alongMomentum, oppositeToMomentum, GloballyPositioned< T >::position(), theCosTheta, thePropDir, theSinTheta, theZ0, and Basic3DVector< T >::z().

00039                                                         {
00040   //
00041   // Protect against p_z=0 and calculate path length
00042   //
00043   if ( fabs(theCosTheta/theSinTheta)<FLT_MIN )  return std::pair<bool,double>(false,0);
00044   double dS = (plane.position().z()-theZ0) / theCosTheta;
00045   if ( (thePropDir==alongMomentum && dS<0.) ||
00046        (thePropDir==oppositeToMomentum && dS>0.) )  return std::pair<bool,double>(false,0);
00047   //
00048   // Return result
00049   //
00050   return std::pair<bool,double>(true,dS);
00051 }

HelixPlaneCrossing::PositionType HelixForwardPlaneCrossing::position ( double  s  )  const [virtual]

Position at pathlength s from the starting point.

Implements HelixPlaneCrossing.

Definition at line 56 of file HelixForwardPlaneCrossing.cc.

References funct::cos(), e, funct::sin(), st, theCachedCDPhi, theCachedDPhi, theCachedS, theCachedSDPhi, theCosPhi0, theCosTheta, theRho, theSinPhi0, theSinTheta, theX0, theY0, and theZ0.

00056                                                    {
00057   //
00058   // Calculate delta phi (if not already available)
00059   //
00060   if ( s!=theCachedS ) {
00061     theCachedS = s;
00062     theCachedDPhi = theCachedS*theRho*theSinTheta;
00063     theCachedSDPhi = sin(theCachedDPhi);
00064     theCachedCDPhi = cos(theCachedDPhi);
00065   }
00066   //
00067   // Calculate with appropriate formulation of full helix formula or with 
00068   //   2nd order approximation.
00069   //
00070   if ( fabs(theCachedDPhi)>1.e-4 ) {
00071     // "standard" helix formula
00072     return PositionType(theX0+(-theSinPhi0*(1.-theCachedCDPhi)+theCosPhi0*theCachedSDPhi)/theRho,
00073                         theY0+(theCosPhi0*(1.-theCachedCDPhi)+theSinPhi0*theCachedSDPhi)/theRho,
00074                         theZ0+theCachedS*theCosTheta);
00075   }
00076   else {
00077     // 2nd order
00078     double st = theCachedS*theSinTheta;
00079     return PositionType(theX0+(theCosPhi0-st*0.5*theRho*theSinPhi0)*st,
00080                         theY0+(theSinPhi0+st*0.5*theRho*theCosPhi0)*st,
00081                         theZ0+st*theCosTheta/theSinTheta);
00082   }
00083 }


Member Data Documentation

double HelixForwardPlaneCrossing::theCachedCDPhi [mutable, private]

Definition at line 51 of file HelixForwardPlaneCrossing.h.

Referenced by direction(), and position().

double HelixForwardPlaneCrossing::theCachedDPhi [mutable, private]

Definition at line 49 of file HelixForwardPlaneCrossing.h.

Referenced by direction(), and position().

double HelixForwardPlaneCrossing::theCachedS [mutable, private]

Definition at line 48 of file HelixForwardPlaneCrossing.h.

Referenced by direction(), and position().

double HelixForwardPlaneCrossing::theCachedSDPhi [mutable, private]

Definition at line 50 of file HelixForwardPlaneCrossing.h.

Referenced by direction(), and position().

double HelixForwardPlaneCrossing::theCosPhi0 [private]

Definition at line 42 of file HelixForwardPlaneCrossing.h.

Referenced by direction(), HelixForwardPlaneCrossing(), and position().

double HelixForwardPlaneCrossing::theCosTheta [private]

Definition at line 43 of file HelixForwardPlaneCrossing.h.

Referenced by direction(), HelixForwardPlaneCrossing(), pathLength(), and position().

const float HelixForwardPlaneCrossing::theNumericalPrecision = 5.e-7 [static, private]

Definition at line 53 of file HelixForwardPlaneCrossing.h.

const PropagationDirection HelixForwardPlaneCrossing::thePropDir [private]

Definition at line 46 of file HelixForwardPlaneCrossing.h.

Referenced by pathLength().

const double HelixForwardPlaneCrossing::theRho [private]

Definition at line 44 of file HelixForwardPlaneCrossing.h.

Referenced by direction(), and position().

double HelixForwardPlaneCrossing::theSinPhi0 [private]

Definition at line 42 of file HelixForwardPlaneCrossing.h.

Referenced by direction(), HelixForwardPlaneCrossing(), and position().

double HelixForwardPlaneCrossing::theSinTheta [private]

Definition at line 43 of file HelixForwardPlaneCrossing.h.

Referenced by direction(), HelixForwardPlaneCrossing(), pathLength(), and position().

const double HelixForwardPlaneCrossing::theX0 [private]

Definition at line 41 of file HelixForwardPlaneCrossing.h.

Referenced by position().

const double HelixForwardPlaneCrossing::theY0 [private]

Definition at line 41 of file HelixForwardPlaneCrossing.h.

Referenced by position().

const double HelixForwardPlaneCrossing::theZ0 [private]

Definition at line 41 of file HelixForwardPlaneCrossing.h.

Referenced by pathLength(), and position().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:24:10 2009 for CMSSW by  doxygen 1.5.4