CMS 3D CMS Logo

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

#include <IterativeHelixExtrapolatorToLine.h>

Inheritance diagram for IterativeHelixExtrapolatorToLine:
HelixLineExtrapolation

Public Member Functions

DirectionType direction (double s) const override
 
DirectionTypeDouble directionInDouble (double s) const
 
 IterativeHelixExtrapolatorToLine (const PositionType &point, const DirectionType &direction, const float curvature, const PropagationDirection propDir=anyDirection)
 
std::pair< bool, double > pathLength (const GlobalPoint &point) const override
 
std::pair< bool, double > pathLength (const Line &line) const override
 
PositionType position (double s) const override
 
PositionTypeDouble positionInDouble (double s) const
 
 ~IterativeHelixExtrapolatorToLine () override
 
- Public Member Functions inherited from HelixLineExtrapolation
virtual ~HelixLineExtrapolation ()=default
 

Private Member Functions

template<class T >
std::pair< bool, double > genericPathLength (const T &object) const
 common functionality for extrapolation to line or point More...
 

Private Attributes

double theCachedCDPhi
 
double theCachedDPhi
 
double theCachedS
 
double theCachedSDPhi
 
double theCosPhi0
 
double theCosTheta
 
const PropagationDirection thePropDir
 
HelixExtrapolatorToLine2Order theQuadraticSolutionFromStart
 
const double theRho
 
double theSinPhi0
 
double theSinTheta
 
const double theX0
 
const double theY0
 
const double theZ0
 

Additional Inherited Members

- Public Types inherited from HelixLineExtrapolation
typedef Basic3DVector< float > DirectionType
 
typedef Basic3DVector< double > DirectionTypeDouble
 
typedef Basic3DVector< float > PositionType
 
typedef Basic3DVector< double > PositionTypeDouble
 

Detailed Description

Calculates closest approach of a helix to a line or a point by iterative use of a 2nd order expansion of the helix.

Definition at line 13 of file IterativeHelixExtrapolatorToLine.h.

Constructor & Destructor Documentation

◆ IterativeHelixExtrapolatorToLine()

IterativeHelixExtrapolatorToLine::IterativeHelixExtrapolatorToLine ( const PositionType point,
const DirectionType direction,
const float  curvature,
const PropagationDirection  propDir = anyDirection 
)

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

Definition at line 4 of file IterativeHelixExtrapolatorToLine.cc.

8  : theX0(point.x()),
9  theY0(point.y()),
10  theZ0(point.z()),
13  thePropDir(propDir),
14  theCachedS(0),
15  theCachedDPhi(0.),
16  theCachedSDPhi(0.),
17  theCachedCDPhi(1.) {
18  //
19  // Components of direction vector (with correct normalisation)
20  //
21  double px = direction.x();
22  double py = direction.y();
23  double pz = direction.z();
24  double pt = px * px + py * py;
25  double p = sqrt(pt + pz * pz);
26  pt = sqrt(pt);
27  theCosPhi0 = px / pt;
28  theSinPhi0 = py / pt;
29  theCosTheta = pz / p;
30  theSinTheta = pt / p;
31 }

References direction(), AlCaHLTBitMon_ParallelJobs::p, DiDispStaMuonMonitor_cfi::pt, multPhiCorr_741_25nsDY_cfi::px, multPhiCorr_741_25nsDY_cfi::py, mathSSE::sqrt(), theCosPhi0, theCosTheta, theSinPhi0, theSinTheta, Basic3DVector< T >::x(), Basic3DVector< T >::y(), and Basic3DVector< T >::z().

◆ ~IterativeHelixExtrapolatorToLine()

IterativeHelixExtrapolatorToLine::~IterativeHelixExtrapolatorToLine ( )
inlineoverride

Definition at line 22 of file IterativeHelixExtrapolatorToLine.h.

22 {}

Member Function Documentation

◆ direction()

HelixLineExtrapolation::DirectionType IterativeHelixExtrapolatorToLine::direction ( double  s) const
overridevirtual

Direction at pathlength s from the starting point.

Implements HelixLineExtrapolation.

