CMS 3D CMS Logo

Public Member Functions | Static Public Member Functions | Private Attributes

ThirdHitPredictionFromCircle::HelixRZ Class Reference

#include <ThirdHitPredictionFromCircle.h>

List of all members.

Public Member Functions

 HelixRZ ()
 HelixRZ (const ThirdHitPredictionFromCircle *circle, double z1, double z2, double curvature)
double rAtZ (double z) const
double zAtR (double r) const

Static Public Member Functions

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

Private Attributes

const
ThirdHitPredictionFromCircle
circle
double curvature
double dzdu
double seg
double z1

Detailed Description

Definition at line 30 of file ThirdHitPredictionFromCircle.h.


Constructor & Destructor Documentation

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

Definition at line 32 of file ThirdHitPredictionFromCircle.h.

: circle(0) {}
ThirdHitPredictionFromCircle::HelixRZ::HelixRZ ( const ThirdHitPredictionFromCircle circle,
double  z1,
double  z2,
double  curvature 
)

Definition at line 187 of file ThirdHitPredictionFromCircle.cc.

References abs, ThirdHitPredictionFromCircle::delta, dzdu, alignCSCRings::e, likely, M_PI_2, seg, and z1.

                                                                                 :
  circle(circle), curvature(curv), z1(z1)
{
  double 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 204 of file ThirdHitPredictionFromCircle.cc.

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

Referenced by PixelTripletLargeTipGenerator::hitTriplets().

{
  static const 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;
}
double ThirdHitPredictionFromCircle::HelixRZ::rAtZ ( double  z) const

Definition at line 246 of file ThirdHitPredictionFromCircle.cc.

References abs, trackerHits::c, ThirdHitPredictionFromCircle::center, funct::cos(), ThirdHitPredictionFromCircle::curvature(), alignCSCRings::e, M_PI, mag(), max(), AlCaHLTBitMon_ParallelJobs::p, ThirdHitPredictionFromCircle::phi(), CosmicsPD_Skims::radius, alignCSCRings::s, FWPFMaths::sgn(), 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)) {
    double tip = circle->axis * circle->p1;
    double 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)
  double minR = (2. * circle->center - circle->p1).mag();

  double 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 minR;
  }

  double radius = 1. / curvature;
  double orthog = sgn(curvature) * clamped_sqrt(sqr(radius) - circle->delta2);
  Point2D center = circle->center + orthog * circle->axis;
  Point2D rel = circle->p1 - center;

  double c = cos(phi);
  double s = sin(phi);

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

  return std::max(minR, p.mag());
}
double ThirdHitPredictionFromCircle::HelixRZ::zAtR ( double  r) const

Definition at line 215 of file ThirdHitPredictionFromCircle.cc.

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

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

  double radius = 1.0 / curvature;
  double radius2 = sqr(radius);
  double orthog = sgn(curvature) * clamped_sqrt(radius2 - circle->delta2);
  Point2D center = circle->center + orthog * circle->axis;

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

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

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

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

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

Member Data Documentation

Definition at line 43 of file ThirdHitPredictionFromCircle.h.

Definition at line 44 of file ThirdHitPredictionFromCircle.h.

Definition at line 44 of file ThirdHitPredictionFromCircle.h.

Referenced by HelixRZ().

Definition at line 44 of file ThirdHitPredictionFromCircle.h.

Referenced by HelixRZ().

Definition at line 44 of file ThirdHitPredictionFromCircle.h.

Referenced by HelixRZ().