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 33 of file ThirdHitPredictionFromCircle.h.

Member Typedef Documentation

Definition at line 36 of file ThirdHitPredictionFromCircle.h.

Definition at line 35 of file ThirdHitPredictionFromCircle.h.

Constructor & Destructor Documentation

ThirdHitPredictionFromCircle::HelixRZ::HelixRZ ( )
inline

Definition at line 40 of file ThirdHitPredictionFromCircle.h.

References circle, maxCurvature(), alignCSCRings::r, rAtZ(), z, z1, and zAtR().

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

Definition at line 210 of file ThirdHitPredictionFromCircle.cc.

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

211  :
212  circle(icircle), curvature(curv), radius(1./curv), z1(iz1)
213 {
214  Scalar orthog = sgn(curv) * clamped_sqrt(radius*radius - circle->delta2);
215  center = circle->center + orthog * circle->axis;
216 
217  Scalar absCurv = std::abs(curv);
218  seg = circle->delta;
219  seg = arc(absCurv,seg);
220  dzdu = (z2 - z1) / seg;
221 }
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 223 of file ThirdHitPredictionFromCircle.cc.

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

Referenced by HelixRZ(), and 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
#define constexpr
ThirdHitPredictionFromCircle::HelixRZ::Scalar ThirdHitPredictionFromCircle::HelixRZ::rAtZ ( Scalar  z) const

Definition at line 267 of file ThirdHitPredictionFromCircle.cc.

References funct::abs(), ThirdHitPredictionFromCircle::axis, EnergyCorrector::c, center, ThirdHitPredictionFromCircle::center, circle, curvature, dzdu, MillePedeFileConverter_cfg::e, btvTracks_cfi::lip, M_PI, mag2(), SiStripPI::max, AlCaHLTBitMon_ParallelJobs::p, ThirdHitPredictionFromCircle::p1, ThirdHitPredictionFromCircle::phi(), RefreshWebPage::rel, alignCSCRings::s, funct::sqr(), mathSSE::sqrt(), btvTracks_cfi::tip, UNLIKELY, Basic2DVector< T >::x(), Basic2DVector< T >::y(), and z1.

Referenced by HelixRZ().

267  {
268  if (UNLIKELY(std::abs(dzdu) < 1.0e-5))
269  return 99999.0;
270 
271  if (UNLIKELY(std::abs(curvature) < 1.0e-5)) {
272  Scalar tip = circle->axis * circle->p1;
273  Scalar lip = circle->axis.y() * circle->p1.x() -
274  circle->axis.x() * circle->p1.y();
275  return std::sqrt(sqr(tip) + sqr(lip + (z - z1) / dzdu));
276  }
277 
278  // we won't go below that (see comment below)
279  Scalar minR2 = (2. * circle->center - circle->p1).mag2();
280 
281  float phi = curvature * (z - z1) / dzdu;
282 
283  if (UNLIKELY(std::abs(phi) > 2. * M_PI)) {
284  // with a helix we can get problems here - this is used to get the limits
285  // however, if phi gets large, we get into the regions where we loop back
286  // to smaller r's. The question is - do we care about these tracks?
287  // The answer is probably no: Too much pain, and the rest of the
288  // tracking won't handle looping tracks anyway.
289  // So, what we do here is to return nothing smaller than the radius
290  // than any of the two hits, i.e. the second hit, which is presumably
291  // outside of the 1st hit.
292 
293  return std::sqrt(minR2);
294  }
295 
296  Vector2D rel = circle->p1 - center;
297 
298  float c;
299  float s;
300  vdt::fast_sincosf(phi,s,c);
301 
302  Vector2D p(center.x() + c * rel.x() - s * rel.y(),
303  center.y() + s * rel.x() + c * rel.y());
304 
305  return std::sqrt(std::max(minR2, p.mag2()));
306 }
Basic2DVector< double >::MathVector Vector2D
Definition: LinkByRecHit.cc:7
T sqrt(T t)
Definition: SSEVec.h:18
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
Square< F >::type sqr(const F &f)
Definition: Square.h:13
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 236 of file ThirdHitPredictionFromCircle.cc.

References funct::abs(), ThirdHitPredictionFromCircle::axis, b, center, circle, curvature, dzdu, MillePedeFileConverter_cfg::e, btvTracks_cfi::lip, Basic2DVector< T >::mag2(), ThirdHitPredictionFromCircle::p1, radius, seg, funct::sqr(), mathSSE::sqrt(), btvTracks_cfi::tip, MetAnalyzer::u1, MetAnalyzer::u2, UNLIKELY, Basic2DVector< T >::x(), Basic2DVector< T >::y(), and z1.

Referenced by HelixRZ().

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

Member Data Documentation

Vector2D ThirdHitPredictionFromCircle::HelixRZ::center
private

Definition at line 52 of file ThirdHitPredictionFromCircle.h.

Referenced by HelixRZ(), rAtZ(), and zAtR().

const ThirdHitPredictionFromCircle* ThirdHitPredictionFromCircle::HelixRZ::circle
private

Definition at line 51 of file ThirdHitPredictionFromCircle.h.

Referenced by HelixRZ(), rAtZ(), and zAtR().

Scalar ThirdHitPredictionFromCircle::HelixRZ::curvature
private

Definition at line 53 of file ThirdHitPredictionFromCircle.h.

Referenced by rAtZ(), and zAtR().

Scalar ThirdHitPredictionFromCircle::HelixRZ::dzdu
private

Definition at line 53 of file ThirdHitPredictionFromCircle.h.

Referenced by HelixRZ(), rAtZ(), and zAtR().

Scalar ThirdHitPredictionFromCircle::HelixRZ::radius
private

Definition at line 53 of file ThirdHitPredictionFromCircle.h.

Referenced by HelixRZ(), and zAtR().

Scalar ThirdHitPredictionFromCircle::HelixRZ::seg
private

Definition at line 53 of file ThirdHitPredictionFromCircle.h.

Referenced by HelixRZ(), and zAtR().

Scalar ThirdHitPredictionFromCircle::HelixRZ::z1
private

Definition at line 53 of file ThirdHitPredictionFromCircle.h.

Referenced by HelixRZ(), maxCurvature(), rAtZ(), and zAtR().