Go to the documentation of this file.00001 #include "PathToPlane2Order.h"
00002 #include "RKLocalFieldProvider.h"
00003 #include "FrameChanger.h"
00004 #include "TrackingTools/GeomPropagators/interface/HelixArbitraryPlaneCrossing.h"
00005
00006 #include <iostream>
00007
00008 std::pair<bool,double>
00009 PathToPlane2Order::operator()( const Plane& plane,
00010 const Vector3D& pos,
00011 const Vector3D& momentum,
00012 double charge,
00013 const PropagationDirection propDir)
00014 {
00015
00016 RKLocalFieldProvider::Vector B = theField.inTesla( pos.x(), pos.y(), pos.z());
00017
00018
00019
00020 Frame::GlobalVector localZ = theFieldFrame->toGlobal( Frame::LocalVector( B.unit()));
00021
00022 Frame::GlobalVector localY = localZ.cross( Frame::GlobalVector( 1,0,0));
00023 if (localY.mag() < 0.1) {
00024 localY = localZ.cross( Frame::GlobalVector(0,1,0)).unit();
00025 }
00026 else {
00027 localY = localY.unit();
00028 }
00029 Frame::GlobalVector localX = localY.cross(localZ);
00030
00031
00032 Frame::PositionType fpos( theFieldFrame->toGlobal( Frame::LocalPoint(pos)));
00033 Frame::RotationType frot( localX, localY, localZ);
00034
00035 Frame frame( fpos, frot);
00036
00037
00038
00039
00040 Frame::LocalPoint localPos = frame.toLocal( fpos);
00041
00042
00043 Frame::GlobalVector gmom( theFieldFrame->toGlobal( Frame::LocalVector(momentum)));
00044 Frame::LocalVector localMom = frame.toLocal( gmom);
00045
00046
00047 Plane localPlane = FrameChanger::transformPlane( plane, frame);
00048
00049
00050
00051
00052
00053
00054 double k = 2.99792458e-3;
00055 double transverseMomentum = localMom.perp();
00056 if (!(transverseMomentum != 0) ) {
00057
00058 return std::pair<bool,double>(false,0);
00059 }
00060 double curvature = -k * charge * B.mag() / transverseMomentum;
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077 HelixArbitraryPlaneCrossing crossing( localPos.basicVector(), localMom.basicVector(),
00078 curvature, propDir);
00079 std::pair<bool,double> res = crossing.pathLength(localPlane);
00080
00081 return res;
00082 }