#include <ThirdHitPredictionFromCircle.h>
Classes | |
class | HelixRZ |
Public Types | |
typedef PixelRecoRange< float > | Range |
typedef Basic2DVector< Scalar > | Vector2D |
typedef Basic2DVector< float > | VectorF2D |
Public Member Functions | |
float | angle (float curvature, float radius) const |
Range | curvature (double transverseIP) const |
double | curvature (const Vector2D &thirdPoint) const |
Range | operator() (Range curvature, float radius) const |
float | phi (float curvature, float radius) const |
ThirdHitPredictionFromCircle (const GlobalPoint &P1, const GlobalPoint &P2, float tolerance) | |
double | transverseIP (const Vector2D &thirdPoint) const |
Private Member Functions | |
Scalar | invCenterOnAxis (const Vector2D &thirdPoint) const |
Private Attributes | |
Vector2D | axis |
Vector2D | center |
Scalar | delta |
Scalar | delta2 |
Vector2D | p1 |
float | theTolerance |
Friends | |
class | HelixRZ |
Definition at line 11 of file ThirdHitPredictionFromCircle.h.
typedef PixelRecoRange<float> ThirdHitPredictionFromCircle::Range |
Definition at line 15 of file ThirdHitPredictionFromCircle.h.
typedef Basic2DVector<Scalar> ThirdHitPredictionFromCircle::Vector2D |
Definition at line 16 of file ThirdHitPredictionFromCircle.h.
typedef Basic2DVector<float> ThirdHitPredictionFromCircle::VectorF2D |
Definition at line 17 of file ThirdHitPredictionFromCircle.h.
ThirdHitPredictionFromCircle::ThirdHitPredictionFromCircle | ( | const GlobalPoint & | P1, |
const GlobalPoint & | P2, | ||
float | tolerance | ||
) |
Definition at line 24 of file ThirdHitPredictionFromCircle.cc.
References axis, center, delta, delta2, diffTreeTool::diff, p1, p2, mathSSE::sqrt(), PV3DBase< T, PVType, FrameType >::x(), and PV3DBase< T, PVType, FrameType >::y().
float ThirdHitPredictionFromCircle::angle | ( | float | curvature, |
float | radius | ||
) | const |
Definition at line 59 of file ThirdHitPredictionFromCircle.cc.
References abs, axis, center, funct::cos(), delta2, alignCSCRings::e, f, Basic2DVector< T >::mag2(), FWPFMaths::sgn(), funct::sin(), funct::sqr(), and unlikely.
Referenced by MatchedHitRZCorrectionFromBending::tibMatchedHitZFixup().
{ if (unlikely(std::abs(curvature) < float(1.0e-5))) { float sin = (center * axis) / radius; return sin / clamped_sqrt(1 - sqr(sin)); } else { float radius2 = sqr(1.0f / curvature); float orthog = clamped_sqrt(radius2 - delta2); Basic2DVector<float> lcenter = Basic2DVector<float>(center) - sgn(curvature) * orthog * Basic2DVector<float>(axis); float cos = (radius2 + sqr(radius) - lcenter.mag2()) * curvature / (2 * radius); return - cos / clamped_sqrt(1.f - sqr(cos)); } }
ThirdHitPredictionFromCircle::Range ThirdHitPredictionFromCircle::curvature | ( | double | transverseIP | ) | const |
Definition at line 87 of file ThirdHitPredictionFromCircle.cc.
References abs, axis, center, constexpr, delta, delta2, alignCSCRings::e, FWPFMaths::sgn(), SMALL, funct::sqr(), mathSSE::sqrt(), swap(), tmp, transverseIP(), unlikely, Basic2DVector< T >::x(), and Basic2DVector< T >::y().
Referenced by ThirdHitPredictionFromCircle::HelixRZ::rAtZ(), and ThirdHitPredictionFromCircle::HelixRZ::zAtR().
{ // this is a mess. Use a CAS and lots of drawings to verify... transverseIP = std::abs(transverseIP); double transverseIP2 = sqr(transverseIP); double tip = axis * center; double tip2 = sqr(tip); double lip = axis.x() * center.y() - axis.y() * center.x(); double lip2 = sqr(lip); double origin = std::sqrt(tip2 + lip2); double tmp1 = lip2 + tip2 - transverseIP2; double tmp2 = 2. * (tip - transverseIP) * (tip + transverseIP); double tmp3 = 2. * delta * origin; double tmp4 = tmp1 + delta2; double tmp5 = 2. * delta * lip; // I am probably being overly careful here with border cases // but you never know what crap you might get fed // VI fixed for finiteMath double u1=0, u2=0; constexpr double SMALL = 1.0e-23; constexpr double LARGE = 1.0e23; if (unlikely(tmp4 - tmp5 < 1.0e-15)) { u1 = -SMALL; u2 = +SMALL; } else { if (unlikely(std::abs(tmp2) < 1.0e-15)) { // the denominator is zero // this means that one of the tracks will be straight // and the other can be computed from the limit of the equation double tmp = lip2 - delta2; u1 = LARGE; u2 = (sqr(0.5 * tmp) - delta2 * tip2) / (tmp * tip); if (tip < 0) std::swap(u1, u2); } else { double tmp6 = (tmp4 - tmp5) * (tmp4 + tmp5); if (unlikely(tmp6 < 1.0e-15)) { u1 = -SMALL; u2 = +SMALL; } else { double tmp7 = tmp6 > 0 ? (transverseIP * std::sqrt(tmp6) / tmp2) : 0.; double tmp8 = tip * (tmp1 - delta2) / tmp2; // the two quadratic solutions u1 = tmp8 + tmp7; u2 = tmp8 - tmp7; } } if (tmp4 <= std::abs(tmp3)) { if ((tmp3 < 0) == (tip < 0)) u2 = +SMALL; else u1 = -SMALL; } } return Range(sgn(u1) / std::sqrt(sqr(u1) + delta2), sgn(u2) / std::sqrt(sqr(u2) + delta2)); }
double ThirdHitPredictionFromCircle::curvature | ( | const Vector2D & | thirdPoint | ) | const |
Definition at line 163 of file ThirdHitPredictionFromCircle.cc.
References delta2, invCenterOnAxis(), FWPFMaths::sgn(), funct::sqr(), and mathSSE::sqrt().
ThirdHitPredictionFromCircle::Scalar ThirdHitPredictionFromCircle::invCenterOnAxis | ( | const Vector2D & | thirdPoint | ) | const [private] |
Definition at line 153 of file ThirdHitPredictionFromCircle.cc.
References a, axis, b, center, diffTreeTool::diff, Basic2DVector< T >::mag(), p1, Basic2DVector< T >::x(), and Basic2DVector< T >::y().
Referenced by curvature(), and transverseIP().
ThirdHitPredictionFromCircle::Range ThirdHitPredictionFromCircle::operator() | ( | Range | curvature, |
float | radius | ||
) | const |
Definition at line 76 of file ThirdHitPredictionFromCircle.cc.
References M_PI, phi(), theTolerance, and unlikely.
float ThirdHitPredictionFromCircle::phi | ( | float | curvature, |
float | radius | ||
) | const |
Definition at line 36 of file ThirdHitPredictionFromCircle.cc.
References abs, axis, Basic2DVector< T >::barePhi(), center, funct::cos(), delta2, alignCSCRings::e, f, M_PI, Basic2DVector< T >::mag2(), Basic2DVector< T >::phi(), CosmicsPD_Skims::radius, FWPFMaths::sgn(), funct::sqr(), mathSSE::sqrt(), and unlikely.
Referenced by operator()(), and ThirdHitPredictionFromCircle::HelixRZ::rAtZ().
{ float phi; if (unlikely(std::abs(curvature) < float(1.0e-5))) { float cos = (center * axis) / radius; phi = axis.phi() - clamped_acos(cos); } else { float sign = sgn(curvature); float radius2 = sqr(1.0f / curvature); float orthog = clamped_sqrt(radius2 - delta2); Basic2DVector<float> lcenter = Basic2DVector<float>(center) - sign * orthog * Basic2DVector<float>(axis); float rc2 = lcenter.mag2(); float cos = (rc2 + sqr(radius) - radius2) / (2.f *std:: sqrt(rc2) * radius); phi = lcenter.barePhi() + sign * clamped_acos(cos); } while(unlikely(phi >= float(M_PI))) phi -= float(2. * M_PI); while(unlikely(phi < -float(M_PI))) phi += float(2. * M_PI); return phi; }
double ThirdHitPredictionFromCircle::transverseIP | ( | const Vector2D & | thirdPoint | ) | const |
Definition at line 171 of file ThirdHitPredictionFromCircle.cc.
References abs, axis, center, delta2, alignCSCRings::e, invCenterOnAxis(), mag(), CosmicsPD_Skims::radius, funct::sqr(), mathSSE::sqrt(), and unlikely.
Referenced by curvature().
friend class HelixRZ [friend] |
Definition at line 57 of file ThirdHitPredictionFromCircle.h.
Vector2D ThirdHitPredictionFromCircle::axis [private] |
Definition at line 61 of file ThirdHitPredictionFromCircle.h.
Referenced by angle(), curvature(), ThirdHitPredictionFromCircle::HelixRZ::HelixRZ(), invCenterOnAxis(), phi(), ThirdHitPredictionFromCircle(), and transverseIP().
Vector2D ThirdHitPredictionFromCircle::center [private] |
Definition at line 61 of file ThirdHitPredictionFromCircle.h.
Referenced by angle(), curvature(), ThirdHitPredictionFromCircle::HelixRZ::HelixRZ(), invCenterOnAxis(), phi(), ThirdHitPredictionFromCircle::HelixRZ::rAtZ(), ThirdHitPredictionFromCircle(), transverseIP(), and ThirdHitPredictionFromCircle::HelixRZ::zAtR().
Scalar ThirdHitPredictionFromCircle::delta [private] |
Definition at line 62 of file ThirdHitPredictionFromCircle.h.
Referenced by curvature(), ThirdHitPredictionFromCircle::HelixRZ::HelixRZ(), ThirdHitPredictionFromCircle::HelixRZ::maxCurvature(), and ThirdHitPredictionFromCircle().
Scalar ThirdHitPredictionFromCircle::delta2 [private] |
Definition at line 62 of file ThirdHitPredictionFromCircle.h.
Referenced by angle(), curvature(), ThirdHitPredictionFromCircle::HelixRZ::HelixRZ(), phi(), ThirdHitPredictionFromCircle(), and transverseIP().
Vector2D ThirdHitPredictionFromCircle::p1 [private] |
Definition at line 61 of file ThirdHitPredictionFromCircle.h.
Referenced by invCenterOnAxis(), and ThirdHitPredictionFromCircle().
float ThirdHitPredictionFromCircle::theTolerance [private] |
Definition at line 63 of file ThirdHitPredictionFromCircle.h.
Referenced by operator()().