CMS 3D CMS Logo

Public Types | Public Member Functions | Static Public Member Functions | Private Attributes

ThirdHitPredictionFromCircle::HelixRZ Class Reference

#include <ThirdHitPredictionFromCircle.h>

List of all members.

Public Types

typedef Basic2DVector< Scalar > Vector2D

Public Member Functions

 HelixRZ ()
 HelixRZ (const ThirdHitPredictionFromCircle *icircle, double iz1, double z2, double curv)
Scalar rAtZ (Scalar z) const
Scalar zAtR (Scalar r) const

Static Public Member Functions

static double maxCurvature (const ThirdHitPredictionFromCircle *circle, double z1, double z2, double z3)

Private Attributes

Vector2D center
const
ThirdHitPredictionFromCircle
circle
Scalar curvature
Scalar dzdu
Scalar radius
Scalar seg
Scalar z1

Detailed Description

Definition at line 33 of file ThirdHitPredictionFromCircle.h.


Member Typedef Documentation

Definition at line 16 of file ThirdHitPredictionFromCircle.h.


Constructor & Destructor Documentation

ThirdHitPredictionFromCircle::HelixRZ::HelixRZ ( ) [inline]

Definition at line 40 of file ThirdHitPredictionFromCircle.h.

: circle(0) {}
ThirdHitPredictionFromCircle::HelixRZ::HelixRZ ( const ThirdHitPredictionFromCircle icircle,
double  iz1,
double  z2,
double  curv 
)

Definition at line 185 of file ThirdHitPredictionFromCircle.cc.

References abs, ThirdHitPredictionFromCircle::axis, ThirdHitPredictionFromCircle::center, center, circle, ThirdHitPredictionFromCircle::delta, ThirdHitPredictionFromCircle::delta2, dzdu, alignCSCRings::e, likely, M_PI_2, radius, seg, FWPFMaths::sgn(), and z1.

                                                                                    :
  circle(icircle), curvature(curv), radius(1./curv), z1(iz1)
{
  Scalar orthog = sgn(curv) * clamped_sqrt(radius*radius - circle->delta2);
  center = circle->center + orthog * circle->axis;

  Scalar absCurv = std::abs(curv);
  seg = circle->delta;

  if (likely(absCurv > 1.0e-5)) {
    seg *= absCurv;
    seg = seg < -1.0 ? -M_PI_2 : seg > 1.0 ? M_PI_2 : std::asin(seg);
    seg /= absCurv;
  }

  seg *= 2.;
  dzdu = likely(std::abs(seg) > 1.0e-5) ? ((z2 - z1) / seg) : 99999.0;
}

Member Function Documentation

double ThirdHitPredictionFromCircle::HelixRZ::maxCurvature ( const ThirdHitPredictionFromCircle circle,
double  z1,
double  z2,
double  z3 
) [static]

Definition at line 205 of file ThirdHitPredictionFromCircle.cc.

References constexpr, ThirdHitPredictionFromCircle::delta, M_PI, funct::sin(), and unlikely.

Referenced by PixelTripletLargeTipGenerator::hitTriplets().

{
  constexpr double maxAngle = M_PI;
  double halfAngle = (0.5 * maxAngle) * (z2 - z1) / (z3 - z1);
  if (unlikely(halfAngle <= 0.0))
    return 0.0;

  return std::sin(halfAngle) / circle->delta;
}
ThirdHitPredictionFromCircle::HelixRZ::Scalar ThirdHitPredictionFromCircle::HelixRZ::rAtZ ( Scalar  z) const

Definition at line 246 of file ThirdHitPredictionFromCircle.cc.

