# Project CMSSW displayed by LXR

File indexing completed on 2023-03-17 11:26:21

```0001 #ifndef StraightLineBarrelCylinderCrossing_H
0002 #define StraightLineBarrelCylinderCrossing_H
0003
0004 #include "DataFormats/GeometryVector/interface/GlobalPoint.h"
0005 #include "DataFormats/GeometryVector/interface/GlobalVector.h"
0006 #include "DataFormats/GeometryVector/interface/Basic2DVector.h"
0007
0008 #include "DataFormats/TrajectorySeed/interface/PropagationDirection.h"
0009
0010 #include <utility>
0011
0012 class Cylinder;
0013
0014 /** Calculates the intersection of a straight line with a barrel cylinder.
0015  */
0016
0017 class StraightLineBarrelCylinderCrossing {
0018 public:
0019   /** Constructor uses global frame (barrel cylinders are by
0020    *  definition in global co-ordinates)
0021    */
0022   StraightLineBarrelCylinderCrossing(const GlobalPoint& startingPos,
0023                                      const GlobalVector& startingDir,
0024                                      const PropagationDirection propDir);
0025
0026   /** Propagation status (true if valid) and (signed) path length
0027    *  along the line from the starting point to the cylinder.
0028    */
0029   std::pair<bool, double> pathLength(const Cylinder& cyl) const;
0030
0031   /** Returns the position along the line that corresponds to path
0032    *  length "s" from the starting point. If s is obtained from the
0033    *  pathLength method the position is the intersection point
0034    *  with the cylinder.
0035    */
0036   GlobalPoint position(const double s) const { return GlobalPoint(theX0 + s * theP0); }
0037
0038 private:
0039   /// Chooses the right solution w.r.t. the propagation direction.
0040   std::pair<bool, double> chooseSolution(const double s1, const double s2) const;
0041
0042 private:
0043   //
0044   // single precision is sufficient for intermediate vectors
0045   //
0046   typedef GlobalPoint PositionType;
0047   typedef GlobalVector DirectionType;
0048   typedef Basic2DVector<float> PositionType2D;
0049   typedef Basic2DVector<float> DirectionType2D;
0050
0051   const PositionType theX0;
0052   const DirectionType theP0;
0053   const PropagationDirection thePropDir;
0054 };
0055
0056 #endif```