CMS 3D CMS Logo

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