CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes
HelixArbitraryPlaneCrossing2Order Class Referencefinal

#include <HelixArbitraryPlaneCrossing2Order.h>

Inheritance diagram for HelixArbitraryPlaneCrossing2Order:
HelixPlaneCrossing

Public Types

typedef Basic3DVector< double > DirectionTypeDouble
 
typedef Basic3DVector< double > PositionTypeDouble
 
- Public Types inherited from HelixPlaneCrossing
typedef Basic3DVector< float > DirectionType
 
typedef Basic3DVector< float > PositionType
 the helix is passed to the constructor and does not appear in the interface More...
 

Public Member Functions

DirectionType direction (double s) const override
 
DirectionTypeDouble directionInDouble (double s) const
 
 HelixArbitraryPlaneCrossing2Order (const PositionType &point, const DirectionType &direction, const float curvature, const PropagationDirection propDir=alongMomentum)
 
 HelixArbitraryPlaneCrossing2Order (const double &x0, const double &y0, const double &z0, const double &cosPhi0, const double &sinPhi0, const double &cosTheta, const double &sinTheta, const double &rho, const PropagationDirection propDir=alongMomentum)
 
std::pair< bool, double > pathLength (const Plane &) override
 
PositionType position (double s) const override
 
PositionTypeDouble positionInDouble (double s) const
 
double smallestPathLength (const double firstPathLength, const double secondPathLength) const
 
 ~HelixArbitraryPlaneCrossing2Order () override
 
- Public Member Functions inherited from HelixPlaneCrossing
virtual ~HelixPlaneCrossing ()=default
 

Private Member Functions

std::pair< bool, double > solutionByDirection (const double dS1, const double dS2) const
 

Private Attributes

double theCosPhi0
 
double theCosTheta
 
const PropagationDirection thePropDir
 
const double theRho
 
double theSinPhi0
 
double theSinThetaI
 
const double theX0
 
const double theY0
 
const double theZ0
 

Detailed Description

Calculates intersections of a helix with planes of any orientation using a parabolic approximation.

Definition at line 10 of file HelixArbitraryPlaneCrossing2Order.h.

Member Typedef Documentation

Definition at line 59 of file HelixArbitraryPlaneCrossing2Order.h.

Definition at line 58 of file HelixArbitraryPlaneCrossing2Order.h.

Constructor & Destructor Documentation

HelixArbitraryPlaneCrossing2Order::HelixArbitraryPlaneCrossing2Order ( const PositionType point,
const DirectionType direction,
const float  curvature,
const PropagationDirection  propDir = alongMomentum 
)

Constructor using point, direction and (transverse!) curvature.

Definition at line 11 of file HelixArbitraryPlaneCrossing2Order.cc.

References p2, HLT_2018_cff::pt2, multPhiCorr_741_25nsDY_cfi::px, multPhiCorr_741_25nsDY_cfi::py, mathSSE::sqrt(), theCosPhi0, theCosTheta, theSinPhi0, theSinThetaI, Basic3DVector< T >::x(), Basic3DVector< T >::y(), and Basic3DVector< T >::z().

15  : theX0(point.x()), theY0(point.y()), theZ0(point.z()), theRho(curvature), thePropDir(propDir) {
16  //
17  // Components of direction vector (with correct normalisation)
18  //
19  double px = direction.x();
20  double py = direction.y();
21  double pz = direction.z();
22  double pt2 = px * px + py * py;
23  double p2 = pt2 + pz * pz;
24  double pI = 1. / sqrt(p2);
25  double ptI = 1. / sqrt(pt2);
26  theCosPhi0 = px * ptI;
27  theSinPhi0 = py * ptI;
28  theCosTheta = pz * pI;
29  theSinThetaI = p2 * pI * ptI; // (1/(pt/p)) = p/pt = p*ptI and p = p2/p = p2*pI
30 }
T y() const
Cartesian y coordinate.
T x() const
Cartesian x coordinate.
DirectionType direction(double s) const override
T curvature(T InversePt, const edm::EventSetup &iSetup)
T z() const
Cartesian z coordinate.
T sqrt(T t)
Definition: SSEVec.h:19
double p2[4]
Definition: TauolaWrapper.h:90
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
Definition: invegas.h:5
HelixArbitraryPlaneCrossing2Order::HelixArbitraryPlaneCrossing2Order ( const double &  x0,
const double &  y0,
const double &  z0,
const double &  cosPhi0,
const double &  sinPhi0,
const double &  cosTheta,
const double &  sinTheta,
const double &  rho,
const PropagationDirection  propDir = alongMomentum 
)
inline
HelixArbitraryPlaneCrossing2Order::~HelixArbitraryPlaneCrossing2Order ( )
inlineoverride

Definition at line 40 of file HelixArbitraryPlaneCrossing2Order.h.

References direction(), pathLength(), position(), and alignCSCRings::s.

40 {}

