#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, double rho, const Plane &plane) | |
HelixBarrelPlaneCrossing2OrderLocal () | |
LocalPoint | position () const |
Private Types | |
typedef Basic2DVector< float > | Vector2D |
Private Attributes | |
LocalVector | theDir |
LocalPoint | thePos |
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.
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.
typedef Basic2DVector<float> HelixBarrelPlaneCrossing2OrderLocal::Vector2D [private] |
Definition at line 32 of file HelixBarrelPlaneCrossing2OrderLocal.h.
HelixBarrelPlaneCrossing2OrderLocal::HelixBarrelPlaneCrossing2OrderLocal | ( | ) | [inline] |
Definition at line 20 of file HelixBarrelPlaneCrossing2OrderLocal.h.
{}
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, PV3DBase< T, PVType, FrameType >::mag2(), pos, theDir, thePos, GloballyPositioned< T >::toLocal(), PV3DBase< T, PVType, FrameType >::x(), Basic2DVector< T >::x(), x, PV3DBase< T, PVType, FrameType >::y(), Basic2DVector< T >::y(), detailsBasic3DVector::y, and PV3DBase< T, PVType, FrameType >::z().
{ // translate problem to local frame of the plane LocalPoint lPos = plane.toLocal(startingPos); LocalVector lDir = plane.toLocal(startingDir); // check if local frame is already special (local Y axis == global Z axis) LocalVector yPrime = plane.toLocal( GlobalVector(0,0,1.f)); LocalVector diff = yPrime - LocalVector(0,-1.f,0); float sinPhi=0, cosPhi=0; bool rotated; Vector2D pos; Vector2D dir; if (diff.mag2() < 1.e-10) { // cout << "Plane already oriented, yPrime = " << yPrime << endl; // we are already in the special orientation pos = Vector2D( lPos.x(), lPos.y()); dir = Vector2D( lDir.x(), lDir.y());; rotated = false; } else { // cout << "Plane needs rotation, yPrime = " << yPrime << endl; // we need to rotate the problem sinPhi = yPrime.y(); cosPhi = yPrime.x(); pos = Vector2D( lPos.x()*cosPhi + lPos.y()*sinPhi, -lPos.x()*sinPhi + lPos.y()*cosPhi); dir = Vector2D( lDir.x()*cosPhi + lDir.y()*sinPhi, -lDir.x()*sinPhi + lDir.y()*cosPhi); rotated = true; } double d = -lPos.z(); double x = pos.x() + dir.x()/lDir.z()*d - 0.5*rho*d*d; double y = pos.y() + dir.y()/lDir.z()*d; // cout << "d= " << d << ", pos.x()= " << pos.x() // << ", dir.x()/lDir.z()= " << dir.x()/lDir.z() // << ", 0.5*rho*d*d= " << 0.5*rho*d*d << endl; if (!rotated) { thePos = LocalPoint( x, y, 0); theDir = LocalVector( dir.x()+rho*d, dir.y(), lDir.z()); } else { thePos = LocalPoint( x*cosPhi - y*sinPhi, x*sinPhi + y*cosPhi, 0); float px = dir.x()+rho*d; theDir = LocalVector( px*cosPhi - dir.y()*sinPhi, px*sinPhi + dir.y()*cosPhi, lDir.z()); } }
LocalVector HelixBarrelPlaneCrossing2OrderLocal::direction | ( | ) | const [inline] |
Definition at line 28 of file HelixBarrelPlaneCrossing2OrderLocal.h.
References theDir.
{ return theDir;}
LocalPoint HelixBarrelPlaneCrossing2OrderLocal::position | ( | void | ) | const [inline] |
Definition at line 27 of file HelixBarrelPlaneCrossing2OrderLocal.h.
References thePos.
{ return thePos;}
Definition at line 35 of file HelixBarrelPlaneCrossing2OrderLocal.h.
Referenced by direction(), and HelixBarrelPlaneCrossing2OrderLocal().
Definition at line 34 of file HelixBarrelPlaneCrossing2OrderLocal.h.
Referenced by HelixBarrelPlaneCrossing2OrderLocal(), and position().