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 Types | Private Attributes | Static Private Attributes
HelixForwardPlaneCrossing Class Reference

#include <HelixForwardPlaneCrossing.h>

Inheritance diagram for HelixForwardPlaneCrossing:
HelixPlaneCrossing

Public Member Functions

virtual DirectionType direction (double s) const
 
 HelixForwardPlaneCrossing (const PositionType &point, const DirectionType &direction, const float curvature, const PropagationDirection propDir=alongMomentum)
 
virtual std::pair< bool, double > pathLength (const Plane &plane)
 
virtual PositionType position (double s) const
 
virtual ~HelixForwardPlaneCrossing ()
 

Private Types

typedef Basic3DVector< double > DirectionTypeDouble
 
typedef Basic3DVector< double > PositionTypeDouble
 

Private Attributes

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

Static Private Attributes

static const float theNumericalPrecision = 5.e-7
 

Additional Inherited Members

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

Detailed Description

Calculates intersections of a helix with planes perpendicular to the z-axis.

Definition at line 10 of file HelixForwardPlaneCrossing.h.

Member Typedef Documentation

Definition at line 39 of file HelixForwardPlaneCrossing.h.

Definition at line 38 of file HelixForwardPlaneCrossing.h.

Constructor & Destructor Documentation

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

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

Definition at line 7 of file HelixForwardPlaneCrossing.cc.

References p2, mathSSE::sqrt(), theCosPhi0, theCosTheta, theSinPhi0, theSinTheta, Basic3DVector< T >::x(), Basic3DVector< T >::y(), and Basic3DVector< T >::z().

10  :
11  theX0(point.x()),
12  theY0(point.y()),
13  theZ0(point.z()),
15  thePropDir(propDir),
16  theCachedS(0),
17  theCachedDPhi(0.),
18  theCachedSDPhi(0.),
19  theCachedCDPhi(1.)
20 {
21  //
22  // Components of direction vector (with correct normalisation)
23  //
24  double px = direction.x();
25  double py = direction.y();
26  double pz = direction.z();
27  double pt2 = px*px+py*py;
28  double p2 = pt2+pz*pz;
29  double pI = 1./sqrt(p2);
30  double ptI = 1./sqrt(pt2);
31  theCosPhi0 = px*ptI;
32  theSinPhi0 = py*ptI;
33  theCosTheta = pz*pI;
34  theSinTheta = pt2*ptI*pI;
35 
36 }
T y() const
Cartesian y coordinate.
T x() const
Cartesian x coordinate.
T curvature(T InversePt, const edm::EventSetup &iSetup)
T z() const
Cartesian z coordinate.
T sqrt(T t)
Definition: SSEVec.h:46
double p2[4]
Definition: TauolaWrapper.h:90
virtual DirectionType direction(double s) const
const PropagationDirection thePropDir
*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 HelixForwardPlaneCrossing::~HelixForwardPlaneCrossing ( )
inlinevirtual

Definition at line 19 of file HelixForwardPlaneCrossing.h.

19 {}

Member Function Documentation

HelixPlaneCrossing::DirectionType HelixForwardPlaneCrossing::direction ( double  s) const
virtual

Direction at pathlength s from the starting point.

Implements HelixPlaneCrossing.

Definition at line 94 of file HelixForwardPlaneCrossing.cc.

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

94  {
95  //
96  // Calculate delta phi (if not already available)
97  //
98  if ( s!=theCachedS ) {
99  theCachedS = s;
103  }
104 
105  if ( fabs(theCachedDPhi)>1.e-4 ) {
106  // full helix formula
108  theSinPhi0*theCachedCDPhi+theCosPhi0*theCachedSDPhi,
110  }
111  else {
112  // 2nd order
113  double dph = theCachedS*theRho*theSinTheta;
114  return DirectionType(theCosPhi0-(theSinPhi0+0.5*theCosPhi0*dph)*dph,
115  theSinPhi0+(theCosPhi0-0.5*theSinPhi0*dph)*dph,
116  theCosTheta/theSinTheta);
117  }
118 }
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Basic3DVector< float > DirectionType
std::pair< bool, double > HelixForwardPlaneCrossing::pathLength ( const Plane plane)
virtual

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

Implements HelixPlaneCrossing.

Definition at line 41 of file HelixForwardPlaneCrossing.cc.

References abs, alongMomentum, oppositeToMomentum, GloballyPositioned< T >::position(), theCosTheta, thePropDir, theSinTheta, theZ0, and Basic3DVector< T >::z().

