test
CMS 3D CMS Logo

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

virtual DirectionType direction (double s) const
 
DirectionTypeDouble directionInDouble (double s) const
 
 IterativeHelixExtrapolatorToLine (const PositionType &point, const DirectionType &direction, const float curvature, const PropagationDirection propDir=anyDirection)
 
virtual std::pair< bool, double > pathLength (const GlobalPoint &point) const
 
virtual std::pair< bool, double > pathLength (const Line &line) const
 
virtual PositionType position (double s) const
 
PositionTypeDouble positionInDouble (double s) const
 
virtual ~IterativeHelixExtrapolatorToLine ()
 

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 ( const PositionType point,
const DirectionType direction,
const float  curvature,
const PropagationDirection  propDir = anyDirection 
)

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

Definition at line 5 of file IterativeHelixExtrapolatorToLine.cc.

References AlCaHLTBitMon_ParallelJobs::p, EnergyCorrector::pt, mathSSE::sqrt(), Basic3DVector< T >::x(), Basic3DVector< T >::y(), and Basic3DVector< T >::z().

8  :
9  theX0(point.x()),
10  theY0(point.y()),
11  theZ0(point.z()),
14  thePropDir(propDir),
15  theCachedS(0),
16  theCachedDPhi(0.),
17  theCachedSDPhi(0.),
18  theCachedCDPhi(1.)
19 {
20  //
21  // Components of direction vector (with correct normalisation)
22  //
23  double px = direction.x();
24  double py = direction.y();
25  double pz = direction.z();
26  double pt = px*px+py*py;
27  double p = sqrt(pt+pz*pz);
28  pt = sqrt(pt);
29  theCosPhi0 = px/pt;
30  theSinPhi0 = py/pt;
31  theCosTheta = pz/p;
32  theSinTheta = pt/p;
33 }
T y() const
Cartesian y coordinate.
T x() const
Cartesian x coordinate.
virtual DirectionType direction(double s) const
T curvature(T InversePt, const edm::EventSetup &iSetup)
T z() const
Cartesian z coordinate.
T sqrt(T t)
Definition: SSEVec.h:18
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
virtual IterativeHelixExtrapolatorToLine::~IterativeHelixExtrapolatorToLine ( )
inlinevirtual

Definition at line 22 of file IterativeHelixExtrapolatorToLine.h.

22 {}

Member Function Documentation

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

Direction at pathlength s from the starting point.

Implements HelixLineExtrapolation.

Definition at line 183 of file IterativeHelixExtrapolatorToLine.cc.

References directionInDouble().

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

183  {
184  // use result in double precision
185 // DirectionTypeDouble dir = directionInDouble(s);
186 // return DirectionType(dir.x(),dir.y(),dir.z());
188 }
DirectionTypeDouble directionInDouble(double s) const
Basic3DVector< float > DirectionType
HelixLineExtrapolation::DirectionTypeDouble IterativeHelixExtrapolatorToLine::directionInDouble ( double  s) const

Direction at pathlength s from the starting point.

Definition at line 194 of file IterativeHelixExtrapolatorToLine.cc.

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

Referenced by direction(), and genericPathLength().

194  {
195  //
196  // Calculate delta phi (if not already available)
197  //
198  if ( s!=theCachedS ) {
199  theCachedS = s;
203  }
204 
205  if ( fabs(theCachedDPhi)>1.e-4 ) {
206  // full helix formula
208  theSinPhi0*theCachedCDPhi+theCosPhi0*theCachedSDPhi,
210  }
211  else {
212  // 1st order
214  }
215 }
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Basic3DVector< double > DirectionTypeDouble
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
DirectionTypeDouble directionInDouble(double s) const
Direction at pathlength s from the starting point in double precision.
HelixExtrapolatorToLine2Order theQuadraticSolutionFromStart
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 58 of file IterativeHelixExtrapolatorToLine.cc.

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

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

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 40 of file IterativeHelixExtrapolatorToLine.cc.

References genericPathLength().

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

40  {
41  return genericPathLength(point);
42  }
std::pair< bool, double > genericPathLength(const T &object) const
common functionality for extrapolation to line or point
std::pair< bool, double > IterativeHelixExtrapolatorToLine::pathLength ( const Line line) const
virtual

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 48 of file IterativeHelixExtrapolatorToLine.cc.

