Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef HelixForwardPlaneCrossing_H_
0002 #define HelixForwardPlaneCrossing_H_
0003 
0004 #include "DataFormats/TrajectorySeed/interface/PropagationDirection.h"
0005 #include "TrackingTools/GeomPropagators/interface/HelixPlaneCrossing.h"
0006 #include "DataFormats/GeometrySurface/interface/Plane.h"
0007 #include "FWCore/Utilities/interface/isFinite.h"
0008 #include "FWCore/Utilities/interface/Likely.h"
0009 #include <limits>
0010 
0011 /** Calculates intersections of a helix with planes perpendicular to the z-axis.
0012  */
0013 
0014 class HelixForwardPlaneCrossing final : public HelixPlaneCrossing {
0015 public:
0016   /** Constructor using point, direction and (transverse!) curvature.
0017    */
0018   HelixForwardPlaneCrossing(const PositionType& point,
0019                             const DirectionType& direction,
0020                             const float curvature,
0021                             const PropagationDirection propDir = alongMomentum);
0022   // destructor
0023   ~HelixForwardPlaneCrossing() override {}
0024 
0025   /** Propagation status (true if valid) and (signed) path length 
0026    *  along the helix from the starting point to the plane.
0027    */
0028   std::pair<bool, double> pathLength(const Plane& plane) override {
0029     //
0030     // Protect against p_z=0 and calculate path length
0031     //
0032     if UNLIKELY (std::abs(theCosTheta) < std::numeric_limits<float>::min())
0033       return std::pair<bool, double>(false, 0);
0034 
0035     double dS = (plane.position().z() - theZ0) / theCosTheta;
0036 
0037     // negative logic to avoid checking for anyDirection...
0038     return std::make_pair(!(((thePropDir == alongMomentum) & (dS < 0.)) |
0039                             ((thePropDir == oppositeToMomentum) & (dS > 0.)) | edm::isNotFinite(dS)),
0040                           dS);
0041   }
0042 
0043   /** Position at pathlength s from the starting point.
0044    */
0045   PositionType position(double s) const override;
0046 
0047   /** Direction at pathlength s from the starting point.
0048    */
0049   DirectionType direction(double s) const override;
0050 
0051 private:
0052   //
0053   // double precision vectors for internal use
0054   //
0055   typedef Basic3DVector<double> PositionTypeDouble;
0056   typedef Basic3DVector<double> DirectionTypeDouble;
0057 
0058   const double theX0, theY0, theZ0;
0059   double theCosPhi0, theSinPhi0;
0060   double theCosTheta, theSinTheta;
0061   const double theRho;
0062 
0063   const PropagationDirection thePropDir;
0064 
0065   mutable double theCachedS;
0066   mutable double theCachedDPhi;
0067   mutable double theCachedSDPhi;
0068   mutable double theCachedCDPhi;
0069 
0070   static const float theNumericalPrecision;
0071 };
0072 
0073 #endif