Go to the documentation of this file.00001 #include "TrackingTools/GeomPropagators/interface/HelixBarrelPlaneCrossing2OrderLocal.h"
00002 #include <algorithm>
00003 #include <cmath>
00004
00005 HelixBarrelPlaneCrossing2OrderLocal::
00006 HelixBarrelPlaneCrossing2OrderLocal( const GlobalPoint& startingPos,
00007 const GlobalVector& startingDir,
00008 double rho, const Plane& plane)
00009 {
00010
00011 LocalPoint lPos = plane.toLocal(startingPos);
00012 LocalVector lDir = plane.toLocal(startingDir);
00013
00014
00015 LocalVector yPrime = plane.toLocal( GlobalVector(0,0,1.f));
00016 LocalVector diff = yPrime - LocalVector(0,-1.f,0);
00017 float sinPhi=0, cosPhi=0;
00018 bool rotated;
00019 Vector2D pos;
00020 Vector2D dir;
00021
00022 if (diff.mag2() < 1.e-10) {
00023
00024
00025
00026
00027 pos = Vector2D( lPos.x(), lPos.y());
00028 dir = Vector2D( lDir.x(), lDir.y());;
00029 rotated = false;
00030 }
00031 else {
00032
00033
00034
00035
00036 sinPhi = yPrime.y();
00037 cosPhi = yPrime.x();
00038 pos = Vector2D( lPos.x()*cosPhi + lPos.y()*sinPhi,
00039 -lPos.x()*sinPhi + lPos.y()*cosPhi);
00040 dir = Vector2D( lDir.x()*cosPhi + lDir.y()*sinPhi,
00041 -lDir.x()*sinPhi + lDir.y()*cosPhi);
00042 rotated = true;
00043 }
00044
00045 double d = -lPos.z();
00046 double x = pos.x() + dir.x()/lDir.z()*d - 0.5*rho*d*d;
00047 double y = pos.y() + dir.y()/lDir.z()*d;
00048
00049
00050
00051
00052
00053 if (!rotated) {
00054 thePos = LocalPoint( x, y, 0);
00055 theDir = LocalVector( dir.x()+rho*d, dir.y(), lDir.z());
00056 }
00057 else {
00058 thePos = LocalPoint( x*cosPhi - y*sinPhi,
00059 x*sinPhi + y*cosPhi, 0);
00060 float px = dir.x()+rho*d;
00061 theDir = LocalVector( px*cosPhi - dir.y()*sinPhi,
00062 px*sinPhi + dir.y()*cosPhi, lDir.z());
00063 }
00064 }
00065