References genericPathLength().

48  {
49  return genericPathLength(line);
50  }
std::pair< bool, double > genericPathLength(const T &object) const
common functionality for extrapolation to line or point
HelixLineExtrapolation::PositionType IterativeHelixExtrapolatorToLine::position ( double  s) const
virtual

Position at pathlength s from the starting point.

Implements HelixLineExtrapolation.

Definition at line 135 of file IterativeHelixExtrapolatorToLine.cc.

References positionInDouble().

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

135  {
136  // use result in double precision
138 }
PositionTypeDouble positionInDouble(double s) const
Basic3DVector< float > PositionType
HelixLineExtrapolation::PositionTypeDouble IterativeHelixExtrapolatorToLine::positionInDouble ( double  s) const

Position at pathlength s from the starting point.

Definition at line 144 of file IterativeHelixExtrapolatorToLine.cc.

References funct::cos(), alignCSCRings::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().

144  {
145  //
146  // Calculate delta phi (if not already available)
147  //
148  if ( s!=theCachedS ) {
149  theCachedS = s;
153  }
154  //
155  // Calculate with appropriate formulation of full helix formula or with
156  // 1st order approximation.
157  //
158 // if ( fabs(theCachedDPhi)>1.e-1 ) {
159  if ( fabs(theCachedDPhi)>1.e-4 ) {
160  // "standard" helix formula
162  theY0+(theCosPhi0*(1.-theCachedCDPhi)+theSinPhi0*theCachedSDPhi)/theRho,
164  }
165 // else if ( fabs(theCachedDPhi)>theNumericalPrecision ) {
166 // // full helix formula, but avoiding (1-cos(deltaPhi)) for small angles
167 // return PositionTypeDouble(theX0+(-theSinPhi0*theCachedSDPhi*theCachedSDPhi/(1.+theCachedCDPhi)+
168 // theCosPhi0*theCachedSDPhi)/theRho,
169 // theY0+(theCosPhi0*theCachedSDPhi*theCachedSDPhi/(1.+theCachedCDPhi)+
170 // theSinPhi0*theCachedSDPhi)/theRho,
171 // theZ0+theCachedS*theCosTheta);
172 // }
173  else {
174  // Use 1st order.
176  }
177 }
PositionTypeDouble positionInDouble(double s) const
Position at pathlength s from the starting point in double precision.
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

Member Data Documentation

double IterativeHelixExtrapolatorToLine::theCachedCDPhi
mutableprivate

Definition at line 70 of file IterativeHelixExtrapolatorToLine.h.

Referenced by directionInDouble(), and positionInDouble().

double IterativeHelixExtrapolatorToLine::theCachedDPhi
mutableprivate

Definition at line 68 of file IterativeHelixExtrapolatorToLine.h.

Referenced by directionInDouble(), and positionInDouble().

double IterativeHelixExtrapolatorToLine::theCachedS
mutableprivate

Definition at line 67 of file IterativeHelixExtrapolatorToLine.h.

Referenced by directionInDouble(), and positionInDouble().

double IterativeHelixExtrapolatorToLine::theCachedSDPhi
mutableprivate

Definition at line 69 of file IterativeHelixExtrapolatorToLine.h.

Referenced by directionInDouble(), and positionInDouble().

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

Definition at line 65 of file IterativeHelixExtrapolatorToLine.h.

Referenced by genericPathLength().

HelixExtrapolatorToLine2Order IterativeHelixExtrapolatorToLine::theQuadraticSolutionFromStart
private
const double IterativeHelixExtrapolatorToLine::theRho
private
double IterativeHelixExtrapolatorToLine::theSinPhi0
private
double IterativeHelixExtrapolatorToLine::theSinTheta
private
const double IterativeHelixExtrapolatorToLine::theX0
private

Definition at line 58 of file IterativeHelixExtrapolatorToLine.h.

Referenced by genericPathLength(), and positionInDouble().

const double IterativeHelixExtrapolatorToLine::theY0
private

Definition at line 58 of file IterativeHelixExtrapolatorToLine.h.

Referenced by genericPathLength(), and positionInDouble().

const double IterativeHelixExtrapolatorToLine::theZ0
private

Definition at line 58 of file IterativeHelixExtrapolatorToLine.h.

Referenced by genericPathLength(), and positionInDouble().