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 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)
 
 HelixArbitraryPlaneCrossing2Order (const PositionType &point, const DirectionType &direction, const float curvature, 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

◆ DirectionTypeDouble

Definition at line 59 of file HelixArbitraryPlaneCrossing2Order.h.

◆ PositionTypeDouble

Definition at line 58 of file HelixArbitraryPlaneCrossing2Order.h.

Constructor & Destructor Documentation

◆ HelixArbitraryPlaneCrossing2Order() [1/2]

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.

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 }

References direction(), p2, HLT_FULL_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().

◆ HelixArbitraryPlaneCrossing2Order() [2/2]

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

Fast constructor (for use by HelixArbitraryPlaneCrossing).

Definition at line 20 of file HelixArbitraryPlaneCrossing2Order.h.

29  : theX0(x0),
30  theY0(y0),
31  theZ0(z0),
32  theCosPhi0(cosPhi0),
33  theSinPhi0(sinPhi0),
34  theCosTheta(cosTheta),
35  theSinThetaI(1. / sinTheta),
36  theRho(rho),
37  thePropDir(propDir) {}

◆ ~HelixArbitraryPlaneCrossing2Order()

HelixArbitraryPlaneCrossing2Order::~HelixArbitraryPlaneCrossing2Order ( )
inlineoverride

Definition at line 40 of file HelixArbitraryPlaneCrossing2Order.h.

40 {}

Member Function Documentation

◆ direction()

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

Direction at pathlength s from the starting point.

Implements HelixPlaneCrossing.

Definition at line 114 of file HelixArbitraryPlaneCrossing2Order.cc.

114  {
115  // use double precision result
117  return DirectionType(dir.x(), dir.y(), dir.z());
118 }

References DeadROC_duringRun::dir, directionInDouble(), and alignCSCRings::s.

Referenced by HelixArbitraryPlaneCrossing2Order().

◆ directionInDouble()

HelixArbitraryPlaneCrossing2Order::DirectionTypeDouble HelixArbitraryPlaneCrossing2Order::directionInDouble ( double  s) const

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

Definition at line 122 of file HelixArbitraryPlaneCrossing2Order.cc.

123  {
124  // based on delta phi
125  double dph = s * theRho / theSinThetaI;
126  return DirectionTypeDouble(theCosPhi0 - (theSinPhi0 + 0.5 * dph * theCosPhi0) * dph,
127  theSinPhi0 + (theCosPhi0 - 0.5 * dph * theSinPhi0) * dph,
129 }

References alignCSCRings::s, theCosPhi0, theCosTheta, theRho, theSinPhi0, and theSinThetaI.

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

◆ pathLength()

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.

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 LIKELY (std::abs(ceq1) > FLT_MIN) {
58  double deq1 = ceq2 * ceq2;
59  double deq2 = ceq1 * ceq3;
60  if (std::abs(deq1) < FLT_MIN || std::abs(deq2 / deq1) > 1.e-6) {
61  //
62  // Standard solution for quadratic equations
63  //
64  double deq = deq1 + 2 * deq2;
65  if UNLIKELY (deq < 0.)
66  return std::pair<bool, double>(false, 0);
67  double ceq = ceq2 + std::copysign(std::sqrt(deq), ceq2);
68  dS1 = (ceq / ceq1) * theSinThetaI;
69  dS2 = -2. * (ceq3 / ceq) * theSinThetaI;
70  } else {
71  //
72  // Solution by expansion of sqrt(1+deq)
73  //
74  double ceq = (ceq2 / ceq1) * theSinThetaI;
75  double deq = deq2 / deq1;
76  deq *= (1 - 0.5 * deq);
77  dS1 = -ceq * deq;
78  dS2 = ceq * (2 + deq);
79  }
80  } else {
81  //
82  // Special case: linear equation
83  //
84  dS1 = dS2 = -(ceq3 / ceq2) * theSinThetaI;
85  }
86  //
87  // Choose and return solution
88  //
89  return solutionByDirection(dS1, dS2);
90 }

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(), and HelixArbitraryPlaneCrossing::pathLength().

◆ position()

HelixPlaneCrossing::PositionType HelixArbitraryPlaneCrossing2Order::position ( double  s) const
overridevirtual

Position at pathlength s from the starting point.

Implements HelixPlaneCrossing.

