CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Types | Public Member Functions | Static Public Member Functions | Private Attributes
ThirdHitPredictionFromCircle::HelixRZ Class Reference

#include <ThirdHitPredictionFromCircle.h>

Public Types

using Scalar = ThirdHitPredictionFromCircle::Scalar
 
using Vector2D = ThirdHitPredictionFromCircle::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 30 of file ThirdHitPredictionFromCircle.h.

Member Typedef Documentation

Definition at line 33 of file ThirdHitPredictionFromCircle.h.

Definition at line 32 of file ThirdHitPredictionFromCircle.h.

Constructor & Destructor Documentation

ThirdHitPredictionFromCircle::HelixRZ::HelixRZ ( )
inline

Definition at line 37 of file ThirdHitPredictionFromCircle.h.

37 : circle(nullptr) {}
const ThirdHitPredictionFromCircle * circle
ThirdHitPredictionFromCircle::HelixRZ::HelixRZ ( const ThirdHitPredictionFromCircle icircle,
double  iz1,
double  z2,
double  curv 
)

Definition at line 208 of file ThirdHitPredictionFromCircle.cc.

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

212  : circle(icircle), curvature(curv), radius(1. / curv), z1(iz1) {
213  Scalar orthog = sgn(curv) * clamped_sqrt(radius * radius - circle->delta2);
214  center = circle->center + orthog * circle->axis;
215 
216  Scalar absCurv = std::abs(curv);
217  seg = circle->delta;
218  seg = arc(absCurv, seg);
219  dzdu = (z2 - z1) / seg;
220 }
float sgn(float val)
Definition: FWPFMaths.cc:9
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
ThirdHitPredictionFromCircle::Scalar Scalar
const ThirdHitPredictionFromCircle * circle

Member Function Documentation

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

Definition at line 222 of file ThirdHitPredictionFromCircle.cc.

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

Referenced by PixelTripletLargeTipGenerator::hitTriplets().

225  {
226  constexpr double maxAngle = M_PI;
227  double halfAngle = (0.5 * maxAngle) * (z2 - z1) / (z3 - z1);
228  if (UNLIKELY(halfAngle <= 0.0))
229  return 0.0;
230 
231  return std::sin(halfAngle) / circle->delta;
232 }
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
#define M_PI
#define UNLIKELY(x)
Definition: Likely.h:21
ThirdHitPredictionFromCircle::HelixRZ::Scalar ThirdHitPredictionFromCircle::HelixRZ::rAtZ ( Scalar  z) const

Definition at line 262 of file ThirdHitPredictionFromCircle.cc.

References funct::abs(), c, ThirdHitPredictionFromCircle::center, ThirdHitPredictionFromCircle::curvature(), alignCSCRings::e, HLT_FULL_cff::lip, M_PI, mag2(), SiStripPI::max, AlCaHLTBitMon_ParallelJobs::p, ThirdHitPredictionFromCircle::phi(), alignCSCRings::s, sqr(), mathSSE::sqrt(), HLT_FULL_cff::tip, UNLIKELY, Basic2DVector< T >::x(), and Basic2DVector< T >::y().

262  {
263  if (UNLIKELY(std::abs(dzdu) < 1.0e-5))
264  return 99999.0;
265 
266  if (UNLIKELY(std::abs(curvature) < 1.0e-5)) {
267  Scalar tip = circle->axis * circle->p1;
268  Scalar lip = circle->axis.y() * circle->p1.x() - circle->axis.x() * circle->p1.y();
269  return std::sqrt(sqr(tip) + sqr(lip + (z - z1) / dzdu));
270  }
271 
272  // we won't go below that (see comment below)
273  Scalar minR2 = (2. * circle->center - circle->p1).mag2();
274 
275  float phi = curvature * (z - z1) / dzdu;
276 
277  if (UNLIKELY(std::abs(phi) > 2. * M_PI)) {
278  // with a helix we can get problems here - this is used to get the limits
279  // however, if phi gets large, we get into the regions where we loop back
280  // to smaller r's. The question is - do we care about these tracks?
281  // The answer is probably no: Too much pain, and the rest of the
282  // tracking won't handle looping tracks anyway.
283  // So, what we do here is to return nothing smaller than the radius
284  // than any of the two hits, i.e. the second hit, which is presumably
285  // outside of the 1st hit.
286 
287  return std::sqrt(minR2);
288  }
289 
290  Vector2D rel = circle->p1 - center;
291 
292  float c;
293  float s;
294  vdt::fast_sincosf(phi, s, c);
295 
296  Vector2D p(center.x() + c * rel.x() - s * rel.y(), center.y() + s * rel.x() + c * rel.y());
297 
298  return std::sqrt(std::max(minR2, p.mag2()));
299 }
const edm::EventSetup & c
int sqr(const T &t)
Basic2DVector< double >::MathVector Vector2D
Definition: LinkByRecHit.cc:7
T sqrt(T t)
Definition: SSEVec.h:19
T mag2() const
The vector magnitude squared. Equivalent to vec.dot(vec)
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
ThirdHitPredictionFromCircle::Scalar Scalar
T y() const
Cartesian y coordinate.
#define M_PI
const ThirdHitPredictionFromCircle * circle
#define UNLIKELY(x)
Definition: Likely.h:21
float phi(float curvature, float radius) const
T x() const
Cartesian x coordinate.
ThirdHitPredictionFromCircle::HelixRZ::Scalar ThirdHitPredictionFromCircle::HelixRZ::zAtR ( Scalar  r) const

