CMS 3D CMS Logo

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

StraightLinePlaneCrossing Class Reference

#include <StraightLinePlaneCrossing.h>

List of all members.

Public Types

typedef Basic3DVector< float > DirectionType
typedef Basic3DVector< float > PositionType

Public Member Functions

std::pair< bool, double > pathLength (const Plane &plane) const
std::pair< bool, PositionTypeposition (const Plane &plane) const
PositionType position (double s) const
 StraightLinePlaneCrossing (const PositionType &point, const DirectionType &momentum, const PropagationDirection propDir=alongMomentum)
 ~StraightLinePlaneCrossing ()

Private Types

typedef Basic3DVector< float > DirectionTypeDouble
typedef Basic3DVector< float > PositionTypeDouble

Private Attributes

const PositionTypeDouble theP0
const PropagationDirection thePropDir
const PositionTypeDouble theX0

Detailed Description

Calculates intersections of a line with a plane.

Definition at line 14 of file StraightLinePlaneCrossing.h.


Member Typedef Documentation

Definition at line 22 of file StraightLinePlaneCrossing.h.

Definition at line 53 of file StraightLinePlaneCrossing.h.

The types for position and direction are frame-neutral (not global, local, etc.) so this interface can be used in any frame. Of course, the helix and the plane must be defined in the same frame, which is also the frame of the result.

Definition at line 21 of file StraightLinePlaneCrossing.h.

Definition at line 52 of file StraightLinePlaneCrossing.h.


Constructor & Destructor Documentation

StraightLinePlaneCrossing::StraightLinePlaneCrossing ( const PositionType point,
const DirectionType momentum,
const PropagationDirection  propDir = alongMomentum 
)

Constructor using point and momentum.

Definition at line 8 of file StraightLinePlaneCrossing.cc.

                                                                                         :
  theX0(point),
  theP0(momentum.unit()),
  thePropDir(propDir) {
//   cout << "StraightLinePlaneCrossing: x0 = " << point
//        << ", p0 = " << momentum << endl;
}
StraightLinePlaneCrossing::~StraightLinePlaneCrossing ( ) [inline]

Definition at line 31 of file StraightLinePlaneCrossing.h.

{}

Member Function Documentation

std::pair< bool, double > StraightLinePlaneCrossing::pathLength ( const Plane plane) const

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

Definition at line 21 of file StraightLinePlaneCrossing.cc.

References alongMomentum, Basic3DVector< T >::dot(), Plane::normalVector(), oppositeToMomentum, GloballyPositioned< T >::position(), theP0, thePropDir, and theX0.

Referenced by NavPlane::distanceAlongLine(), HelixBarrelPlaneCrossingByCircle::pathLength(), position(), RKPropagatorInS::propagateParametersOnPlane(), and AnalyticalPropagator::propagateWithLineCrossing().

                                                               {
  //
  // Protect against p_normal=0 and calculate path length
  //
  PositionTypeDouble planePosition(plane.position());
  DirectionTypeDouble planeNormal(plane.normalVector());
//   double pz = plane.localZ(GlobalVector(theP0));
  double pz = planeNormal.dot(theP0);
//   cout << "pz = " << pz << endl;
  if ( fabs(pz)<FLT_MIN )  return std::pair<bool,double>(false,0);
//   double dS = -plane.localZ(GlobalPoint(theX0))/pz;
  double dS = -planeNormal.dot(theX0-planePosition)/pz;
//   if ( thePropDir==alongMomentum )  cout << "alongMomentum ";
//   else if ( thePropDir==oppositeToMomentum )  cout << "oppositeToMomentum ";
//   else  cout << "anyDirection ";
//   cout << dS << endl;
  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);
}
std::pair< bool, StraightLinePlaneCrossing::PositionType > StraightLinePlaneCrossing::position ( const Plane plane) const

Simplified interface in case the path length is not needed

Definition at line 46 of file StraightLinePlaneCrossing.cc.

References pathLength(), and position().

{
    std::pair<bool,double> crossed = pathLength(plane);
    if (crossed.first) return std::pair<bool,PositionType>(true, position(crossed.second));
    else return std::pair<bool,PositionType>(false, PositionType());
}
PositionType StraightLinePlaneCrossing::position ( double  s) const [inline]

Position at pathlength s from the starting point.

Definition at line 40 of file StraightLinePlaneCrossing.h.

References theP0, and theX0.

Referenced by position(), CtfSpecialSeedGenerator::postCheck(), RKPropagatorInS::propagateParametersOnPlane(), and AnalyticalPropagator::propagateWithLineCrossing().


Member Data Documentation

Definition at line 56 of file StraightLinePlaneCrossing.h.

Referenced by pathLength(), and position().

Definition at line 57 of file StraightLinePlaneCrossing.h.

Referenced by pathLength().

Definition at line 55 of file StraightLinePlaneCrossing.h.

Referenced by pathLength(), and position().