Definition at line 95 of file HelixArbitraryPlaneCrossing2Order.cc.

95  {
96  // use double precision result
98  return PositionType(pos.x(), pos.y(), pos.z());
99 }

References positionInDouble(), and alignCSCRings::s.

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

◆ positionInDouble()

HelixArbitraryPlaneCrossing2Order::PositionTypeDouble HelixArbitraryPlaneCrossing2Order::positionInDouble ( double  s) const

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

Definition at line 103 of file HelixArbitraryPlaneCrossing2Order.cc.

104  {
105  // based on path length in the transverse plane
106  double st = s / theSinThetaI;
107  return PositionTypeDouble(theX0 + (theCosPhi0 - (st * 0.5 * theRho) * theSinPhi0) * st,
108  theY0 + (theSinPhi0 + (st * 0.5 * theRho) * theCosPhi0) * st,
109  theZ0 + st * theCosTheta * theSinThetaI);
110 }

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

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

◆ smallestPathLength()

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

Pathlength to closest solution.

Definition at line 71 of file HelixArbitraryPlaneCrossing2Order.h.

71  {
72  return fabs(firstPathLength) < fabs(secondPathLength) ? firstPathLength : secondPathLength;
73  }

Referenced by solutionByDirection().

◆ solutionByDirection()

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 133 of file HelixArbitraryPlaneCrossing2Order.cc.

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

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

Referenced by pathLength().

Member Data Documentation

◆ theCosPhi0

double HelixArbitraryPlaneCrossing2Order::theCosPhi0
private

◆ theCosTheta

double HelixArbitraryPlaneCrossing2Order::theCosTheta
private

◆ thePropDir

const PropagationDirection HelixArbitraryPlaneCrossing2Order::thePropDir
private

Definition at line 85 of file HelixArbitraryPlaneCrossing2Order.h.

Referenced by solutionByDirection().

◆ theRho

const double HelixArbitraryPlaneCrossing2Order::theRho
private

◆ theSinPhi0

double HelixArbitraryPlaneCrossing2Order::theSinPhi0
private

◆ theSinThetaI

double HelixArbitraryPlaneCrossing2Order::theSinThetaI
private

◆ theX0

const double HelixArbitraryPlaneCrossing2Order::theX0
private

Definition at line 81 of file HelixArbitraryPlaneCrossing2Order.h.

Referenced by pathLength(), and positionInDouble().

◆ theY0

const double HelixArbitraryPlaneCrossing2Order::theY0
private

Definition at line 81 of file HelixArbitraryPlaneCrossing2Order.h.

Referenced by pathLength(), and positionInDouble().

◆ theZ0

const double HelixArbitraryPlaneCrossing2Order::theZ0
private

Definition at line 81 of file HelixArbitraryPlaneCrossing2Order.h.

Referenced by pathLength(), and positionInDouble().

