Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:34:15

0001 #ifndef _TangentApproachInRPhi_H_
0002 #define _TangentApproachInRPhi_H_
0003 
0004 #include "TrackingTools/PatternTools/interface/ClosestApproachOnHelices.h"
0005 #include "TrackingTools/TrajectoryState/interface/FreeTrajectoryState.h"
0006 
0007 /** Given two trajectory states, computes the two points of tangent approach 
0008  *  in the transverse plane for the helices extrapolated from these states. 
0009  *  1) computes the tangent points of the circles in transverse plane. 
0010  *     Two cases: - Whether or not the circles intersect the points used are 
0011  *                  the points of tangent approach of the two circles. 
0012  *  2) computes the corresponding z-coordinates.
0013  */
0014 
0015 class TangentApproachInRPhi : public ClosestApproachOnHelices {
0016 public:
0017   TangentApproachInRPhi() {
0018     status_ = false;
0019     intersection_ = false;
0020   }
0021 
0022   bool calculate(const TrajectoryStateOnSurface& sta, const TrajectoryStateOnSurface& stb) override;
0023 
0024   bool calculate(const FreeTrajectoryState& sta, const FreeTrajectoryState& stb) override;
0025 
0026   bool status() const override { return status_; }
0027 
0028   /**
0029    * Returns the two PCA on the trajectories.
0030    */
0031   std::pair<GlobalPoint, GlobalPoint> points() const override;
0032 
0033   /** Returns not only the points, but the full GlobalTrajectoryParemeters 
0034    *  at the points of closest approach */
0035   std::pair<GlobalTrajectoryParameters, GlobalTrajectoryParameters> trajectoryParameters() const;
0036 
0037   /** arithmetic mean of the two points of closest approach */
0038   GlobalPoint crossingPoint() const override;
0039 
0040   /** distance between the two points of closest approach in 3D */
0041   float distance() const override;
0042 
0043   /** signed distance between two points of closest approach in r-phi plane (-ive if circles intersect) */
0044   float perpdist() const;
0045 
0046   /**
0047    *  Clone method
0048    */
0049   TangentApproachInRPhi* clone() const override { return new TangentApproachInRPhi(*this); }
0050 
0051 private:
0052   bool calculate(const TrackCharge& chargeA,
0053                  const GlobalVector& momentumA,
0054                  const GlobalPoint& positionA,
0055                  const TrackCharge& chargeB,
0056                  const GlobalVector& momentumB,
0057                  const GlobalPoint& positionB,
0058                  const MagneticField& magField);
0059 
0060   // given the old Parameters, and a new GlobalPoint,
0061   // we return the full new GlobalTrajectoryParameters at the
0062   // Point.
0063   GlobalTrajectoryParameters trajectoryParameters(const GlobalPoint& newpt,
0064                                                   const GlobalTrajectoryParameters& oldpar) const;
0065 
0066   // Computes center coordinates and unsigned radius of circle;
0067   void circleParameters(const TrackCharge& charge,
0068                         const GlobalVector& momemtum,
0069                         const GlobalPoint& position,
0070                         double& xc,
0071                         double& yc,
0072                         double& r,
0073                         const MagneticField& magField) const;
0074 
0075   // Computes crossing points of 2 circles with centres (cx_i, cy_i)
0076   // and unsigned radii r_i.
0077   // Two cases: - circles have one or two intersection points;
0078   //              return value = 1;
0079   //            - circles do not cross; computes point of closest approach
0080   //              on each circle; return value = 2;
0081   // if the calculation fails (e.g. concentric circles), return value = 0;
0082 
0083   int transverseCoord(double cxa,
0084                       double cya,
0085                       double ra,
0086                       double cxb,
0087                       double cyb,
0088                       double rb,
0089                       double& xg1,
0090                       double& yg1,
0091                       double& xg2,
0092                       double& yg2) const;
0093 
0094   // Computes z-coordinate on helix at given transverse coordinates
0095   double zCoord(
0096       const GlobalVector& mom, const GlobalPoint& pos, double r, double xc, double yc, double xg, double yg) const;
0097 
0098 private:
0099   bool status_;
0100   GlobalPoint posA, posB;
0101   GlobalTrajectoryParameters paramA, paramB;
0102   bool intersection_;
0103 };
0104 
0105 #endif