References abs, trackerHits::c, ThirdHitPredictionFromCircle::center, funct::cos(), ThirdHitPredictionFromCircle::curvature(), alignCSCRings::e, M_PI, mag2(), max(), AlCaHLTBitMon_ParallelJobs::p, ThirdHitPredictionFromCircle::phi(), alignCSCRings::s, funct::sin(), funct::sqr(), mathSSE::sqrt(), unlikely, Basic2DVector< T >::x(), and Basic2DVector< T >::y().

                                                        {
  if (unlikely(std::abs(dzdu) < 1.0e-5))
    return 99999.0;

  if (unlikely(std::abs(curvature) < 1.0e-5)) {
    Scalar tip = circle->axis * circle->p1;
    Scalar lip = circle->axis.y() * circle->p1.x() -
                 circle->axis.x() * circle->p1.y();
    return std::sqrt(sqr(tip) + sqr(lip + (z - z1) / dzdu));
  }

  // we won't go below that (see comment below)
  Scalar minR2 = (2. * circle->center - circle->p1).mag2();

  float phi =  curvature * (z - z1) / dzdu;

  if (unlikely(std::abs(phi) > 2. * M_PI)) {
    // with a helix we can get problems here - this is used to get the limits
    // however, if phi gets large, we get into the regions where we loop back
    // to smaller r's.  The question is - do we care about these tracks?
    // The answer is probably no:  Too much pain, and the rest of the
    // tracking won't handle looping tracks anyway.
    // So, what we do here is to return nothing smaller than the radius
    // than any of the two hits, i.e. the second hit, which is presumably
    // outside of the 1st hit.

    return std::sqrt(minR2);
  }

  Vector2D rel = circle->p1 - center;

  Scalar c = std::cos(phi);
  Scalar s = std::sin(phi);

  Vector2D p(center.x() + c * rel.x() - s * rel.y(),
            center.y() + s * rel.x() + c * rel.y());

  return std::sqrt(std::max(minR2, p.mag2()));
}
ThirdHitPredictionFromCircle::HelixRZ::Scalar ThirdHitPredictionFromCircle::HelixRZ::zAtR ( Scalar  r) const

Definition at line 218 of file ThirdHitPredictionFromCircle.cc.

References abs, b, ThirdHitPredictionFromCircle::center, ThirdHitPredictionFromCircle::curvature(), alignCSCRings::e, Basic2DVector< T >::mag2(), CosmicsPD_Skims::radius, funct::sqr(), mathSSE::sqrt(), and unlikely.

                                                        {
  if (unlikely(std::abs(curvature) < 1.0e-5)) {
     Scalar tip = circle->axis * circle->p1;
     Scalar lip = circle->axis.y() * circle->p1.x() -
                  circle->axis.x() * circle->p1.y();
     return z1 + (std::sqrt(sqr(r) - sqr(tip)) - lip) * dzdu;
  }

  Scalar radius2 = sqr(radius);

  Scalar b2 = center.mag2();
  Scalar b = std::sqrt(b2);

  Scalar cos1 = 0.5 * curvature * (radius2 + b2 - sqr(r)) / b;
  Scalar cos2 = 0.5 * curvature * (radius2 + b2 - circle->p1.mag2()) /  b;

  Scalar phi1 = clamped_acos(cos1);
  Scalar phi2 = clamped_acos(cos2);

  // more plausbility checks needed...
  // the two circles can have two possible intersections
  Scalar u1 = std::abs((phi1 - phi2) * radius);
  Scalar u2 = std::abs((phi1 + phi2) * radius);

  return z1 + ((u1 >= seg && u1 < u2)? u1 : u2) * dzdu;
}

Member Data Documentation

Definition at line 52 of file ThirdHitPredictionFromCircle.h.

Referenced by HelixRZ().

Definition at line 51 of file ThirdHitPredictionFromCircle.h.

Referenced by HelixRZ().

Definition at line 53 of file ThirdHitPredictionFromCircle.h.

Definition at line 53 of file ThirdHitPredictionFromCircle.h.

Referenced by HelixRZ().

Definition at line 53 of file ThirdHitPredictionFromCircle.h.

Referenced by HelixRZ().

Definition at line 53 of file ThirdHitPredictionFromCircle.h.

Referenced by HelixRZ().

Definition at line 53 of file ThirdHitPredictionFromCircle.h.

Referenced by HelixRZ().