CMS 3D CMS Logo

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

ThirdHitPredictionFromInvParabola Class Reference

#include <ThirdHitPredictionFromInvParabola.h>

List of all members.

Public Types

typedef Basic2DVector< Scalar > Point2D
typedef PixelRecoRange< float > Range
typedef PixelRecoRange< Scalar > RangeD
typedef TkRotation2D< Scalar > Rotation

Public Member Functions

void init (const GlobalPoint &P1, const GlobalPoint &P2, Scalar ip, Scalar curv)
void init (Scalar x1, Scalar y1, Scalar x2, Scalar y2, Scalar ip, Scalar curv)
Range operator() (Scalar radius, int charge) const
Range rangeRPhi (Scalar radius, int charge) const __attribute__((optimize(3
 ThirdHitPredictionFromInvParabola (Scalar x1, Scalar y1, Scalar x2, Scalar y2, Scalar ip, Scalar curv, Scalar tolerance)
 ThirdHitPredictionFromInvParabola (const GlobalPoint &P1, const GlobalPoint &P2, Scalar ip, Scalar curv, Scalar tolerance)
 ThirdHitPredictionFromInvParabola ()

Public Attributes

Range fast math

Private Member Functions

Scalar coeffA (Scalar impactParameter) const
Scalar coeffB (Scalar impactParameter) const
void findPointAtCurve (Scalar radius, Scalar ip, Scalar &u, Scalar &v) const
Scalar ipFromCurvature (Scalar curvature, bool pos) const
Scalar predV (Scalar u, Scalar ip) const
Point2D transform (Point2D const &p) const
Point2D transformBack (Point2D const &p) const

Private Attributes

Scalar dv
Scalar overDu
Scalar pv
Scalar su
RangeD theIpRangeMinus
RangeD theIpRangePlus
Rotation theRotation
Scalar theTolerance
Scalar u1u2

Detailed Description

Definition at line 25 of file ThirdHitPredictionFromInvParabola.h.


Member Typedef Documentation

Definition at line 32 of file ThirdHitPredictionFromInvParabola.h.

Definition at line 30 of file ThirdHitPredictionFromInvParabola.h.

Definition at line 31 of file ThirdHitPredictionFromInvParabola.h.

Definition at line 29 of file ThirdHitPredictionFromInvParabola.h.


Constructor & Destructor Documentation

ThirdHitPredictionFromInvParabola::ThirdHitPredictionFromInvParabola ( ) [inline]

Definition at line 35 of file ThirdHitPredictionFromInvParabola.h.

{}
ThirdHitPredictionFromInvParabola::ThirdHitPredictionFromInvParabola ( Scalar  x1,
Scalar  y1,
Scalar  x2,
Scalar  y2,
Scalar  ip,
Scalar  curv,
Scalar  tolerance 
) [inline]

Definition at line 36 of file ThirdHitPredictionFromInvParabola.h.

References abs, and init().

                                                     : theTolerance(tolerance)
  {
    init(x1,y1,x2,y2,ip,std::abs(curv));
  }
ThirdHitPredictionFromInvParabola::ThirdHitPredictionFromInvParabola ( const GlobalPoint P1,
const GlobalPoint P2,
Scalar  ip,
Scalar  curv,
Scalar  tolerance 
)

Definition at line 20 of file ThirdHitPredictionFromInvParabola.cc.

References abs, and init().

  : theTolerance(tolerance)
{
  init(P1,P2,ip,std::abs(curv));
}

Member Function Documentation

ThirdHitPredictionFromInvParabola::Scalar ThirdHitPredictionFromInvParabola::coeffA ( Scalar  impactParameter) const [inline, private]

Definition at line 87 of file ThirdHitPredictionFromInvParabola.h.

References trackerHits::c, overDu, pv, and u1u2.

Referenced by findPointAtCurve(), and predV().

{
  auto c = -pv*overDu;
  return c - u1u2*impactParameter;
}
ThirdHitPredictionFromInvParabola::Scalar ThirdHitPredictionFromInvParabola::coeffB ( Scalar  impactParameter) const [inline, private]

Definition at line 94 of file ThirdHitPredictionFromInvParabola.h.

References trackerHits::c, dv, overDu, and su.

Referenced by findPointAtCurve(), and predV().

{
  auto c = dv*overDu;
  return c - su*impactParameter;
}
void ThirdHitPredictionFromInvParabola::findPointAtCurve ( Scalar  radius,
Scalar  ip,
Scalar &  u,
Scalar &  v 
) const [inline, private]

Definition at line 117 of file ThirdHitPredictionFromInvParabola.h.

References a, funct::A, alpha, trackerHits::c, coeffA(), coeffB(), delta, alignCSCRings::r, mathSSE::sqrt(), and findQualityFiles::v.

Referenced by rangeRPhi().

{
  //
  // assume u=(1-alpha^2/2)/r v=alpha/r
  // solve qudratic equation neglecting aplha^4 term
  //
  Scalar A = coeffA(ip);
  Scalar B = coeffB(ip);

  // Scalar overR = 1./r;
  Scalar ipOverR = ip/r; // *overR;

  Scalar a = 0.5*B+ipOverR;
  Scalar c = -B+A*r-ipOverR;

  Scalar delta = 1-4*a*c;
  // Scalar sqrtdelta = (delta > 0) ? std::sqrt(delta) : 0.;
  Scalar sqrtdelta = std::sqrt(delta);
  //  Scalar alpha = (-1+sqrtdelta)/(2*a);
  Scalar alpha = (-2*c)/(1+sqrtdelta);

  v = alpha;  // *overR
  Scalar d2 = 1. - v*v;  // overR*overR - v*v
  // u = (d2 > 0) ? std::sqrt(d2) : 0.;
  u = std::sqrt(d2);

  // u,v not rotated! not multiplied by 1/r
}
void ThirdHitPredictionFromInvParabola::init ( const GlobalPoint P1,
const GlobalPoint P2,
Scalar  ip,
Scalar  curv 
) [inline]

Definition at line 51 of file ThirdHitPredictionFromInvParabola.h.

References PV3DBase< T, PVType, FrameType >::x(), and PV3DBase< T, PVType, FrameType >::y().

Referenced by ThirdHitPredictionFromInvParabola().

                                                                                      {
     init( P1.x(), P1.y(), P2.x(),P2.y(),ip,curv);
  }
void ThirdHitPredictionFromInvParabola::init ( Scalar  x1,
Scalar  y1,
Scalar  x2,
Scalar  y2,
Scalar  ip,
Scalar  curv 
)

Definition at line 28 of file ThirdHitPredictionFromInvParabola.cc.

References dv, PixelRecoRange< T >::intersection(), ipFromCurvature(), overDu, p1, p2, pv, PixelRecoRange< T >::sort(), su, theIpRangeMinus, theIpRangePlus, theRotation, transform(), u1u2, Basic2DVector< T >::x(), and Basic2DVector< T >::y().

                                                                                                               {
//  GlobalVector aX = GlobalVector( P2.x()-P1.x(), P2.y()-P1.y(), 0.).unit();
 
  Point2D p1(x1,y1);
  Point2D p2(x2,y2);
  theRotation = Rotation(p1);
  p1 = transform(p1);  // (1./P1.xy().mag(),0); 
  p2 = transform(p2);

 
  u1u2 = p1.x()*p2.x();
  overDu = 1./(p2.x() - p1.x());
  pv = p1.y()*p2.x() - p2.y()*p1.x();
  dv = p2.y() - p1.y();
  su = p2.x() + p1.x();

  RangeD ipRange(-ip, ip); 
  ipRange.sort();
  
  Scalar ipIntyPlus = ipFromCurvature(0.,true);
  Scalar ipCurvPlus = ipFromCurvature(curv, true);
  Scalar ipCurvMinus = ipFromCurvature(curv, false);

  
  RangeD ipRangePlus(ipIntyPlus, ipCurvPlus); ipRangePlus.sort();
  RangeD ipRangeMinus(-ipIntyPlus, ipCurvMinus); ipRangeMinus.sort();

  theIpRangePlus  = ipRangePlus.intersection(ipRange);
  theIpRangeMinus = ipRangeMinus.intersection(ipRange);
}
ThirdHitPredictionFromInvParabola::Scalar ThirdHitPredictionFromInvParabola::ipFromCurvature ( Scalar  curvature,
bool  pos 
) const [inline, private]

Definition at line 101 of file ThirdHitPredictionFromInvParabola.h.

References overDu, pv, and u1u2.

Referenced by init().

{
  Scalar overU1u2 = 1./u1u2;
  Scalar inInf = -pv*overDu*overU1u2;
  return (pos? inInf : -inInf) -curvature*overU1u2*0.5;
}
Range ThirdHitPredictionFromInvParabola::operator() ( Scalar  radius,
int  charge 
) const [inline]

Definition at line 46 of file ThirdHitPredictionFromInvParabola.h.

References rangeRPhi().

{ return rangeRPhi(radius,charge); } 
ThirdHitPredictionFromInvParabola::Scalar ThirdHitPredictionFromInvParabola::predV ( Scalar  u,
Scalar  ip 
) const [inline, private]

Definition at line 110 of file ThirdHitPredictionFromInvParabola.h.

References trackerHits::c, coeffA(), and coeffB().

{
  auto c =  -( coeffA(ip) - coeffB(ip*u) - ip*u*u);
  return c;
}
ThirdHitPredictionFromInvParabola::Range ThirdHitPredictionFromInvParabola::rangeRPhi ( Scalar  radius,
int  charge 
) const

Definition at line 62 of file ThirdHitPredictionFromInvParabola.cc.

References PixelRecoRange< T >::empty(), findPointAtCurve(), i, PixelRecoRange< T >::intersection(), PixelRecoRange< T >::max(), PixelRecoRange< T >::min(), pos, diffTwoXMLs::r1, diffTwoXMLs::r2, TkRotation2D< T >::rotateBack(), swap(), theIpRangeMinus, theIpRangePlus, theRotation, theTolerance, and findQualityFiles::v.

Referenced by operator()().

{
  bool pos =  icharge>0;

  RangeD ip = (pos) ? theIpRangePlus : theIpRangeMinus;


  //  it will vectorize with gcc 4.7 (with -O3 -fno-math-errno)
  // change sign as intersect assume -ip for negative charge...
  Scalar ipv[2]={(pos)? ip.min() : -ip.min() ,(pos)? ip.max() : -ip.max()};
  Scalar u[2], v[2];
  for (int i=0; i!=2; ++i)
    findPointAtCurve(radius,ipv[i],u[i],v[i]);

  // 
  Scalar phi1 = theRotation.rotateBack(Point2D(u[0],v[0])).barePhi();
  Scalar phi2 = phi1+(v[1]-v[0]); 
  
  if (ip.empty()) {
    Range r1(phi1*radius-theTolerance, phi1*radius+theTolerance); 
    Range r2(phi2*radius-theTolerance, phi2*radius+theTolerance); 
    return r1.intersection(r2);
  }

  if (phi2<phi1) std::swap(phi1, phi2); 
  return Range(radius*phi1-theTolerance, radius*phi2+theTolerance);
  
}
Point2D ThirdHitPredictionFromInvParabola::transform ( Point2D const &  p) const [inline, private]

Definition at line 63 of file ThirdHitPredictionFromInvParabola.h.

References Basic2DVector< T >::mag2(), TkRotation2D< T >::rotate(), and theRotation.

Referenced by init().

                                             {
    return theRotation.rotate(p)/p.mag2();
  }
Point2D ThirdHitPredictionFromInvParabola::transformBack ( Point2D const &  p) const [inline, private]

Member Data Documentation

Definition at line 74 of file ThirdHitPredictionFromInvParabola.h.

Referenced by coeffB(), and init().

Definition at line 48 of file ThirdHitPredictionFromInvParabola.h.

Definition at line 74 of file ThirdHitPredictionFromInvParabola.h.

Referenced by coeffA(), coeffB(), init(), and ipFromCurvature().

Definition at line 74 of file ThirdHitPredictionFromInvParabola.h.

Referenced by coeffA(), init(), and ipFromCurvature().

Definition at line 74 of file ThirdHitPredictionFromInvParabola.h.

Referenced by coeffB(), and init().

Definition at line 79 of file ThirdHitPredictionFromInvParabola.h.

Referenced by init(), and rangeRPhi().

Definition at line 79 of file ThirdHitPredictionFromInvParabola.h.

Referenced by init(), and rangeRPhi().

Definition at line 73 of file ThirdHitPredictionFromInvParabola.h.

Referenced by init(), rangeRPhi(), transform(), and transformBack().

Definition at line 80 of file ThirdHitPredictionFromInvParabola.h.

Referenced by rangeRPhi().

Definition at line 74 of file ThirdHitPredictionFromInvParabola.h.

Referenced by coeffA(), init(), and ipFromCurvature().