Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:31:32

0001 #ifndef HELIXARBITRARYPLANECROSSING2ORDER_H_
0002 #define HELIXARBITRARYPLANECROSSING2ORDER_H_
0003 #include "DataFormats/TrajectorySeed/interface/PropagationDirection.h"
0004 #include "TrackingTools/GeomPropagators/interface/HelixPlaneCrossing.h"
0005 #include "FWCore/Utilities/interface/Visibility.h"
0006 
0007 /** Calculates intersections of a helix with planes of
0008  *  any orientation using a parabolic approximation. */
0009 
0010 class HelixArbitraryPlaneCrossing2Order final : public HelixPlaneCrossing {
0011 public:
0012   /** Constructor using point, direction and (transverse!) curvature.
0013    */
0014   HelixArbitraryPlaneCrossing2Order(const PositionType& point,
0015                                     const DirectionType& direction,
0016                                     const float curvature,
0017                                     const PropagationDirection propDir = alongMomentum);
0018   /** Fast constructor (for use by HelixArbitraryPlaneCrossing).
0019    */
0020   HelixArbitraryPlaneCrossing2Order(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       : theX0(x0),
0030         theY0(y0),
0031         theZ0(z0),
0032         theCosPhi0(cosPhi0),
0033         theSinPhi0(sinPhi0),
0034         theCosTheta(cosTheta),
0035         theSinThetaI(1. / sinTheta),
0036         theRho(rho),
0037         thePropDir(propDir) {}
0038 
0039   // destructor
0040   ~HelixArbitraryPlaneCrossing2Order() override {}
0041 
0042   /** Propagation status (true if valid) and (signed) path length 
0043    *  along the helix from the starting point to the plane. The 
0044    *  starting point is given in the constructor.
0045    */
0046   std::pair<bool, double> pathLength(const Plane&) override;
0047 
0048   /** Position at pathlength s from the starting point.
0049    */
0050   PositionType position(double s) const override;
0051 
0052   /** Direction at pathlength s from the starting point.
0053    */
0054   DirectionType direction(double s) const override;
0055   //
0056   // double precision vectors
0057   //
0058   typedef Basic3DVector<double> PositionTypeDouble;
0059   typedef Basic3DVector<double> DirectionTypeDouble;
0060 
0061   /** Position at pathlength s from the starting point in double precision.
0062    */
0063   PositionTypeDouble positionInDouble(double s) const;
0064 
0065   /** Direction at pathlength s from the starting point in double precision.
0066    */
0067   DirectionTypeDouble directionInDouble(double s) const;
0068 
0069   /** Pathlength to closest solution.
0070    */
0071   inline double smallestPathLength(const double firstPathLength, const double secondPathLength) const {
0072     return fabs(firstPathLength) < fabs(secondPathLength) ? firstPathLength : secondPathLength;
0073   }
0074 
0075 private:
0076   /** Choice of one of two solutions according to the propagation direction.
0077    */
0078   std::pair<bool, double> solutionByDirection(const double dS1, const double dS2) const dso_internal;
0079 
0080 private:
0081   const double theX0, theY0, theZ0;
0082   double theCosPhi0, theSinPhi0;
0083   double theCosTheta, theSinThetaI;
0084   const double theRho;
0085   const PropagationDirection thePropDir;
0086 };
0087 
0088 #endif