CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Static Public Member Functions | Private Attributes
HelixBarrelPlaneCrossing2OrderLocal Class Reference

#include <HelixBarrelPlaneCrossing2OrderLocal.h>

Public Types

typedef Surface::GlobalPoint GlobalPoint
 
typedef Surface::GlobalVector GlobalVector
 
typedef Surface::LocalPoint LocalPoint
 
typedef Surface::LocalVector LocalVector
 

Public Member Functions

LocalVector direction () const
 
 HelixBarrelPlaneCrossing2OrderLocal (const GlobalPoint &startingPos, const GlobalVector &startingDir, float rho, const Plane &plane)
 
LocalPoint position () const
 

Static Public Member Functions

static LocalPoint positionOnly (const GlobalPoint &startingPos, const GlobalVector &startingDir, float rho, const Plane &plane)
 

Private Attributes

LocalVector theDir
 
LocalPoint thePos
 

Detailed Description

Calculates an approximate crossing of a helix and a barrel plane. The helix circle is approximated with a parabola. The current class name is misleading, since it does not have the HelixPlaneCrossing interface.

Definition at line 12 of file HelixBarrelPlaneCrossing2OrderLocal.h.

Member Typedef Documentation

Definition at line 15 of file HelixBarrelPlaneCrossing2OrderLocal.h.

Definition at line 16 of file HelixBarrelPlaneCrossing2OrderLocal.h.

Definition at line 17 of file HelixBarrelPlaneCrossing2OrderLocal.h.

Definition at line 18 of file HelixBarrelPlaneCrossing2OrderLocal.h.

Constructor & Destructor Documentation

HelixBarrelPlaneCrossing2OrderLocal::HelixBarrelPlaneCrossing2OrderLocal ( const GlobalPoint startingPos,
const GlobalVector startingDir,
float  rho,
const Plane plane 
)

Definition at line 6 of file HelixBarrelPlaneCrossing2OrderLocal.cc.

References funct::abs(), ztail::d, dir, f, theDir, thePos, toLocal(), x, PV3DBase< T, PVType, FrameType >::x(), y, PV3DBase< T, PVType, FrameType >::y(), Basic2DVector< T >::y(), and PV3DBase< T, PVType, FrameType >::z().

9 {
10 
12 
13  // translate problem to local frame of the plane
14  Plane::ToLocal toLocal(plane);
15  LocalPoint lPos = toLocal.toLocal(startingPos);
16  LocalVector lDir = toLocal.toLocal(startingDir);
17 
18  // check if local frame is already special (local Y axis == global Z axis)
19  LocalVector yPrime = toLocal.toLocal( GlobalVector(0,0,1.f));
20  // LocalVector diff = yPrime - LocalVector(0,-1.f,0);
21  float sinPhi=0, cosPhi=0;
22  bool rotated;
23  Vector2D pos;
24  Vector2D dir;
25 
26  if ( std::abs(yPrime.y()) > 0.9999f ) {
27 
28  // cout << "Plane already oriented, yPrime = " << yPrime << endl;
29 
30  // we are already in the special orientation
31  pos = Vector2D( lPos.x(), lPos.y());
32  dir = Vector2D( lDir.x(), lDir.y());;
33  rotated = false;
34  }
35  else {
36 
37  // cout << "Plane needs rotation, yPrime = " << yPrime << endl;
38 
39  // we need to rotate the problem
40  sinPhi = yPrime.y();
41  cosPhi = yPrime.x();
42  pos = Vector2D( lPos.x()*cosPhi + lPos.y()*sinPhi,
43  -lPos.x()*sinPhi + lPos.y()*cosPhi);
44  dir = Vector2D( lDir.x()*cosPhi + lDir.y()*sinPhi,
45  -lDir.x()*sinPhi + lDir.y()*cosPhi);
46  rotated = true;
47  }
48 
49  float d = -lPos.z();
50  float x = pos.x() + dir.x()/lDir.z()*d - 0.5f*rho*d*d;
51  float y = pos.y() + dir.y()/lDir.z()*d;
52 
53 // cout << "d= " << d << ", pos.x()= " << pos.x()
54 // << ", dir.x()/lDir.z()= " << dir.x()/lDir.z()
55 // << ", 0.5*rho*d*d= " << 0.5*rho*d*d << endl;
56 
57  if (!rotated) {
58  thePos = LocalPoint( x, y, 0);
59  theDir = LocalVector( dir.x()+rho*d, dir.y(), lDir.z());
60  }
61  else {
62  thePos = LocalPoint( x*cosPhi - y*sinPhi,
63  x*sinPhi + y*cosPhi, 0);
64  float px = dir.x()+rho*d;
65  theDir = LocalVector( px*cosPhi - dir.y()*sinPhi,
66  px*sinPhi + dir.y()*cosPhi, lDir.z());
67  }
68 }
T y() const
Definition: PV3DBase.h:63
LocalVector toLocal(const reco::Track::Vector &v, const Surface &s)
tuple d
Definition: ztail.py:151
Basic2DVector< double >::MathVector Vector2D
Definition: LinkByRecHit.cc:7
T z() const
Definition: PV3DBase.h:64
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double f[11][100]
dbl *** dir
Definition: mlp_gen.cc:35
T x() const
Definition: PV3DBase.h:62

