CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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 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.

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

Definition at line 185 of file ThirdHitPredictionFromCircle.cc.

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

186  :
187  circle(icircle), curvature(curv), radius(1./curv), z1(iz1)
188 {
189  Scalar orthog = sgn(curv) * clamped_sqrt(radius*radius - circle->delta2);
190  center = circle->center + orthog * circle->axis;
191 
192  Scalar absCurv = std::abs(curv);
193  seg = circle->delta;
194 
195  if (likely(absCurv > 1.0e-5)) {
196  seg *= absCurv;
197  seg = seg < -1.0 ? -M_PI_2 : seg > 1.0 ? M_PI_2 : std::asin(seg);
198  seg /= absCurv;
199  }
200 
201  seg *= 2.;
202  dzdu = likely(std::abs(seg) > 1.0e-5) ? ((z2 - z1) / seg) : 99999.0;
203 }
float sgn(float val)
Definition: FWPFMaths.cc:9
#define M_PI_2
#define likely(x)
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 205 of file ThirdHitPredictionFromCircle.cc.

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

Referenced by PixelTripletLargeTipGenerator::hitTriplets().

207 {
208  constexpr double maxAngle = M_PI;
209  double halfAngle = (0.5 * maxAngle) * (z2 - z1) / (z3 - z1);
210  if (unlikely(halfAngle <= 0.0))
211  return 0.0;
212 
213  return std::sin(halfAngle) / circle->delta;
214 }
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
#define constexpr
#define unlikely(x)
#define M_PI
ThirdHitPredictionFromCircle::HelixRZ::Scalar ThirdHitPredictionFromCircle::HelixRZ::rAtZ ( Scalar  z) const

Definition at line 246 of file ThirdHitPredictionFromCircle.cc.

References funct::abs(), EnergyCorrector::c, ThirdHitPredictionFromCircle::center, funct::cos(), ThirdHitPredictionFromCircle::curvature(), alignCSCRings::e, HLT_25ns14e33_v1_cff::lip, M_PI, mag2(), bookConverter::max, AlCaHLTBitMon_ParallelJobs::p, ThirdHitPredictionFromCircle::phi(), alignCSCRings::s, funct::sin(), funct::sqr(), mathSSE::sqrt(), HLT_25ns14e33_v1_cff::tip, unlikely, Basic2DVector< T >::x(), and Basic2DVector< T >::y().

246  {
247  if (unlikely(std::abs(dzdu) < 1.0e-5))
248  return 99999.0;
249 
250  if (unlikely(std::abs(curvature) < 1.0e-5)) {
251  Scalar tip = circle->axis * circle->p1;
252  Scalar lip = circle->axis.y() * circle->p1.x() -
253  circle->axis.x() * circle->p1.y();
254  return std::sqrt(sqr(tip) + sqr(lip + (z - z1) / dzdu));
255  }
256 
257  // we won't go below that (see comment below)
258  Scalar minR2 = (2. * circle->center - circle->p1).mag2();
259 
260  float phi = curvature * (z - z1) / dzdu;
261 
262  if (unlikely(std::abs(phi) > 2. * M_PI)) {
263  // with a helix we can get problems here - this is used to get the limits
264  // however, if phi gets large, we get into the regions where we loop back
265  // to smaller r's. The question is - do we care about these tracks?
266  // The answer is probably no: Too much pain, and the rest of the
267  // tracking won't handle looping tracks anyway.
268  // So, what we do here is to return nothing smaller than the radius
269  // than any of the two hits, i.e. the second hit, which is presumably
270  // outside of the 1st hit.
271 
272  return std::sqrt(minR2);
273  }
274 
275  Vector2D rel = circle->p1 - center;
276 
277  Scalar c = std::cos(phi);
278  Scalar s = std::sin(phi);
279 
280  Vector2D p(center.x() + c * rel.x() - s * rel.y(),
281  center.y() + s * rel.x() + c * rel.y());
282 
283  return std::sqrt(std::max(minR2, p.mag2()));
284 }
ThirdHitPredictionFromCircle::Vector2D Vector2D
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
float float float z
#define unlikely(x)
T sqrt(T t)
Definition: SSEVec.h:48
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
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
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 218 of file ThirdHitPredictionFromCircle.cc.

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

218  {
219  if (unlikely(std::abs(curvature) < 1.0e-5)) {
220  Scalar tip = circle->axis * circle->p1;
221  Scalar lip = circle->axis.y() * circle->p1.x() -
222  circle->axis.x() * circle->p1.y();
223  return z1 + (std::sqrt(sqr(r) - sqr(tip)) - lip) * dzdu;
224  }
225 
226  Scalar radius2 = sqr(radius);
227 
228  Scalar b2 = center.mag2();
229  Scalar b = std::sqrt(b2);
230 
231  Scalar cos1 = 0.5 * curvature * (radius2 + b2 - sqr(r)) / b;
232  Scalar cos2 = 0.5 * curvature * (radius2 + b2 - circle->p1.mag2()) / b;
233 
234  Scalar phi1 = clamped_acos(cos1);
235  Scalar phi2 = clamped_acos(cos2);
236 
237  // more plausbility checks needed...
238  // the two circles can have two possible intersections
239  Scalar u1 = std::abs((phi1 - phi2) * radius);
240  Scalar u2 = std::abs((phi1 + phi2) * radius);
241 
242  return z1 + ((u1 >= seg && u1 < u2)? u1 : u2) * dzdu;
243 }
#define unlikely(x)
T sqrt(T t)
Definition: SSEVec.h:48
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
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().

const ThirdHitPredictionFromCircle* ThirdHitPredictionFromCircle::HelixRZ::circle
private

Definition at line 51 of file ThirdHitPredictionFromCircle.h.

Referenced by HelixRZ().

Scalar ThirdHitPredictionFromCircle::HelixRZ::curvature
private

Definition at line 53 of file ThirdHitPredictionFromCircle.h.

Scalar ThirdHitPredictionFromCircle::HelixRZ::dzdu
private

Definition at line 53 of file ThirdHitPredictionFromCircle.h.

Referenced by HelixRZ().

Scalar ThirdHitPredictionFromCircle::HelixRZ::radius
private

Definition at line 53 of file ThirdHitPredictionFromCircle.h.

Referenced by HelixRZ().

Scalar ThirdHitPredictionFromCircle::HelixRZ::seg
private

Definition at line 53 of file ThirdHitPredictionFromCircle.h.

Referenced by HelixRZ().

Scalar ThirdHitPredictionFromCircle::HelixRZ::z1
private

Definition at line 53 of file ThirdHitPredictionFromCircle.h.

Referenced by HelixRZ().