Vector3DBase
Definition: Vector3DBase.h:8
anyDirection
Definition: PropagationDirection.h:4
funct::false
false
Definition: Factorize.h:29
HelixArbitraryPlaneCrossing2Order::smallestPathLength
double smallestPathLength(const double firstPathLength, const double secondPathLength) const
Definition: HelixArbitraryPlaneCrossing2Order.h:71
edm::isNotFinite
constexpr bool isNotFinite(T x)
Definition: isFinite.h:9
PV3DBase::x
T x() const
Definition: PV3DBase.h:59
multPhiCorr_741_25nsDY_cfi.py
py
Definition: multPhiCorr_741_25nsDY_cfi.py:12
HelixPlaneCrossing::DirectionType
Basic3DVector< float > DirectionType
Definition: HelixPlaneCrossing.h:23
pos
Definition: PixelAliasList.h:18
HelixArbitraryPlaneCrossing2Order::theSinThetaI
double theSinThetaI
Definition: HelixArbitraryPlaneCrossing2Order.h:83
mathSSE::return
return((rh ^ lh) &mask)
HelixArbitraryPlaneCrossing2Order::PositionTypeDouble
Basic3DVector< double > PositionTypeDouble
Definition: HelixArbitraryPlaneCrossing2Order.h:58
HelixArbitraryPlaneCrossing2Order::theY0
const double theY0
Definition: HelixArbitraryPlaneCrossing2Order.h:81
PixelRecoUtilities::curvature
T curvature(T InversePt, const edm::EventSetup &iSetup)
Definition: PixelRecoUtilities.h:42
HelixArbitraryPlaneCrossing2Order::solutionByDirection
std::pair< bool, double > solutionByDirection(const double dS1, const double dS2) const
Definition: HelixArbitraryPlaneCrossing2Order.cc:133
PV3DBase::z
T z() const
Definition: PV3DBase.h:61
UNLIKELY
#define UNLIKELY(x)
Definition: Likely.h:21
HelixArbitraryPlaneCrossing2Order::thePropDir
const PropagationDirection thePropDir
Definition: HelixArbitraryPlaneCrossing2Order.h:85
alignCSCRings.s
s
Definition: alignCSCRings.py:92
HelixArbitraryPlaneCrossing2Order::theZ0
const double theZ0
Definition: HelixArbitraryPlaneCrossing2Order.h:81
HelixArbitraryPlaneCrossing2Order::directionInDouble
DirectionTypeDouble directionInDouble(double s) const
Definition: HelixArbitraryPlaneCrossing2Order.cc:122
Basic3DVector::y
T y() const
Cartesian y coordinate.
Definition: extBasic3DVector.h:97
std::swap
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
Definition: DataFrameContainer.h:209
HelixArbitraryPlaneCrossing2Order::theRho
const double theRho
Definition: HelixArbitraryPlaneCrossing2Order.h:84
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
p2
double p2[4]
Definition: TauolaWrapper.h:90
HLTMuonOfflineAnalyzer_cfi.z0
z0
Definition: HLTMuonOfflineAnalyzer_cfi.py:98
GlobalPoint
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
HelixArbitraryPlaneCrossing2Order::theCosPhi0
double theCosPhi0
Definition: HelixArbitraryPlaneCrossing2Order.h:82
DDAxes::rho
HelixArbitraryPlaneCrossing2Order::theX0
const double theX0
Definition: HelixArbitraryPlaneCrossing2Order.h:81
HelixArbitraryPlaneCrossing2Order::DirectionTypeDouble
Basic3DVector< double > DirectionTypeDouble
Definition: HelixArbitraryPlaneCrossing2Order.h:59
Plane::localZ
float localZ(const GlobalPoint &gp) const
Definition: Plane.h:45
PV3DBase::y
T y() const
Definition: PV3DBase.h:60
HelixArbitraryPlaneCrossing2Order::theSinPhi0
double theSinPhi0
Definition: HelixArbitraryPlaneCrossing2Order.h:82
HelixArbitraryPlaneCrossing2Order::positionInDouble
PositionTypeDouble positionInDouble(double s) const
Definition: HelixArbitraryPlaneCrossing2Order.cc:103
HLT_FULL_cff.pt2
pt2
Definition: HLT_FULL_cff.py:9895
multPhiCorr_741_25nsDY_cfi.px
px
Definition: multPhiCorr_741_25nsDY_cfi.py:10
HelixArbitraryPlaneCrossing2Order::theCosTheta
double theCosTheta
Definition: HelixArbitraryPlaneCrossing2Order.h:83
std
Definition: JetResolutionObject.h:76
LIKELY
#define LIKELY(x)
Definition: Likely.h:20
Basic3DVector::x
T x() const
Cartesian x coordinate.
Definition: extBasic3DVector.h:94
HelixArbitraryPlaneCrossing2Order::direction
DirectionType direction(double s) const override
Definition: HelixArbitraryPlaneCrossing2Order.cc:114
castor_dqm_sourceclient_file_cfg.path
path
Definition: castor_dqm_sourceclient_file_cfg.py:37
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
RunInfoPI::valid
Definition: RunInfoPayloadInspectoHelper.h:16
point
*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
Basic3DVector::z
T z() const
Cartesian z coordinate.
Definition: extBasic3DVector.h:100
alongMomentum
Definition: PropagationDirection.h:4
DeadROC_duringRun.dir
dir
Definition: DeadROC_duringRun.py:23
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37
HelixPlaneCrossing::PositionType
Basic3DVector< float > PositionType
the helix is passed to the constructor and does not appear in the interface
Definition: HelixPlaneCrossing.h:22
Plane::normalVector
GlobalVector normalVector() const
Definition: Plane.h:41