CMS 3D CMS Logo

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

◆ GlobalPoint

Definition at line 14 of file HelixBarrelPlaneCrossing2OrderLocal.h.

◆ GlobalVector

Definition at line 15 of file HelixBarrelPlaneCrossing2OrderLocal.h.

◆ LocalPoint

Definition at line 16 of file HelixBarrelPlaneCrossing2OrderLocal.h.

◆ LocalVector

Definition at line 17 of file HelixBarrelPlaneCrossing2OrderLocal.h.

Constructor & Destructor Documentation

◆ HelixBarrelPlaneCrossing2OrderLocal()

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

Definition at line 5 of file HelixBarrelPlaneCrossing2OrderLocal.cc.

References funct::abs(), l1tSlwPFPuppiJets_cfi::cosPhi, ztail::d, DeadROC_duringRun::dir, f, multPhiCorr_741_25nsDY_cfi::px, rho, l1tSlwPFPuppiJets_cfi::sinPhi, theDir, thePos, toLocal(), x, PV3DBase< T, PVType, FrameType >::x(), y, PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

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

Member Function Documentation

◆ direction()

LocalVector HelixBarrelPlaneCrossing2OrderLocal::direction ( ) const
inline

Definition at line 25 of file HelixBarrelPlaneCrossing2OrderLocal.h.

References theDir.

◆ position()

LocalPoint HelixBarrelPlaneCrossing2OrderLocal::position ( ) const
inline

Definition at line 24 of file HelixBarrelPlaneCrossing2OrderLocal.h.

References thePos.

◆ positionOnly()

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

Definition at line 61 of file HelixBarrelPlaneCrossing2OrderLocal.cc.

References funct::abs(), l1tSlwPFPuppiJets_cfi::cosPhi, ztail::d, DeadROC_duringRun::dir, f, rho, l1tSlwPFPuppiJets_cfi::sinPhi, toLocal(), x, PV3DBase< T, PVType, FrameType >::x(), y, PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

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

Member Data Documentation

◆ theDir

LocalVector HelixBarrelPlaneCrossing2OrderLocal::theDir
private

◆ thePos

LocalPoint HelixBarrelPlaneCrossing2OrderLocal::thePos
private