Member Function Documentation

HelixPlaneCrossing::DirectionType HelixArbitraryPlaneCrossing2Order::direction ( double  s) const
overridevirtual

Direction at pathlength s from the starting point.

Implements HelixPlaneCrossing.

Definition at line 116 of file HelixArbitraryPlaneCrossing2Order.cc.

References DeadROC_duringRun::dir, directionInDouble(), Basic3DVector< T >::x(), Basic3DVector< T >::y(), and Basic3DVector< T >::z().

Referenced by ~HelixArbitraryPlaneCrossing2Order().

116  {
117  // use double precision result
119  return DirectionType(dir.x(), dir.y(), dir.z());
120 }
DirectionTypeDouble directionInDouble(double s) const
Basic3DVector< float > DirectionType
HelixArbitraryPlaneCrossing2Order::DirectionTypeDouble HelixArbitraryPlaneCrossing2Order::directionInDouble ( double  s) const

Direction at pathlength s from the starting point in double precision.

Definition at line 124 of file HelixArbitraryPlaneCrossing2Order.cc.

References theCosPhi0, theCosTheta, theRho, theSinPhi0, and theSinThetaI.

Referenced by direction(), and HelixArbitraryPlaneCrossing::directionInDouble().

std::pair< bool, double > HelixArbitraryPlaneCrossing2Order::pathLength ( const Plane plane)
overridevirtual

Propagation status (true if valid) and (signed) path length along the helix from the starting point to the plane. The starting point is given in the constructor.

Implements HelixPlaneCrossing.

Definition at line 35 of file HelixArbitraryPlaneCrossing2Order.cc.

References funct::abs(), MillePedeFileConverter_cfg::e, LIKELY, Plane::localZ(), Plane::normalVector(), solutionByDirection(), mathSSE::sqrt(), theCosPhi0, theCosTheta, theRho, theSinPhi0, theSinThetaI, theX0, theY0, theZ0, UNLIKELY, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by PixelForwardLayer::computeCrossings(), PixelForwardLayerPhase1::computeCrossings(), HelixArbitraryPlaneCrossing::pathLength(), and ~HelixArbitraryPlaneCrossing2Order().

35  {
36  //
37  // get local z-vector in global co-ordinates and
38  // distance to starting point
39  //
40  GlobalVector normalToPlane = plane.normalVector();
41  double nPx = normalToPlane.x();
42  double nPy = normalToPlane.y();
43  double nPz = normalToPlane.z();
44  double cP = plane.localZ(GlobalPoint(theX0, theY0, theZ0));
45  //
46  // coefficients of 2nd order equation to obtain intersection point
47  // in approximation (without curvature-related factors).
48  //
49  double ceq1 = theRho * (nPx * theSinPhi0 - nPy * theCosPhi0);
50  double ceq2 = nPx * theCosPhi0 + nPy * theSinPhi0 + nPz * theCosTheta * theSinThetaI;
51  double ceq3 = cP;
52  //
53  // Check for degeneration to linear equation (zero
54  // curvature, forward plane or direction perp. to plane)
55  //
56  double dS1, dS2;
57  if
58  LIKELY(std::abs(ceq1) > FLT_MIN) {
59  double deq1 = ceq2 * ceq2;
60  double deq2 = ceq1 * ceq3;
61  if (std::abs(deq1) < FLT_MIN || std::abs(deq2 / deq1) > 1.e-6) {
62  //
63  // Standard solution for quadratic equations
64  //
65  double deq = deq1 + 2 * deq2;
66  if
67  UNLIKELY(deq < 0.) return std::pair<bool, double>(false, 0);
68  double ceq = ceq2 + std::copysign(std::sqrt(deq), ceq2);
69  dS1 = (ceq / ceq1) * theSinThetaI;
70  dS2 = -2. * (ceq3 / ceq) * theSinThetaI;
71  } else {
72  //
73  // Solution by expansion of sqrt(1+deq)
74  //
75  double ceq = (ceq2 / ceq1) * theSinThetaI;
76  double deq = deq2 / deq1;
77  deq *= (1 - 0.5 * deq);
78  dS1 = -ceq * deq;
79  dS2 = ceq * (2 + deq);
80  }
81  }
82  else {
83  //
84  // Special case: linear equation
85  //
86  dS1 = dS2 = -(ceq3 / ceq2) * theSinThetaI;
87  }
88  //
89  // Choose and return solution
90  //
91  return solutionByDirection(dS1, dS2);
92 }
GlobalVector normalVector() const
Definition: Plane.h:41
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
T y() const
Definition: PV3DBase.h:60
float localZ(const GlobalPoint &gp) const
Definition: Plane.h:45
#define LIKELY(x)
Definition: Likely.h:20
return((rh^lh)&mask)
T sqrt(T t)
Definition: SSEVec.h:19
T z() const
Definition: PV3DBase.h:61
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::pair< bool, double > solutionByDirection(const double dS1, const double dS2) const
#define UNLIKELY(x)
Definition: Likely.h:21
T x() const
Definition: PV3DBase.h:59
HelixPlaneCrossing::PositionType HelixArbitraryPlaneCrossing2Order::position ( double  s) const
overridevirtual