41  {
42  //
43  // Protect against p_z=0 and calculate path length
44  //
45  if ( std::abs(theCosTheta/theSinTheta)<FLT_MIN ) return std::pair<bool,double>(false,0);
46 
47  double dS = (plane.position().z()-theZ0) / theCosTheta;
48 
49  if ( (thePropDir==alongMomentum && dS<0.) ||
50  (thePropDir==oppositeToMomentum && dS>0.) ) return std::pair<bool,double>(false,0);
51  //
52  // Return result
53  //
54  return std::pair<bool,double>(true,dS);
55 }
#define abs(x)
Definition: mlp_lapack.h:159
T z() const
Cartesian z coordinate.
const PropagationDirection thePropDir
const PositionType & position() const
HelixPlaneCrossing::PositionType HelixForwardPlaneCrossing::position ( double  s) const
virtual

Position at pathlength s from the starting point.

Implements HelixPlaneCrossing.

Definition at line 60 of file HelixForwardPlaneCrossing.cc.

References abs, funct::cos(), alignCSCRings::e, python.connectstrParser::o, alignCSCRings::s, funct::sin(), theCachedCDPhi, theCachedDPhi, theCachedS, theCachedSDPhi, theCosPhi0, theCosTheta, theRho, theSinPhi0, theSinTheta, theX0, theY0, and theZ0.

60  {
61  //
62  // Calculate delta phi (if not already available)
63  //
64  if ( s!=theCachedS ) {
65  theCachedS = s;
69  }
70  //
71  // Calculate with appropriate formulation of full helix formula or with
72  // 2nd order approximation.
73  //
74  if ( std::abs(theCachedDPhi)>1.e-4 ) {
75  // "standard" helix formula
76  // "standard" helix formula
77  double o = 1./theRho;
79  theY0+( theCosPhi0*(1.-theCachedCDPhi)+theSinPhi0*theCachedSDPhi)*o,
81  }
82  else {
83  // 2nd order
84  double st = theCachedS*theSinTheta;
85  return PositionType(theX0+(theCosPhi0-st*0.5*theRho*theSinPhi0)*st,
86  theY0+(theSinPhi0+st*0.5*theRho*theCosPhi0)*st,
87  theZ0+st*theCosTheta/theSinTheta);
88  }
89 }
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
#define abs(x)
Definition: mlp_lapack.h:159
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Basic3DVector< float > PositionType
the helix is passed to the constructor and does not appear in the interface
Basic3DVector< double > PositionTypeDouble

Member Data Documentation

double HelixForwardPlaneCrossing::theCachedCDPhi
mutableprivate

Definition at line 51 of file HelixForwardPlaneCrossing.h.

Referenced by direction(), and position().

double HelixForwardPlaneCrossing::theCachedDPhi
mutableprivate

Definition at line 49 of file HelixForwardPlaneCrossing.h.

Referenced by direction(), and position().

double HelixForwardPlaneCrossing::theCachedS
mutableprivate

Definition at line 48 of file HelixForwardPlaneCrossing.h.

Referenced by direction(), and position().

double HelixForwardPlaneCrossing::theCachedSDPhi
mutableprivate

Definition at line 50 of file HelixForwardPlaneCrossing.h.

Referenced by direction(), and position().

double HelixForwardPlaneCrossing::theCosPhi0
private

Definition at line 42 of file HelixForwardPlaneCrossing.h.

Referenced by direction(), HelixForwardPlaneCrossing(), and position().

double HelixForwardPlaneCrossing::theCosTheta
private
const float HelixForwardPlaneCrossing::theNumericalPrecision = 5.e-7
staticprivate

Definition at line 53 of file HelixForwardPlaneCrossing.h.

const PropagationDirection HelixForwardPlaneCrossing::thePropDir
private

Definition at line 46 of file HelixForwardPlaneCrossing.h.

Referenced by pathLength().

const double HelixForwardPlaneCrossing::theRho
private

Definition at line 44 of file HelixForwardPlaneCrossing.h.

Referenced by direction(), and position().

double HelixForwardPlaneCrossing::theSinPhi0
private

Definition at line 42 of file HelixForwardPlaneCrossing.h.

Referenced by direction(), HelixForwardPlaneCrossing(), and position().

double HelixForwardPlaneCrossing::theSinTheta
private
const double HelixForwardPlaneCrossing::theX0
private

Definition at line 41 of file HelixForwardPlaneCrossing.h.

Referenced by position().

const double HelixForwardPlaneCrossing::theY0
private

Definition at line 41 of file HelixForwardPlaneCrossing.h.

Referenced by position().

const double HelixForwardPlaneCrossing::theZ0
private

Definition at line 41 of file HelixForwardPlaneCrossing.h.

Referenced by pathLength(), and position().