Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:31:28

0001 #ifndef StraightLinePlaneCrossing_H_
0002 #define StraightLinePlaneCrossing_H_
0003 
0004 #include "DataFormats/GeometryVector/interface/Basic3DVector.h"
0005 #include "DataFormats/TrajectorySeed/interface/PropagationDirection.h"
0006 
0007 #include <utility>
0008 
0009 class Plane;
0010 
0011 /** Calculates intersections of a line with a plane.
0012  */
0013 
0014 class StraightLinePlaneCrossing {
0015 public:
0016   /** The types for position and direction are frame-neutral
0017    *  (not global, local, etc.) so this interface can be used
0018    *  in any frame. Of course, the helix and the plane must be defined 
0019    *  in the same frame, which is also the frame of the result.
0020    */
0021   using PositionType = Basic3DVector<float>;
0022   using DirectionType = Basic3DVector<float>;
0023 
0024 public:
0025   /** Constructor using point and momentum.
0026    */
0027   StraightLinePlaneCrossing(const PositionType& point,
0028                             const DirectionType& momentum,
0029                             const PropagationDirection propDir = alongMomentum)
0030       : theX0(point), theP0(momentum.unit()), thePropDir(propDir) {}
0031 
0032   // destructor
0033   ~StraightLinePlaneCrossing() {}
0034 
0035   /** Propagation status (true if valid) and (signed) path length 
0036    *  along the helix from the starting point to the plane.
0037    */
0038   std::pair<bool, double> pathLength(const Plane& plane) const;
0039 
0040   /** Position at pathlength s from the starting point.
0041    */
0042   PositionType position(float s) const { return PositionType(theX0 + s * theP0); }
0043 
0044   /** Simplified interface in case the path length is not needed
0045    */
0046   std::pair<bool, PositionType> position(const Plane& plane) const;
0047 
0048 private:
0049   //
0050   // single precision vectors sufficient for internal use
0051   //
0052 
0053   const PositionType theX0;
0054   const PositionType theP0;
0055   const PropagationDirection thePropDir;
0056 };
0057 
0058 #endif