Definition at line 174 of file IterativeHelixExtrapolatorToLine.cc.

174  {
175  // use result in double precision
176  // DirectionTypeDouble dir = directionInDouble(s);
177  // return DirectionType(dir.x(),dir.y(),dir.z());
179 }

References directionInDouble(), and alignCSCRings::s.

Referenced by IterativeHelixExtrapolatorToLine(), AnalyticalImpactPointExtrapolator::propagateWithHelix(), and AnalyticalTrajectoryExtrapolatorToLine::propagateWithHelix().

◆ directionInDouble()

HelixLineExtrapolation::DirectionTypeDouble IterativeHelixExtrapolatorToLine::directionInDouble ( double  s) const

Direction at pathlength s from the starting point.

Definition at line 184 of file IterativeHelixExtrapolatorToLine.cc.

184  {
185  //
186  // Calculate delta phi (if not already available)
187  //
188  if (s != theCachedS) {
189  theCachedS = s;
193  }
194 
195  if (fabs(theCachedDPhi) > 1.e-4) {
196  // full helix formula
200  } else {
201  // 1st order
203  }
204 }

References funct::cos(), HelixExtrapolatorToLine2Order::directionInDouble(), MillePedeFileConverter_cfg::e, alignCSCRings::s, funct::sin(), theCachedCDPhi, theCachedDPhi, theCachedS, theCachedSDPhi, theCosPhi0, theCosTheta, theQuadraticSolutionFromStart, theRho, theSinPhi0, and theSinTheta.

Referenced by direction(), and genericPathLength().

◆ genericPathLength()

template<class T >
std::pair< bool, double > IterativeHelixExtrapolatorToLine::genericPathLength ( const T object) const
private

common functionality for extrapolation to line or point

Definition at line 53 of file IterativeHelixExtrapolatorToLine.cc.

53  {
54  //
55  // Constants used for control of convergence
56  //
57  const int maxIterations(100);
58  //
59  // Prepare internal value of the propagation direction and position / direction vectors for iteration
60  //
64  //
65  // Prepare iterations: count and total pathlength
66  //
67  unsigned int iteration(maxIterations + 1);
68  double dSTotal(0.);
69  //
70  // Convergence criterion: maximal lateral displacement in a step < 1um
71  //
72  double maxDeltaS2 = 2 * 1.e-4 / theSinTheta / theSinTheta / fabs(theRho);
73  //
74  bool first(true);
75  while (true) {
76  //
77  // return empty solution vector if no convergence after maxIterations iterations
78  //
79  if (--iteration == 0) {
80  return std::pair<bool, double>(false, 0);
81  }
82  //
83  // Use existing second order object at first pass, create temporary object
84  // for subsequent passes.
85  //
86  std::pair<bool, double> deltaS1;
87  if (first) {
88  first = false;
89  deltaS1 = theQuadraticSolutionFromStart.pathLength(object);
90  } else {
91  HelixExtrapolatorToLine2Order linearCrossing(
92  xnew.x(), xnew.y(), xnew.z(), pnew.x(), pnew.y(), theCosTheta, theSinTheta, theRho, anyDirection);
93  deltaS1 = linearCrossing.pathLength(object);
94  }
95  if (!deltaS1.first)
96  return deltaS1;
97  //
98  // Calculate total pathlength
99  //
100  dSTotal += deltaS1.second;
101  PropagationDirection newDir = dSTotal >= 0 ? alongMomentum : oppositeToMomentum;
102  if (propDir == anyDirection) {
103  propDir = newDir;
104  } else {
105  if (newDir != propDir)
106  return std::pair<bool, double>(false, 0);
107  }
108  //
109  // Check convergence
110  //
111  if (deltaS1.second * deltaS1.second < maxDeltaS2)
112  break;
113  //
114  // Step forward by dSTotal.
115  //
116  xnew = positionInDouble(dSTotal);
117  pnew = directionInDouble(dSTotal);
118  }
119  //
120  // Return result
121  //
122  return std::pair<bool, double>(true, dSTotal);
123 }

