CMS 3D CMS Logo

List of all members | Public Member Functions | Private Types | Private Member Functions | Private Attributes
StraightLineBarrelCylinderCrossing Class Reference

#include <StraightLineBarrelCylinderCrossing.h>

Public Member Functions

std::pair< bool, double > pathLength (const Cylinder &cyl) const
 
GlobalPoint position (const double s) const
 
 StraightLineBarrelCylinderCrossing (const GlobalPoint &startingPos, const GlobalVector &startingDir, const PropagationDirection propDir)
 

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. More...
 

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

◆ DirectionType

Definition at line 47 of file StraightLineBarrelCylinderCrossing.h.

◆ DirectionType2D

Definition at line 49 of file StraightLineBarrelCylinderCrossing.h.

◆ PositionType

Definition at line 46 of file StraightLineBarrelCylinderCrossing.h.

◆ PositionType2D

Definition at line 48 of file StraightLineBarrelCylinderCrossing.h.

Constructor & Destructor Documentation

◆ StraightLineBarrelCylinderCrossing()

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 7 of file StraightLineBarrelCylinderCrossing.cc.

10  : theX0(startingPos), theP0(startingDir.unit()), thePropDir(propDir) {}

Member Function Documentation

◆ chooseSolution()

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 35 of file StraightLineBarrelCylinderCrossing.cc.

35  {
36  //
37  // follows the logic implemented in HelixBarrelCylinderCrossing
38  //
39  if (thePropDir == anyDirection) {
40  return std::pair<bool, double>(true, (fabs(s1) < fabs(s2) ? s1 : s2));
41  } else {
42  int propSign = thePropDir == alongMomentum ? 1 : -1;
43  if (s1 * s2 < 0) {
44  // if different signs return the positive one
45  return std::pair<bool, double>(true, ((s1 * propSign > 0) ? s1 : s2));
46  } else if (s1 * propSign > 0) {
47  // if both positive, return the shortest
48  return std::pair<bool, double>(true, (fabs(s1) < fabs(s2) ? s1 : s2));
49  }
50  }
51  return std::pair<bool, double>(false, 0.);
52 }

References alongMomentum, anyDirection, and thePropDir.

Referenced by pathLength().

◆ pathLength()

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 12 of file StraightLineBarrelCylinderCrossing.cc.

12  {
13  //
14  // radius of cylinder and transversal position relative to axis
15  //
16  double R(cylinder.radius());
17  GlobalPoint axis(cylinder.toGlobal(Cylinder::LocalPoint(0., 0.)));
18  PositionType2D xt2d(theX0.x() - axis.x(), theX0.y() - axis.y());
19  //
20  // transverse direction
21  //
22  DirectionType2D pt2d(theP0.x(), theP0.y());
23  //
24  // solution of quadratic equation for s - assume |theP0|=1
25  //
26  RealQuadEquation eq(pt2d.mag2(), 2. * xt2d.dot(pt2d), xt2d.mag2() - R * R);
27  if (!eq.hasSolution)
28  return std::pair<bool, double>(false, 0.);
29  //
30  // choice of solution and verification of direction
31  //
32  return chooseSolution(eq.first, eq.second);
33 }

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

Referenced by RKPropagatorInS::propagateParametersOnCylinder().

◆ position()

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 36 of file StraightLineBarrelCylinderCrossing.h.

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

References alignCSCRings::s, theP0, and theX0.

Referenced by RKPropagatorInS::propagateParametersOnCylinder().

Member Data Documentation

◆ theP0

const DirectionType StraightLineBarrelCylinderCrossing::theP0
private

Definition at line 52 of file StraightLineBarrelCylinderCrossing.h.

Referenced by pathLength(), and position().

◆ thePropDir

const PropagationDirection StraightLineBarrelCylinderCrossing::thePropDir
private

Definition at line 53 of file StraightLineBarrelCylinderCrossing.h.

Referenced by chooseSolution().

◆ theX0

const PositionType StraightLineBarrelCylinderCrossing::theX0
private

Definition at line 51 of file StraightLineBarrelCylinderCrossing.h.

Referenced by pathLength(), and position().

StraightLineBarrelCylinderCrossing::PositionType2D
Basic2DVector< float > PositionType2D
Definition: StraightLineBarrelCylinderCrossing.h:48
anyDirection
Definition: PropagationDirection.h:4
PV3DBase::x
T x() const
Definition: PV3DBase.h:59
StraightLineBarrelCylinderCrossing::chooseSolution
std::pair< bool, double > chooseSolution(const double s1, const double s2) const
Chooses the right solution w.r.t. the propagation direction.
Definition: StraightLineBarrelCylinderCrossing.cc:35
StraightLineBarrelCylinderCrossing::theP0
const DirectionType theP0
Definition: StraightLineBarrelCylinderCrossing.h:52
StraightLineBarrelCylinderCrossing::DirectionType2D
Basic2DVector< float > DirectionType2D
Definition: StraightLineBarrelCylinderCrossing.h:49
alignCSCRings.s
s
Definition: alignCSCRings.py:92
Vector3DBase::unit
Vector3DBase unit() const
Definition: Vector3DBase.h:54
RealQuadEquation
Definition: RealQuadEquation.h:11
GlobalPoint
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
Point3DBase< float, GlobalTag >
PV3DBase::y
T y() const
Definition: PV3DBase.h:60
StraightLineBarrelCylinderCrossing::theX0
const PositionType theX0
Definition: StraightLineBarrelCylinderCrossing.h:51
StraightLineBarrelCylinderCrossing::thePropDir
const PropagationDirection thePropDir
Definition: StraightLineBarrelCylinderCrossing.h:53
dttmaxenums::R
Definition: DTTMax.h:29
alongMomentum
Definition: PropagationDirection.h:4