CMS 3D CMS Logo

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 ThirdHitPredictionFromCirclecircle
 
Scalar curvature
 
Scalar dzdu
 
Scalar radius
 
Scalar seg
 
Scalar z1
 

Detailed Description

Definition at line 30 of file ThirdHitPredictionFromCircle.h.

Member Typedef Documentation

◆ Scalar

Definition at line 33 of file ThirdHitPredictionFromCircle.h.

◆ Vector2D

Definition at line 32 of file ThirdHitPredictionFromCircle.h.

Constructor & Destructor Documentation

◆ HelixRZ() [1/2]

ThirdHitPredictionFromCircle::HelixRZ::HelixRZ ( )
inline

Definition at line 37 of file ThirdHitPredictionFromCircle.h.

37 : circle(nullptr) {}
const ThirdHitPredictionFromCircle * circle

◆ HelixRZ() [2/2]

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(), z1, and testProducerWithPsetDescEmpty_cfi::z2.

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

◆ maxCurvature()

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

Definition at line 222 of file ThirdHitPredictionFromCircle.cc.

References ALPAKA_ACCELERATOR_NAMESPACE::brokenline::constexpr(), ThirdHitPredictionFromCircle::delta, M_PI, funct::sin(), UNLIKELY, and testProducerWithPsetDescEmpty_cfi::z2.

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
const ThirdHitPredictionFromCircle * circle
#define UNLIKELY(x)
Definition: Likely.h:21

◆ rAtZ()

ThirdHitPredictionFromCircle::HelixRZ::Scalar ThirdHitPredictionFromCircle::HelixRZ::rAtZ ( Scalar  z) const

Definition at line 262 of file ThirdHitPredictionFromCircle.cc.

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

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 }
T y() const
Cartesian y coordinate.
Basic2DVector< double >::MathVector Vector2D
Definition: LinkByRecHit.cc:7
T sqrt(T t)
Definition: SSEVec.h:23
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
ThirdHitPredictionFromCircle::Scalar Scalar
#define M_PI
T mag2() const
The vector magnitude squared. Equivalent to vec.dot(vec)
Square< F >::type sqr(const F &f)
Definition: Square.h:14
const ThirdHitPredictionFromCircle * circle
#define UNLIKELY(x)
Definition: Likely.h:21
float phi(float curvature, float radius) const
T x() const
Cartesian x coordinate.

◆ zAtR()

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(), MillePedeFileConverter_cfg::e, qcdUeDQM_cfi::lip, Basic2DVector< T >::mag2(), alignCSCRings::r, CosmicsPD_Skims::radius, funct::sqr(), mathSSE::sqrt(), qcdUeDQM_cfi::tip, testProducerWithPsetDescEmpty_cfi::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 }
T mag2() const
The vector magnitude squared. Equivalent to vec.dot(vec)
T y() const
Cartesian y coordinate.
T sqrt(T t)
Definition: SSEVec.h:23
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
ThirdHitPredictionFromCircle::Scalar Scalar
bias2_t b2[25]
Definition: b2.h:9
double b
Definition: hdecay.h:120
Square< F >::type sqr(const F &f)
Definition: Square.h:14
const ThirdHitPredictionFromCircle * circle
#define UNLIKELY(x)
Definition: Likely.h:21
T x() const
Cartesian x coordinate.

Member Data Documentation

◆ center

Vector2D ThirdHitPredictionFromCircle::HelixRZ::center
private

Definition at line 47 of file ThirdHitPredictionFromCircle.h.

Referenced by HelixRZ().

◆ circle

const ThirdHitPredictionFromCircle* ThirdHitPredictionFromCircle::HelixRZ::circle
private

Definition at line 46 of file ThirdHitPredictionFromCircle.h.

Referenced by HelixRZ().

◆ curvature

Scalar ThirdHitPredictionFromCircle::HelixRZ::curvature
private

Definition at line 48 of file ThirdHitPredictionFromCircle.h.

◆ dzdu

Scalar ThirdHitPredictionFromCircle::HelixRZ::dzdu
private

Definition at line 48 of file ThirdHitPredictionFromCircle.h.

Referenced by HelixRZ().

◆ radius

Scalar ThirdHitPredictionFromCircle::HelixRZ::radius
private

Definition at line 48 of file ThirdHitPredictionFromCircle.h.

Referenced by HelixRZ().

◆ seg

Scalar ThirdHitPredictionFromCircle::HelixRZ::seg
private

Definition at line 48 of file ThirdHitPredictionFromCircle.h.

Referenced by HelixRZ().

◆ z1

Scalar ThirdHitPredictionFromCircle::HelixRZ::z1
private

Definition at line 48 of file ThirdHitPredictionFromCircle.h.

Referenced by HelixRZ().