CMS 3D CMS Logo

Public Member Functions | Private Types | Private Attributes | Static Private Attributes

HelixForwardPlaneCrossing Class Reference

#include <HelixForwardPlaneCrossing.h>

Inheritance diagram for HelixForwardPlaneCrossing:
HelixPlaneCrossing

List of all members.

Public Member Functions

virtual DirectionType direction (double s) const
 HelixForwardPlaneCrossing (const PositionType &point, const DirectionType &direction, const float curvature, const PropagationDirection propDir=alongMomentum)
virtual std::pair< bool, double > pathLength (const Plane &plane)
virtual PositionType position (double s) const
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

Definition at line 39 of file HelixForwardPlaneCrossing.h.

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 p2, mathSSE::sqrt(), theCosPhi0, theCosTheta, theSinPhi0, theSinTheta, Basic3DVector< T >::x(), Basic3DVector< T >::y(), and Basic3DVector< T >::z().

                                                                                         :
  theX0(point.x()),
  theY0(point.y()),
  theZ0(point.z()),
  theRho(curvature),
  thePropDir(propDir),
  theCachedS(0),
  theCachedDPhi(0.),
  theCachedSDPhi(0.),
  theCachedCDPhi(1.)
{
  //
  // Components of direction vector (with correct normalisation)
  //
  double px = direction.x();
  double py = direction.y();
  double pz = direction.z();
  double pt2 = px*px+py*py;
  double p2 = pt2+pz*pz;
  double pI = 1./sqrt(p2);
  double ptI = 1./sqrt(pt2);
  theCosPhi0 = px*ptI;
  theSinPhi0 = py*ptI;
  theCosTheta = pz*pI;
  theSinTheta = pt2*ptI*pI;

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

Definition at line 19 of file HelixForwardPlaneCrossing.h.

{}

Member Function Documentation

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

Direction at pathlength s from the starting point.

Implements HelixPlaneCrossing.

Definition at line 94 of file HelixForwardPlaneCrossing.cc.

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

                                                    {
  //
  // Calculate delta phi (if not already available)
  //
  if ( s!=theCachedS ) {
    theCachedS = s;
    theCachedDPhi = theCachedS*theRho*theSinTheta;
    theCachedSDPhi = sin(theCachedDPhi);
    theCachedCDPhi = cos(theCachedDPhi);
  }

  if ( fabs(theCachedDPhi)>1.e-4 ) {
    // full helix formula
    return DirectionType(theCosPhi0*theCachedCDPhi-theSinPhi0*theCachedSDPhi,
                         theSinPhi0*theCachedCDPhi+theCosPhi0*theCachedSDPhi,
                         theCosTheta/theSinTheta);
  }
  else {
    // 2nd order
    double dph = theCachedS*theRho*theSinTheta;
    return DirectionType(theCosPhi0-(theSinPhi0+0.5*theCosPhi0*dph)*dph,
                         theSinPhi0+(theCosPhi0-0.5*theSinPhi0*dph)*dph,
                         theCosTheta/theSinTheta);
  }
}
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 41 of file HelixForwardPlaneCrossing.cc.

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

                                                        {
  //
  // Protect against p_z=0 and calculate path length
  //
  if ( std::abs(theCosTheta/theSinTheta)<FLT_MIN )  return std::pair<bool,double>(false,0);

  double dS = (plane.position().z()-theZ0) / theCosTheta;

  if ( (thePropDir==alongMomentum && dS<0.) ||
       (thePropDir==oppositeToMomentum && dS>0.) )  return std::pair<bool,double>(false,0);
  //
  // Return result
  //
  return std::pair<bool,double>(true,dS);
}
HelixPlaneCrossing::PositionType HelixForwardPlaneCrossing::position ( double  s) const [virtual]

Position at pathlength s from the starting point.

Implements HelixPlaneCrossing.

Definition at line 60 of file HelixForwardPlaneCrossing.cc.

References abs, funct::cos(), alignCSCRings::e, python::connectstrParser::o, alignCSCRings::s, funct::sin(), theCachedCDPhi, theCachedDPhi, theCachedS, theCachedSDPhi, theCosPhi0, theCosTheta, theRho, theSinPhi0, theSinTheta, theX0, theY0, and theZ0.

                                                   {
  //
  // Calculate delta phi (if not already available)
  //
  if ( s!=theCachedS ) {
    theCachedS = s;
    theCachedDPhi = theCachedS*theRho*theSinTheta;
    theCachedSDPhi = sin(theCachedDPhi);
    theCachedCDPhi = cos(theCachedDPhi);
  }
  //
  // Calculate with appropriate formulation of full helix formula or with 
  //   2nd order approximation.
  //
  if ( std::abs(theCachedDPhi)>1.e-4 ) {
    // "standard" helix formula
    // "standard" helix formula
    double o = 1./theRho;
    return PositionTypeDouble(theX0+(-theSinPhi0*(1.-theCachedCDPhi)+theCosPhi0*theCachedSDPhi)*o,
                              theY0+( theCosPhi0*(1.-theCachedCDPhi)+theSinPhi0*theCachedSDPhi)*o,
                              theZ0+theCachedS*theCosTheta);
  }
  else {
    // 2nd order
    double st = theCachedS*theSinTheta;
    return PositionType(theX0+(theCosPhi0-st*0.5*theRho*theSinPhi0)*st,
                        theY0+(theSinPhi0+st*0.5*theRho*theCosPhi0)*st,
                        theZ0+st*theCosTheta/theSinTheta);
  }
}

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().

Definition at line 42 of file HelixForwardPlaneCrossing.h.

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

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

Definition at line 53 of file HelixForwardPlaneCrossing.h.

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().

Definition at line 42 of file HelixForwardPlaneCrossing.h.

Referenced by direction(), HelixForwardPlaneCrossing(), 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().