#include <TrackingTools/GeomPropagators/interface/StraightLineCylinderCrossing.h>
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. | |
LocalPoint | position (const double s) const |
Returns the position along the line that corresponds to path length "s" from the starting point. | |
StraightLineCylinderCrossing (const LocalPoint &startingPos, const LocalVector &startingDir, const PropagationDirection propDir=alongMomentum, double tolerance=0) | |
Constructor in local frame. | |
Private Types | |
typedef LocalVector | DirectionType |
typedef Basic2DVector< float > | DirectionType2D |
typedef LocalPoint | 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 |
double | theTolerance |
const PositionType | theX0 |
Definition at line 17 of file StraightLineCylinderCrossing.h.
typedef LocalVector StraightLineCylinderCrossing::DirectionType [private] |
Definition at line 48 of file StraightLineCylinderCrossing.h.
typedef Basic2DVector<float> StraightLineCylinderCrossing::DirectionType2D [private] |
Definition at line 50 of file StraightLineCylinderCrossing.h.
typedef LocalPoint StraightLineCylinderCrossing::PositionType [private] |
Definition at line 47 of file StraightLineCylinderCrossing.h.
typedef Basic2DVector<float> StraightLineCylinderCrossing::PositionType2D [private] |
Definition at line 49 of file StraightLineCylinderCrossing.h.
StraightLineCylinderCrossing::StraightLineCylinderCrossing | ( | const LocalPoint & | startingPos, | |
const LocalVector & | startingDir, | |||
const PropagationDirection | propDir = alongMomentum , |
|||
double | tolerance = 0 | |||
) |
Constructor in local frame.
Definition at line 11 of file StraightLineCylinderCrossing.cc.
00012 : 00013 theX0(startingPos), 00014 theP0(startingDir.unit()), 00015 thePropDir(propDir), 00016 theTolerance(tolerance) {}
std::pair< bool, double > StraightLineCylinderCrossing::chooseSolution | ( | const double | s1, | |
const double | s2 | |||
) | const [private] |
Chooses the right solution w.r.t. the propagation direction.
Definition at line 54 of file StraightLineCylinderCrossing.cc.
References alongMomentum, anyDirection, min, thePropDir, and theTolerance.
Referenced by pathLength().
00056 { 00057 // 00058 // follows the logic implemented in HelixBarrelCylinderCrossing 00059 // 00060 if ( thePropDir==anyDirection ) { 00061 return std::pair<bool,double>(true,(fabs(s1)<fabs(s2)?s1:s2)); 00062 } 00063 else { 00064 int propSign = thePropDir==alongMomentum ? 1 : -1; 00065 if ( s1*s2 < 0) { 00066 // if different signs return the positive one 00067 return std::pair<bool,double>(true,((s1*propSign>0)?s1:s2)); 00068 } 00069 else if ( s1*propSign>0 ) { 00070 // if both positive, return the shortest 00071 return std::pair<bool,double>(true,(fabs(s1)<fabs(s2)?s1:s2)); 00072 } 00073 else { 00074 // if both negative, check if the smaller (abs value) is smaller then tolerance 00075 double shorter = std::min( fabs(s1), fabs(s2)); 00076 if (shorter < theTolerance) return std::pair<bool,double>(true,0); 00077 else return std::pair<bool,double>(false,0.); 00078 } 00079 } 00080 }
Propagation status (true if valid) and (signed) path length along the line from the starting point to the cylinder.
Definition at line 19 of file StraightLineCylinderCrossing.cc.
References chooseSolution(), edm::eq(), dttmaxenums::R, Cylinder::radius(), theP0, theX0, PV3DBase< T, PVType, FrameType >::x(), and PV3DBase< T, PVType, FrameType >::y().
Referenced by NavCylinder::distanceAlongLine(), and RKPropagatorInS::propagateParametersOnCylinder().
00020 { 00021 // 00022 // radius of cylinder and transversal position relative to axis 00023 // 00024 double R(cylinder.radius()); 00025 PositionType2D xt2d(theX0.x(),theX0.y()); 00026 // 00027 // transverse direction 00028 // 00029 DirectionType2D pt2d(theP0.x(),theP0.y()); 00030 // 00031 // solution of quadratic equation for s - assume |theP0|=1 00032 // 00033 RealQuadEquation eq(pt2d.mag2(),2.*xt2d.dot(pt2d),xt2d.mag2()-R*R); 00034 if ( !eq.hasSolution ) { 00035 /* 00036 double A= pt2d.mag2(); 00037 double B= 2.*xt2d.dot(pt2d); 00038 double C= xt2d.mag2()-R*R; 00039 cout << "A= " << pt2d.mag2() 00040 << " B= " << 2.*xt2d.dot(pt2d) 00041 << " C= " << xt2d.mag2()-R*R 00042 << " D= " << B*B - 4*A*C 00043 << endl; 00044 */ 00045 return std::pair<bool,double>(false,0.); 00046 } 00047 // 00048 // choice of solution and verification of direction 00049 // 00050 return chooseSolution(eq.first,eq.second); 00051 }
LocalPoint StraightLineCylinderCrossing::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 StraightLineCylinderCrossing.h.
00037 { return LocalPoint(theX0+s*theP0);}
const DirectionType StraightLineCylinderCrossing::theP0 [private] |
Definition at line 53 of file StraightLineCylinderCrossing.h.
Referenced by pathLength(), and position().
const PropagationDirection StraightLineCylinderCrossing::thePropDir [private] |
double StraightLineCylinderCrossing::theTolerance [private] |
const PositionType StraightLineCylinderCrossing::theX0 [private] |
Definition at line 52 of file StraightLineCylinderCrossing.h.
Referenced by pathLength(), and position().