CMS 3D CMS Logo

StraightLineBarrelCylinderCrossing Class Reference

Calculates the intersection of a straight line with a barrel cylinder. More...

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

List of all members.

Public Member Functions

std::pair< bool, double > pathLength (const Cylinder &cyl) const
 Propagation status (true if valid) and (signed) path length along the line from the starting point to the cylinder.
GlobalPoint position (const double s) const
 Returns the position along the line that corresponds to path length "s" from the starting point.
 StraightLineBarrelCylinderCrossing (const GlobalPoint &startingPos, const GlobalVector &startingDir, const PropagationDirection propDir)
 Constructor uses global frame (barrel cylinders are by definition in global co-ordinates).

Private Types

typedef GlobalVector DirectionType
typedef Basic2DVector< float > DirectionType2D
typedef GlobalPoint PositionType
typedef Basic2DVector< float > PositionType2D

Private Member Functions

std::pair< bool, double > chooseSolution (const double s1, const double s2) const
 Chooses the right solution w.r.t. the propagation direction.

Private Attributes

const DirectionType theP0
const PropagationDirection thePropDir
const PositionType theX0


Detailed Description

Calculates the intersection of a straight line with a barrel cylinder.

Definition at line 17 of file StraightLineBarrelCylinderCrossing.h.


Member Typedef Documentation

typedef GlobalVector StraightLineBarrelCylinderCrossing::DirectionType [private]

Definition at line 48 of file StraightLineBarrelCylinderCrossing.h.

typedef Basic2DVector<float> StraightLineBarrelCylinderCrossing::DirectionType2D [private]

Definition at line 50 of file StraightLineBarrelCylinderCrossing.h.

typedef GlobalPoint StraightLineBarrelCylinderCrossing::PositionType [private]

Definition at line 47 of file StraightLineBarrelCylinderCrossing.h.

typedef Basic2DVector<float> StraightLineBarrelCylinderCrossing::PositionType2D [private]

Definition at line 49 of file StraightLineBarrelCylinderCrossing.h.


Constructor & Destructor Documentation

StraightLineBarrelCylinderCrossing::StraightLineBarrelCylinderCrossing ( const GlobalPoint startingPos,
const GlobalVector startingDir,
const PropagationDirection  propDir 
)

Constructor uses global frame (barrel cylinders are by definition in global co-ordinates).

Definition at line 8 of file StraightLineBarrelCylinderCrossing.cc.

00009                                      :
00010   theX0(startingPos),
00011   theP0(startingDir.unit()),
00012   thePropDir(propDir) {}


Member Function Documentation

std::pair< bool, double > StraightLineBarrelCylinderCrossing::chooseSolution ( const double  s1,
const double  s2 
) const [private]

Chooses the right solution w.r.t. the propagation direction.

Definition at line 39 of file StraightLineBarrelCylinderCrossing.cc.

References alongMomentum, anyDirection, and thePropDir.

Referenced by pathLength().

00041 {
00042   //
00043   // follows the logic implemented in HelixBarrelCylinderCrossing
00044   //
00045   if ( thePropDir==anyDirection ) {
00046     return std::pair<bool,double>(true,(fabs(s1)<fabs(s2)?s1:s2));
00047   }
00048   else {
00049     int propSign = thePropDir==alongMomentum ? 1 : -1;
00050     if ( s1*s2 < 0) {
00051       // if different signs return the positive one
00052       return std::pair<bool,double>(true,((s1*propSign>0)?s1:s2));
00053     }
00054     else if ( s1*propSign>0 ) {
00055       // if both positive, return the shortest
00056       return std::pair<bool,double>(true,(fabs(s1)<fabs(s2)?s1:s2));
00057     }
00058   }
00059   return std::pair<bool,double>(false,0.);
00060 }

std::pair< bool, double > StraightLineBarrelCylinderCrossing::pathLength ( const Cylinder cyl  )  const

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

Definition at line 15 of file StraightLineBarrelCylinderCrossing.cc.

References chooseSolution(), edm::eq(), dttmaxenums::R, Cylinder::radius(), theP0, theX0, Surface::toGlobal(), PV3DBase< T, PVType, FrameType >::x(), and PV3DBase< T, PVType, FrameType >::y().

Referenced by RKPropagatorInS::propagateParametersOnCylinder(), and AnalyticalPropagator::propagateWithLineCrossing().

00016 {
00017   //
00018   // radius of cylinder and transversal position relative to axis
00019   //
00020   double R(cylinder.radius());
00021   GlobalPoint axis(cylinder.toGlobal(Cylinder::LocalPoint(0.,0.)));
00022   PositionType2D xt2d(theX0.x()-axis.x(),theX0.y()-axis.y());
00023   //
00024   // transverse direction
00025   // 
00026   DirectionType2D pt2d(theP0.x(),theP0.y());
00027   //
00028   // solution of quadratic equation for s - assume |theP0|=1
00029   //
00030   RealQuadEquation eq(pt2d.mag2(),2.*xt2d.dot(pt2d),xt2d.mag2()-R*R);
00031   if ( !eq.hasSolution )  return std::pair<bool,double>(false,0.);
00032   //
00033   // choice of solution and verification of direction
00034   //
00035   return chooseSolution(eq.first,eq.second);
00036 }

GlobalPoint StraightLineBarrelCylinderCrossing::position ( const double  s  )  const [inline]

Returns the position along the line that corresponds to path length "s" from the starting point.

If s is obtained from the pathLength method the position is the intersection point with the cylinder.

Definition at line 37 of file StraightLineBarrelCylinderCrossing.h.

References theP0, and theX0.

Referenced by RKPropagatorInS::propagateParametersOnCylinder(), and AnalyticalPropagator::propagateWithLineCrossing().

00037 { return GlobalPoint(theX0+s*theP0);}


Member Data Documentation

const DirectionType StraightLineBarrelCylinderCrossing::theP0 [private]

Definition at line 53 of file StraightLineBarrelCylinderCrossing.h.

Referenced by pathLength(), and position().

const PropagationDirection StraightLineBarrelCylinderCrossing::thePropDir [private]

Definition at line 54 of file StraightLineBarrelCylinderCrossing.h.

Referenced by chooseSolution().

const PositionType StraightLineBarrelCylinderCrossing::theX0 [private]

Definition at line 52 of file StraightLineBarrelCylinderCrossing.h.

Referenced by pathLength(), and position().


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