References alongMomentum, anyDirection, directionInDouble(), dqmdumpme::first, align_cfg::iteration, HLT_2018_cff::maxIterations, oppositeToMomentum, HelixExtrapolatorToLine2Order::pathLength(), positionInDouble(), theCosPhi0, theCosTheta, thePropDir, theQuadraticSolutionFromStart, theRho, theSinPhi0, theSinTheta, theX0, theY0, theZ0, Basic3DVector< T >::x(), Basic3DVector< T >::y(), and Basic3DVector< T >::z().

Referenced by pathLength().

◆ pathLength() [1/2]

std::pair< bool, double > IterativeHelixExtrapolatorToLine::pathLength ( const GlobalPoint point) const
overridevirtual

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

Implements HelixLineExtrapolation.

Definition at line 37 of file IterativeHelixExtrapolatorToLine.cc.

37  {
38  return genericPathLength(point);
39 }

References genericPathLength(), and point.

Referenced by AnalyticalImpactPointExtrapolator::propagateWithHelix(), and AnalyticalTrajectoryExtrapolatorToLine::propagateWithHelix().

◆ pathLength() [2/2]

std::pair< bool, double > IterativeHelixExtrapolatorToLine::pathLength ( const Line line) const
overridevirtual

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

Implements HelixLineExtrapolation.

Definition at line 45 of file IterativeHelixExtrapolatorToLine.cc.

45  {
46  return genericPathLength(line);
47 }

References genericPathLength(), and mps_splice::line.

◆ position()

HelixLineExtrapolation::PositionType IterativeHelixExtrapolatorToLine::position ( double  s) const
overridevirtual

Position at pathlength s from the starting point.

Implements HelixLineExtrapolation.

Definition at line 128 of file IterativeHelixExtrapolatorToLine.cc.

128  {
129  // use result in double precision
131 }

References positionInDouble(), and alignCSCRings::s.

Referenced by AnalyticalImpactPointExtrapolator::propagateWithHelix(), and AnalyticalTrajectoryExtrapolatorToLine::propagateWithHelix().

◆ positionInDouble()

HelixLineExtrapolation::PositionTypeDouble IterativeHelixExtrapolatorToLine::positionInDouble ( double  s) const

Position at pathlength s from the starting point.

Definition at line 136 of file IterativeHelixExtrapolatorToLine.cc.

136  {
137  //
138  // Calculate delta phi (if not already available)
139  //
140  if (s != theCachedS) {
141  theCachedS = s;
145  }
146  //
147  // Calculate with appropriate formulation of full helix formula or with
148  // 1st order approximation.
149  //
150  // if ( fabs(theCachedDPhi)>1.e-1 ) {
151  if (fabs(theCachedDPhi) > 1.e-4) {
152  // "standard" helix formula
156  }
157  // else if ( fabs(theCachedDPhi)>theNumericalPrecision ) {
158  // // full helix formula, but avoiding (1-cos(deltaPhi)) for small angles
159  // return PositionTypeDouble(theX0+(-theSinPhi0*theCachedSDPhi*theCachedSDPhi/(1.+theCachedCDPhi)+
160  // theCosPhi0*theCachedSDPhi)/theRho,
161  // theY0+(theCosPhi0*theCachedSDPhi*theCachedSDPhi/(1.+theCachedCDPhi)+
162  // theSinPhi0*theCachedSDPhi)/theRho,
163  // theZ0+theCachedS*theCosTheta);
164  // }
165  else {
166  // Use 1st order.
168  }
169 }

References funct::cos(), MillePedeFileConverter_cfg::e, HelixExtrapolatorToLine2Order::positionInDouble(), alignCSCRings::s, funct::sin(), theCachedCDPhi, theCachedDPhi, theCachedS, theCachedSDPhi, theCosPhi0, theCosTheta, theQuadraticSolutionFromStart, theRho, theSinPhi0, theSinTheta, theX0, theY0, and theZ0.

Referenced by genericPathLength(), and position().

Member Data Documentation

◆ theCachedCDPhi

double IterativeHelixExtrapolatorToLine::theCachedCDPhi
mutableprivate

Definition at line 70 of file IterativeHelixExtrapolatorToLine.h.

