CMS 3D CMS Logo

StraightLinePlaneCrossing.cc
Go to the documentation of this file.
2 
4 
5 //
6 // Propagation status and path length to intersection
7 //
8 std::pair<bool, double> StraightLinePlaneCrossing::pathLength(const Plane& plane) const {
9  //
10  // calculate path length
11  //
12  PositionType planePosition(plane.position());
13  DirectionType planeNormal(plane.normalVector());
14  auto pz = planeNormal.dot(theP0);
15  auto dS = -planeNormal.dot(theX0 - planePosition) / pz;
16  // check direction
17  auto opposite2Track =
18  ((thePropDir == alongMomentum) & (dS < 0.f)) | ((thePropDir == oppositeToMomentum) & (dS > 0.f));
19  //
20  // Return result
21  //
22  return std::pair<bool, double>(!opposite2Track, dS);
23 }
24 
25 std::pair<bool, StraightLinePlaneCrossing::PositionType> StraightLinePlaneCrossing::position(const Plane& plane) const {
26  auto crossed = pathLength(plane);
27  if (crossed.first)
28  return std::pair<bool, PositionType>(true, position(crossed.second));
29  else
30  return std::pair<bool, PositionType>(false, PositionType());
31 }
const PropagationDirection thePropDir
Basic3DVector< float > PositionType
GlobalVector normalVector() const
Definition: Plane.h:41
Definition: Plane.h:16
PositionType position(float s) const
double f[11][100]
std::pair< bool, double > pathLength(const Plane &plane) const
const PositionType & position() const
T dot(const Basic3DVector &rh) const
Scalar product, or "dot" product, with a vector of same type.