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 | Private Types | 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 ()
 
 HelixBarrelPlaneCrossing2OrderLocal (const GlobalPoint &startingPos, const GlobalVector &startingDir, double rho, const Plane &plane)
 
LocalPoint position () const
 

Private Types

typedef Basic2DVector< float > Vector2D
 

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.

Definition at line 32 of file HelixBarrelPlaneCrossing2OrderLocal.h.

Constructor & Destructor Documentation

HelixBarrelPlaneCrossing2OrderLocal::HelixBarrelPlaneCrossing2OrderLocal ( )
inline

Definition at line 20 of file HelixBarrelPlaneCrossing2OrderLocal.h.

20 {}
HelixBarrelPlaneCrossing2OrderLocal::HelixBarrelPlaneCrossing2OrderLocal ( const GlobalPoint startingPos,
const GlobalVector startingDir,
double  rho,
const Plane plane 
)

Definition at line 6 of file HelixBarrelPlaneCrossing2OrderLocal.cc.

References diffTreeTool::diff, dir, f, pos, theDir, thePos, GloballyPositioned< T >::toLocal(), x, PV3DBase< T, PVType, FrameType >::x(), Basic2DVector< T >::x(), detailsBasic3DVector::y, PV3DBase< T, PVType, FrameType >::y(), Basic2DVector< T >::y(), and PV3DBase< T, PVType, FrameType >::z().

9 {
10  // translate problem to local frame of the plane
11  LocalPoint lPos = plane.toLocal(startingPos);
12  LocalVector lDir = plane.toLocal(startingDir);
13 
14  // check if local frame is already special (local Y axis == global Z axis)
15  LocalVector yPrime = plane.toLocal( GlobalVector(0,0,1.f));
16  LocalVector diff = yPrime - LocalVector(0,-1.f,0);
17  float sinPhi=0, cosPhi=0;
18  bool rotated;
19  Vector2D pos;
20  Vector2D dir;
21 
22  if (diff.mag2() < 1.e-10) {
23 
24  // cout << "Plane already oriented, yPrime = " << yPrime << endl;
25 
26  // we are already in the special orientation
27  pos = Vector2D( lPos.x(), lPos.y());
28  dir = Vector2D( lDir.x(), lDir.y());;
29  rotated = false;
30  }
31  else {
32 
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,
39  -lPos.x()*sinPhi + lPos.y()*cosPhi);
40  dir = Vector2D( lDir.x()*cosPhi + lDir.y()*sinPhi,
41  -lDir.x()*sinPhi + lDir.y()*cosPhi);
42  rotated = true;
43  }
44 
45  double d = -lPos.z();
46  double x = pos.x() + dir.x()/lDir.z()*d - 0.5*rho*d*d;
47  double y = pos.y() + dir.y()/lDir.z()*d;
48 
49 // cout << "d= " << d << ", pos.x()= " << pos.x()
50 // << ", dir.x()/lDir.z()= " << dir.x()/lDir.z()
51 // << ", 0.5*rho*d*d= " << 0.5*rho*d*d << endl;
52 
53  if (!rotated) {
54  thePos = LocalPoint( x, y, 0);
55  theDir = LocalVector( dir.x()+rho*d, dir.y(), lDir.z());
56  }
57  else {
58  thePos = LocalPoint( x*cosPhi - y*sinPhi,
59  x*sinPhi + y*cosPhi, 0);
60  float px = dir.x()+rho*d;
61  theDir = LocalVector( px*cosPhi - dir.y()*sinPhi,
62  px*sinPhi + dir.y()*cosPhi, lDir.z());
63  }
64 }
T mag2() const
Definition: PV3DBase.h:66
Definition: DDAxes.h:10
T y() const
Definition: PV3DBase.h:63
LocalPoint toLocal(const GlobalPoint &gp) const
T z() const
Definition: PV3DBase.h:64
double f[11][100]
dbl *** dir
Definition: mlp_gen.cc:35
Definition: DDAxes.h:10
T x() const
Definition: PV3DBase.h:62

Member Function Documentation

LocalVector HelixBarrelPlaneCrossing2OrderLocal::direction ( ) const
inline

Definition at line 28 of file HelixBarrelPlaneCrossing2OrderLocal.h.

References theDir.

LocalPoint HelixBarrelPlaneCrossing2OrderLocal::position ( ) const
inline

Definition at line 27 of file HelixBarrelPlaneCrossing2OrderLocal.h.

References thePos.

Member Data Documentation

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