Referenced by directionInDouble(), and positionInDouble().

◆ theCachedDPhi

double IterativeHelixExtrapolatorToLine::theCachedDPhi
mutableprivate

Definition at line 68 of file IterativeHelixExtrapolatorToLine.h.

Referenced by directionInDouble(), and positionInDouble().

◆ theCachedS

double IterativeHelixExtrapolatorToLine::theCachedS
mutableprivate

Definition at line 67 of file IterativeHelixExtrapolatorToLine.h.

Referenced by directionInDouble(), and positionInDouble().

◆ theCachedSDPhi

double IterativeHelixExtrapolatorToLine::theCachedSDPhi
mutableprivate

Definition at line 69 of file IterativeHelixExtrapolatorToLine.h.

Referenced by directionInDouble(), and positionInDouble().

◆ theCosPhi0

double IterativeHelixExtrapolatorToLine::theCosPhi0
private

◆ theCosTheta

double IterativeHelixExtrapolatorToLine::theCosTheta
private

◆ thePropDir

const PropagationDirection IterativeHelixExtrapolatorToLine::thePropDir
private

Definition at line 65 of file IterativeHelixExtrapolatorToLine.h.

Referenced by genericPathLength().

◆ theQuadraticSolutionFromStart

HelixExtrapolatorToLine2Order IterativeHelixExtrapolatorToLine::theQuadraticSolutionFromStart
private

◆ theRho

const double IterativeHelixExtrapolatorToLine::theRho
private

◆ theSinPhi0

double IterativeHelixExtrapolatorToLine::theSinPhi0
private

◆ theSinTheta

double IterativeHelixExtrapolatorToLine::theSinTheta
private

◆ theX0

const double IterativeHelixExtrapolatorToLine::theX0
private

Definition at line 58 of file IterativeHelixExtrapolatorToLine.h.

Referenced by genericPathLength(), and positionInDouble().

◆ theY0

const double IterativeHelixExtrapolatorToLine::theY0
private

Definition at line 58 of file IterativeHelixExtrapolatorToLine.h.

Referenced by genericPathLength(), and positionInDouble().

◆ theZ0

const double IterativeHelixExtrapolatorToLine::theZ0
private

Definition at line 58 of file IterativeHelixExtrapolatorToLine.h.

Referenced by genericPathLength(), and positionInDouble().