Position at pathlength s from the starting point.

Implements HelixPlaneCrossing.

Definition at line 97 of file HelixArbitraryPlaneCrossing2Order.cc.

References positionInDouble(), Basic3DVector< T >::x(), Basic3DVector< T >::y(), and Basic3DVector< T >::z().

Referenced by PixelForwardLayer::computeCrossings(), PixelForwardLayerPhase1::computeCrossings(), and ~HelixArbitraryPlaneCrossing2Order().

97  {
98  // use double precision result
100  return PositionType(pos.x(), pos.y(), pos.z());
101 }
PositionTypeDouble positionInDouble(double s) const
Basic3DVector< float > PositionType
the helix is passed to the constructor and does not appear in the interface
HelixArbitraryPlaneCrossing2Order::PositionTypeDouble HelixArbitraryPlaneCrossing2Order::positionInDouble ( double  s) const

Position at pathlength s from the starting point in double precision.

Definition at line 105 of file HelixArbitraryPlaneCrossing2Order.cc.

References theCosPhi0, theCosTheta, theRho, theSinPhi0, theSinThetaI, theX0, theY0, and theZ0.

Referenced by position(), and HelixArbitraryPlaneCrossing::positionInDouble().

double HelixArbitraryPlaneCrossing2Order::smallestPathLength ( const double  firstPathLength,
const double  secondPathLength 
) const
inline

Pathlength to closest solution.

Definition at line 71 of file HelixArbitraryPlaneCrossing2Order.h.

References dso_internal, and solutionByDirection().

Referenced by solutionByDirection().

71  {
72  return fabs(firstPathLength) < fabs(secondPathLength) ? firstPathLength : secondPathLength;
73  }
std::pair< bool, double > HelixArbitraryPlaneCrossing2Order::solutionByDirection ( const double  dS1,
const double  dS2 
) const
private

Choice of one of two solutions according to the propagation direction.

Definition at line 135 of file HelixArbitraryPlaneCrossing2Order.cc.

References alongMomentum, anyDirection, edm::isNotFinite(), castor_dqm_sourceclient_file_cfg::path, indexGen::s2, smallestPathLength(), std::swap(), thePropDir, and validateGeometry_cfg::valid.

Referenced by pathLength(), and smallestPathLength().

136  {
137  bool valid = false;
138  double path = 0;
139  if (thePropDir == anyDirection) {
140  valid = true;
141  path = smallestPathLength(dS1, dS2);
142  } else {
143  // use same logic for both directions (invert if necessary)
144  double propSign = thePropDir == alongMomentum ? 1 : -1;
145  double s1(propSign * dS1);
146  double s2(propSign * dS2);
147  // sort
148  if (s1 > s2)
149  std::swap(s1, s2);
150  // choose solution (if any with positive sign)
151  if ((s1 < 0) & (s2 >= 0)) {
152  // First solution in backward direction: choose second one.
153  valid = true;
154  path = propSign * s2;
155  } else if (s1 >= 0) {
156  // First solution in forward direction: choose it (s2 is further away!).
157  valid = true;
158  path = propSign * s1;
159  }
160  }
161  if (edm::isNotFinite(path))
162  valid = false;
163  return std::pair<bool, double>(valid, path);
164 }
constexpr bool isNotFinite(T x)
Definition: isFinite.h:9
double smallestPathLength(const double firstPathLength, const double secondPathLength) const
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)

Member Data Documentation

double HelixArbitraryPlaneCrossing2Order::theCosPhi0
private
double HelixArbitraryPlaneCrossing2Order::theCosTheta
private
const PropagationDirection HelixArbitraryPlaneCrossing2Order::thePropDir
private

Definition at line 85 of file HelixArbitraryPlaneCrossing2Order.h.

Referenced by solutionByDirection().

const double HelixArbitraryPlaneCrossing2Order::theRho
private
double HelixArbitraryPlaneCrossing2Order::theSinPhi0
private
double HelixArbitraryPlaneCrossing2Order::theSinThetaI
private
const double HelixArbitraryPlaneCrossing2Order::theX0
private

Definition at line 81 of file HelixArbitraryPlaneCrossing2Order.h.

Referenced by pathLength(), and positionInDouble().

const double HelixArbitraryPlaneCrossing2Order::theY0
private

Definition at line 81 of file HelixArbitraryPlaneCrossing2Order.h.

Referenced by pathLength(), and positionInDouble().

const double HelixArbitraryPlaneCrossing2Order::theZ0
private

Definition at line 81 of file HelixArbitraryPlaneCrossing2Order.h.

Referenced by pathLength(), and positionInDouble().