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.

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().

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 }
T x() const
Cartesian x coordinate.
T y() const
Cartesian y coordinate.
T curvature(T InversePt, const MagneticField &field)
T sqrt(T t)
Definition: SSEVec.h:19
DirectionType direction(double s) const override
T z() const
Cartesian z coordinate.
HelixExtrapolatorToLine2Order theQuadraticSolutionFromStart
*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

◆ ~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.

References directionInDouble(), and alignCSCRings::s.

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

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

◆ directionInDouble()

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

Direction at pathlength s from the starting point.

Definition at line 184 of file IterativeHelixExtrapolatorToLine.cc.

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().

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 }
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
DirectionTypeDouble directionInDouble(double s) const
Direction at pathlength s from the starting point in double precision.
Basic3DVector< double > DirectionTypeDouble
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
HelixExtrapolatorToLine2Order theQuadraticSolutionFromStart

◆ 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.

References alongMomentum, anyDirection, directionInDouble(), dqmdumpme::first, align_cfg::iteration, HLT_2023v11_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().

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 }
PositionTypeDouble positionInDouble(double s) const
Basic3DVector< double > PositionTypeDouble
PropagationDirection
Basic3DVector< double > DirectionTypeDouble
HelixExtrapolatorToLine2Order theQuadraticSolutionFromStart
std::pair< bool, double > pathLength(const GlobalPoint &point) const override
DirectionTypeDouble directionInDouble(double s) const

◆ 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.

References genericPathLength(), and point.

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

37  {
38  return genericPathLength(point);
39 }
std::pair< bool, double > genericPathLength(const T &object) const
common functionality for extrapolation to line or 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

◆ 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.

References genericPathLength(), and mps_splice::line.

45  {
46  return genericPathLength(line);
47 }
std::pair< bool, double > genericPathLength(const T &object) const
common functionality for extrapolation to line or point

◆ 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.

References positionInDouble(), and alignCSCRings::s.

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

128  {
129  // use result in double precision
131 }
PositionTypeDouble positionInDouble(double s) const
Basic3DVector< float > PositionType

◆ positionInDouble()

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

Position at pathlength s from the starting point.

Definition at line 136 of file IterativeHelixExtrapolatorToLine.cc.

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().

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 }
Basic3DVector< double > PositionTypeDouble
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
HelixExtrapolatorToLine2Order theQuadraticSolutionFromStart
PositionTypeDouble positionInDouble(double s) const
Position at pathlength s from the starting point in double precision.

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().