Definition at line 234 of file ThirdHitPredictionFromCircle.cc.

References funct::abs(), b, b2, ThirdHitPredictionFromCircle::center, ThirdHitPredictionFromCircle::curvature(), alignCSCRings::e, HLT_FULL_cff::lip, Basic2DVector< T >::mag2(), CosmicsPD_Skims::radius, sqr(), mathSSE::sqrt(), HLT_FULL_cff::tip, MetAnalyzer::u1, MetAnalyzer::u2, and UNLIKELY.

234  {
235  if (UNLIKELY(std::abs(curvature) < 1.0e-5)) {
236  Scalar tip = circle->axis * circle->p1;
237  Scalar lip = circle->axis.y() * circle->p1.x() - circle->axis.x() * circle->p1.y();
238  return z1 + (std::sqrt(sqr(r) - sqr(tip)) - lip) * dzdu;
239  }
240 
241  Scalar radius2 = sqr(radius);
242 
243  Scalar b2 = center.mag2();
244  Scalar b = std::sqrt(b2);
245 
246  Scalar cos1 = 0.5 * curvature * (radius2 + b2 - sqr(r)) / b;
247  Scalar cos2 = 0.5 * curvature * (radius2 + b2 - circle->p1.mag2()) / b;
248 
249  Scalar phi1 = clamped_acos(cos1);
250  Scalar phi2 = clamped_acos(cos2);
251 
252  // more plausbility checks needed...
253  // the two circles can have two possible intersections
254  Scalar u1 = std::abs((phi1 - phi2) * radius);
255  Scalar u2 = std::abs((phi1 + phi2) * radius);
256 
257  return z1 + ((u1 >= seg && u1 < u2) ? u1 : u2) * dzdu;
258 }
int sqr(const T &t)
T sqrt(T t)
Definition: SSEVec.h:19
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
ThirdHitPredictionFromCircle::Scalar Scalar
T y() const
Cartesian y coordinate.
double b
Definition: hdecay.h:118
T mag2() const
The vector magnitude squared. Equivalent to vec.dot(vec)
const ThirdHitPredictionFromCircle * circle
#define UNLIKELY(x)
Definition: Likely.h:21
static constexpr float b2
T x() const
Cartesian x coordinate.

Member Data Documentation

Vector2D ThirdHitPredictionFromCircle::HelixRZ::center
private

Definition at line 47 of file ThirdHitPredictionFromCircle.h.

Referenced by HelixRZ().

const ThirdHitPredictionFromCircle* ThirdHitPredictionFromCircle::HelixRZ::circle
private

Definition at line 46 of file ThirdHitPredictionFromCircle.h.

Referenced by HelixRZ().

Scalar ThirdHitPredictionFromCircle::HelixRZ::curvature
private

Definition at line 48 of file ThirdHitPredictionFromCircle.h.

Scalar ThirdHitPredictionFromCircle::HelixRZ::dzdu
private

Definition at line 48 of file ThirdHitPredictionFromCircle.h.

Referenced by HelixRZ().

Scalar ThirdHitPredictionFromCircle::HelixRZ::radius
private

Definition at line 48 of file ThirdHitPredictionFromCircle.h.

Referenced by HelixRZ().

Scalar ThirdHitPredictionFromCircle::HelixRZ::seg
private

Definition at line 48 of file ThirdHitPredictionFromCircle.h.

Referenced by HelixRZ().

Scalar ThirdHitPredictionFromCircle::HelixRZ::z1
private

Definition at line 48 of file ThirdHitPredictionFromCircle.h.

Referenced by HelixRZ().