Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef HelixExtrapolatorToLine2Order_h_
0002 #define HelixExtrapolatorToLine2Order_h_
0003 
0004 #include "TrackingTools/GeomPropagators/interface/HelixLineExtrapolation.h"
0005 #include "DataFormats/TrajectorySeed/interface/PropagationDirection.h"
0006 #include "FWCore/Utilities/interface/Visibility.h"
0007 
0008 /** Calculates intersections of a helix with planes of
0009  *  any orientation using a parabolic approximation. */
0010 
0011 class HelixExtrapolatorToLine2Order final : public HelixLineExtrapolation {
0012 public:
0013   /// Constructor using point, direction and (transverse!) curvature.
0014   HelixExtrapolatorToLine2Order(const PositionType& point,
0015                                 const DirectionType& direction,
0016                                 const float curvature,
0017                                 const PropagationDirection propDir = alongMomentum);
0018 
0019   /// Fast constructor (for use by IterativeHelixExtrapolatorToLine).
0020   HelixExtrapolatorToLine2Order(const double& x0,
0021                                 const double& y0,
0022                                 const double& z0,
0023                                 const double& cosPhi0,
0024                                 const double& sinPhi0,
0025                                 const double& cosTheta,
0026                                 const double& sinTheta,
0027                                 const double& rho,
0028                                 const PropagationDirection propDir = alongMomentum)
0029       : thePosition(x0, y0, z0),
0030         theDirection(cosPhi0, sinPhi0, cosTheta / sinTheta),
0031         theSinTheta(sinTheta),
0032         theRho(rho),
0033         thePropDir(propDir) {}
0034 
0035   // destructor
0036   ~HelixExtrapolatorToLine2Order() override {}
0037 
0038   /** Propagation status (true if valid) and (signed) path length 
0039    *  along the helix from the starting point to the closest approach
0040    *  to the point. The starting point is given in the constructor.
0041    */
0042   std::pair<bool, double> pathLength(const GlobalPoint& point) const override;
0043 
0044   /** Propagation status (true if valid) and (signed) path length 
0045    *  along the helix from the starting point to the closest approach
0046    *  to the line. The starting point is given in the constructor.
0047    */
0048   std::pair<bool, double> pathLength(const Line& line) const override;
0049 
0050   /// Position at pathlength s from the starting point.
0051   PositionType position(double s) const override;
0052 
0053   /// Direction at pathlength s from the starting point.
0054   DirectionType direction(double s) const override;
0055 
0056   /// Position at pathlength s from the starting point in double precision.
0057   PositionTypeDouble positionInDouble(double s) const;
0058 
0059   /// Direction at pathlength s from the starting point in double precision.
0060   DirectionTypeDouble directionInDouble(double s) const;
0061 
0062 private:
0063   /// common part for propagation to point and line
0064   virtual std::pair<bool, double> pathLengthFromCoefficients(const double ceq[4]) const dso_internal;
0065   /// Solutions of 3rd order equation
0066   int solve3rdOrder(const double ceq[], double sol[]) const dso_internal;
0067   /// Solutions of 2nd order equation
0068   int solve2ndOrder(const double ceq[], double sol[]) const dso_internal;
0069 
0070 private:
0071   const PositionTypeDouble thePosition;
0072   DirectionTypeDouble theDirection;
0073   double theSinTheta;
0074   const double theRho;
0075   const PropagationDirection thePropDir;
0076 };
0077 
0078 #endif