Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-03-17 02:46:11

0001 #include "TrackingTools/GeomPropagators/interface/StraightLinePlaneCrossing.h"
0002 
0003 #include "DataFormats/GeometrySurface/interface/Plane.h"
0004 #include "FWCore/Utilities/interface/isFinite.h"
0005 
0006 //
0007 // Propagation status  and path length to intersection
0008 //
0009 std::pair<bool, double> StraightLinePlaneCrossing::pathLength(const Plane& plane) const {
0010   //
0011   // calculate path length
0012   //
0013   PositionType planePosition(plane.position());
0014   DirectionType planeNormal(plane.normalVector());
0015   auto pz = planeNormal.dot(theP0);
0016   auto dS = -planeNormal.dot(theX0 - planePosition) / pz;
0017   // check direction
0018   auto opposite2Track = ((thePropDir == alongMomentum) & (dS < 0.f)) |
0019                         ((thePropDir == oppositeToMomentum) & (dS > 0.f)) | edm::isNotFinite(dS);
0020   //
0021   // Return result
0022   //
0023   return std::pair<bool, double>(!opposite2Track, dS);
0024 }
0025 
0026 std::pair<bool, StraightLinePlaneCrossing::PositionType> StraightLinePlaneCrossing::position(const Plane& plane) const {
0027   auto crossed = pathLength(plane);
0028   if (crossed.first)
0029     return std::pair<bool, PositionType>(true, position(crossed.second));
0030   else
0031     return std::pair<bool, PositionType>(false, PositionType());
0032 }