Member Function Documentation

LocalVector HelixBarrelPlaneCrossing2OrderLocal::direction ( ) const
inline

Definition at line 26 of file HelixBarrelPlaneCrossing2OrderLocal.h.

References theDir.

LocalPoint HelixBarrelPlaneCrossing2OrderLocal::position ( ) const
inline

Definition at line 25 of file HelixBarrelPlaneCrossing2OrderLocal.h.

References thePos.

LocalPoint HelixBarrelPlaneCrossing2OrderLocal::positionOnly ( const GlobalPoint startingPos,
const GlobalVector startingDir,
float  rho,
const Plane plane 
)
static

Definition at line 71 of file HelixBarrelPlaneCrossing2OrderLocal.cc.

References funct::abs(), ztail::d, dir, f, toLocal(), x, PV3DBase< T, PVType, FrameType >::x(), y, PV3DBase< T, PVType, FrameType >::y(), Basic2DVector< T >::y(), and PV3DBase< T, PVType, FrameType >::z().

74  {
75 
77 
78  // translate problem to local frame of the plane
79  Plane::ToLocal toLocal(plane);
80  LocalPoint lPos = toLocal.toLocal(startingPos);
81  LocalVector lDir = toLocal.toLocal(startingDir);
82 
83  // check if local frame is already special (local Y axis == global Z axis)
84  LocalVector yPrime = toLocal.toLocal( GlobalVector(0,0,1.f));
85  // LocalVector diff = yPrime - LocalVector(0,-1.f,0);
86  float sinPhi=0, cosPhi=0;
87  bool rotated;
88  Vector2D pos;
89  Vector2D dir;
90 
91  if ( std::abs(yPrime.y()) > 0.9999f ) {
92 
93  // cout << "Plane already oriented, yPrime = " << yPrime << endl;
94 
95  // we are already in the special orientation
96  pos = Vector2D( lPos.x(), lPos.y());
97  dir = Vector2D( lDir.x(), lDir.y());;
98  rotated = false;
99  } else {
100 
101  // cout << "Plane needs rotation, yPrime = " << yPrime << endl;
102 
103  // we need to rotate the problem
104  sinPhi = yPrime.y();
105  cosPhi = yPrime.x();
106  pos = Vector2D( lPos.x()*cosPhi + lPos.y()*sinPhi,
107  -lPos.x()*sinPhi + lPos.y()*cosPhi);
108  dir = Vector2D( lDir.x()*cosPhi + lDir.y()*sinPhi,
109  -lDir.x()*sinPhi + lDir.y()*cosPhi);
110  rotated = true;
111  }
112 
113  float d = -lPos.z();
114  float x = pos.x() + dir.x()/lDir.z()*d - 0.5f*rho*d*d;
115  float y = pos.y() + dir.y()/lDir.z()*d;
116 
117 // cout << "d= " << d << ", pos.x()= " << pos.x()
118 // << ", dir.x()/lDir.z()= " << dir.x()/lDir.z()
119 // << ", 0.5*rho*d*d= " << 0.5*rho*d*d << endl;
120 
121  return (!rotated) ? LocalPoint( x, y, 0) :
122  LocalPoint( x*cosPhi - y*sinPhi,
123  x*sinPhi + y*cosPhi, 0);
124 
125 
126 }
T y() const
Definition: PV3DBase.h:63
LocalVector toLocal(const reco::Track::Vector &v, const Surface &s)
tuple d
Definition: ztail.py:151
Basic2DVector< double >::MathVector Vector2D
Definition: LinkByRecHit.cc:7
T z() const
Definition: PV3DBase.h:64
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double f[11][100]
dbl *** dir
Definition: mlp_gen.cc:35
T x() const
Definition: PV3DBase.h:62

Member Data Documentation

LocalVector HelixBarrelPlaneCrossing2OrderLocal::theDir
private
LocalPoint HelixBarrelPlaneCrossing2OrderLocal::thePos
private