16 template<
class T>
inline T sqr(
T t) {
return t *
t; }
17 template<
class T>
inline T sgn(
T t) {
return std::signbit(t) ? -
T(1.) :
T(1.); }
18 template<
class T>
inline T clamped_acos(
T t)
20 template<
class T>
inline T clamped_sqrt(
T t)
26 :
p1(P1.
x(), P1.
y()), theTolerance(tolerance)
41 phi =
axis.
phi() - clamped_acos(cos);
43 float sign =
sgn(curvature);
44 float radius2 =
sqr(1.0
f / curvature);
45 float orthog = clamped_sqrt(radius2 -
delta2);
47 float rc2 = lcenter.
mag2();
48 float cos = (rc2 +
sqr(radius) - radius2) /
50 phi = lcenter.
barePhi() + sign * clamped_acos(cos);
63 return sin / clamped_sqrt(1 -
sqr(sin));
65 float radius2 =
sqr(1.0
f / curvature);
66 float orthog = clamped_sqrt(radius2 -
delta2);
69 float cos = (radius2 +
sqr(radius) - lcenter.
mag2()) *
70 curvature / (2 * radius);
71 return - cos / clamped_sqrt(1.
f -
sqr(cos));
78 float phi1 =
phi(curvature.second, radius);
79 float phi2 =
phi(curvature.first, radius);
91 transverseIP =
std::abs(transverseIP);
92 double transverseIP2 =
sqr(transverseIP);
94 double tip2 =
sqr(tip);
95 double lip =
axis.
x() * center.y() -
axis.
y() * center.x();
96 double lip2 =
sqr(lip);
99 double tmp1 = lip2 + tip2 - transverseIP2;
100 double tmp2 = 2. * (tip -
transverseIP) * (tip + transverseIP);
101 double tmp3 = 2. *
delta * origin;
102 double tmp4 = tmp1 +
delta2;
103 double tmp5 = 2. *
delta * lip;
123 u2 = (
sqr(0.5 * tmp) - delta2 * tip2) / (tmp * tip);
127 double tmp6 = (tmp4 - tmp5) * (tmp4 + tmp5);
132 double tmp7 = tmp6 > 0 ? (transverseIP *
std::sqrt(tmp6) / tmp2) : 0.;
133 double tmp8 = tip * (tmp1 -
delta2) / tmp2;
141 if ((tmp3 < 0) == (tip < 0))
158 Scalar a = diff.
y() * axis2.
x() - diff.
x() * axis2.
y();
166 double invDist2 =
sqr(invDist);
168 return sgn(invDist) * curv;
177 double dist = 1.0 / invDist;
195 if (
likely(absCurv > 1.0
e-5)) {
209 double halfAngle = (0.5 * maxAngle) * (z2 - z1) / (z3 - z1);
220 Scalar tip = circle->axis * circle->p1;
221 Scalar lip = circle->axis.y() * circle->p1.x() -
222 circle->axis.x() * circle->p1.y();
232 Scalar cos2 = 0.5 *
curvature * (radius2 + b2 - circle->p1.mag2()) / b;
234 Scalar phi1 = clamped_acos(cos1);
235 Scalar phi2 = clamped_acos(cos2);
242 return z1 + ((u1 >= seg && u1 < u2)? u1 : u2) * dzdu;
251 Scalar tip = circle->axis * circle->p1;
252 Scalar lip = circle->axis.y() * circle->p1.x() -
253 circle->axis.x() * circle->p1.y();
258 Scalar minR2 = (2. * circle->center - circle->p1).
mag2();
double transverseIP(const Vector2D &thirdPoint) const
Scalar invCenterOnAxis(const Vector2D &thirdPoint) const
Scalar zAtR(Scalar r) const
float angle(float curvature, float radius) const
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
Sin< T >::type sin(const T &t)
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
Range curvature(double transverseIP) const
T curvature(T InversePt, const edm::EventSetup &iSetup)
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
T mag2() const
The vector magnitude squared. Equivalent to vec.dot(vec)
Cos< T >::type cos(const T &t)
Abs< T >::type abs(const T &t)
ThirdHitPredictionFromCircle::Scalar Scalar
static const double SMALL
T y() const
Cartesian y coordinate.
ThirdHitPredictionFromCircle(const GlobalPoint &P1, const GlobalPoint &P2, float tolerance)
Range operator()(Range curvature, float radius) const
static double maxCurvature(const ThirdHitPredictionFromCircle *circle, double z1, double z2, double z3)
T mag2() const
The vector magnitude squared. Equivalent to vec.dot(vec)
std::vector< std::vector< double > > tmp
PixelRecoRange< float > Range
Square< F >::type sqr(const F &f)
Basic2DVector< Scalar > Vector2D
const ThirdHitPredictionFromCircle * circle
Scalar rAtZ(Scalar z) const
Geom::Phi< T > phi() const
float phi(float curvature, float radius) const
T x() const
Cartesian x coordinate.