test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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>
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) );
20  //
21  // Return result
22  //
23  return std::pair<bool,double>(!opposite2Track,dS);
24 }
25 
26 std::pair<bool,StraightLinePlaneCrossing::PositionType>
28 {
29  auto crossed = pathLength(plane);
30  if (crossed.first) return std::pair<bool,PositionType>(true, position(crossed.second));
31  else return std::pair<bool,PositionType>(false, PositionType());
32 }
33 
const PropagationDirection thePropDir
Basic3DVector< float > PositionType
GlobalVector normalVector() const
Definition: Plane.h:41
Definition: Plane.h:17
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 &quot;dot&quot; product, with a vector of same type.