IterativeHelixExtrapolatorToLine::theCosPhi0
double theCosPhi0
Definition: IterativeHelixExtrapolatorToLine.h:59
anyDirection
Definition: PropagationDirection.h:4
IterativeHelixExtrapolatorToLine::theCachedSDPhi
double theCachedSDPhi
Definition: IterativeHelixExtrapolatorToLine.h:69
IterativeHelixExtrapolatorToLine::theCachedS
double theCachedS
Definition: IterativeHelixExtrapolatorToLine.h:67
DiDispStaMuonMonitor_cfi.pt
pt
Definition: DiDispStaMuonMonitor_cfi.py:39
multPhiCorr_741_25nsDY_cfi.py
py
Definition: multPhiCorr_741_25nsDY_cfi.py:12
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
HelixExtrapolatorToLine2Order::directionInDouble
DirectionTypeDouble directionInDouble(double s) const
Direction at pathlength s from the starting point in double precision.
Definition: HelixExtrapolatorToLine2Order.cc:217
IterativeHelixExtrapolatorToLine::theCachedCDPhi
double theCachedCDPhi
Definition: IterativeHelixExtrapolatorToLine.h:70
oppositeToMomentum
Definition: PropagationDirection.h:4
PixelRecoUtilities::curvature
T curvature(T InversePt, const edm::EventSetup &iSetup)
Definition: PixelRecoUtilities.h:42
dqmdumpme.first
first
Definition: dqmdumpme.py:55
HelixExtrapolatorToLine2Order
Definition: HelixExtrapolatorToLine2Order.h:11
IterativeHelixExtrapolatorToLine::theCosTheta
double theCosTheta
Definition: IterativeHelixExtrapolatorToLine.h:60
IterativeHelixExtrapolatorToLine::theQuadraticSolutionFromStart
HelixExtrapolatorToLine2Order theQuadraticSolutionFromStart
Definition: IterativeHelixExtrapolatorToLine.h:63
funct::sin
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
alignCSCRings.s
s
Definition: alignCSCRings.py:92
Basic3DVector::y
T y() const
Cartesian y coordinate.
Definition: extBasic3DVector.h:97
funct::cos
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
IterativeHelixExtrapolatorToLine::theCachedDPhi
double theCachedDPhi
Definition: IterativeHelixExtrapolatorToLine.h:68
IterativeHelixExtrapolatorToLine::directionInDouble
DirectionTypeDouble directionInDouble(double s) const
Definition: IterativeHelixExtrapolatorToLine.cc:184
IterativeHelixExtrapolatorToLine::theZ0
const double theZ0
Definition: IterativeHelixExtrapolatorToLine.h:58
HelixLineExtrapolation::PositionType
Basic3DVector< float > PositionType
Definition: HelixLineExtrapolation.h:22
IterativeHelixExtrapolatorToLine::thePropDir
const PropagationDirection thePropDir
Definition: IterativeHelixExtrapolatorToLine.h:65
HelixLineExtrapolation::DirectionType
Basic3DVector< float > DirectionType
Definition: HelixLineExtrapolation.h:23
HelixLineExtrapolation::PositionTypeDouble
Basic3DVector< double > PositionTypeDouble
Definition: HelixLineExtrapolation.h:24
IterativeHelixExtrapolatorToLine::theX0
const double theX0
Definition: IterativeHelixExtrapolatorToLine.h:58
IterativeHelixExtrapolatorToLine::theSinTheta
double theSinTheta
Definition: IterativeHelixExtrapolatorToLine.h:60
IterativeHelixExtrapolatorToLine::theSinPhi0
double theSinPhi0
Definition: IterativeHelixExtrapolatorToLine.h:59
multPhiCorr_741_25nsDY_cfi.px
px
Definition: multPhiCorr_741_25nsDY_cfi.py:10
HLT_2018_cff.maxIterations
maxIterations
Definition: HLT_2018_cff.py:11849
IterativeHelixExtrapolatorToLine::genericPathLength
std::pair< bool, double > genericPathLength(const T &object) const
common functionality for extrapolation to line or point
Definition: IterativeHelixExtrapolatorToLine.cc:53
PropagationDirection
PropagationDirection
Definition: PropagationDirection.h:4
IterativeHelixExtrapolatorToLine::direction
DirectionType direction(double s) const override
Definition: IterativeHelixExtrapolatorToLine.cc:174
IterativeHelixExtrapolatorToLine::theRho
const double theRho
Definition: IterativeHelixExtrapolatorToLine.h:61
Basic3DVector::x
T x() const
Cartesian x coordinate.
Definition: extBasic3DVector.h:94
HelixExtrapolatorToLine2Order::pathLength
std::pair< bool, double > pathLength(const GlobalPoint &point) const override
Definition: HelixExtrapolatorToLine2Order.cc:28
HelixLineExtrapolation::DirectionTypeDouble
Basic3DVector< double > DirectionTypeDouble
Definition: HelixLineExtrapolation.h:25
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
mps_splice.line
line
Definition: mps_splice.py:76
align_cfg.iteration
iteration
Definition: align_cfg.py:5
Basic3DVector::z
T z() const
Cartesian z coordinate.
Definition: extBasic3DVector.h:100
IterativeHelixExtrapolatorToLine::positionInDouble
PositionTypeDouble positionInDouble(double s) const
Definition: IterativeHelixExtrapolatorToLine.cc:136
IterativeHelixExtrapolatorToLine::theY0
const double theY0
Definition: IterativeHelixExtrapolatorToLine.h:58
alongMomentum
Definition: PropagationDirection.h:4
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37
HelixExtrapolatorToLine2Order::positionInDouble
PositionTypeDouble positionInDouble(double s) const
Position at pathlength s from the starting point in double precision.
Definition: HelixExtrapolatorToLine2Order.cc:198