CMS 3D CMS Logo

PathToPlane2Order.cc

Go to the documentation of this file.
00001 #include "TrackPropagation/RungeKutta/interface/PathToPlane2Order.h"
00002 #include "TrackPropagation/RungeKutta/interface/RKLocalFieldProvider.h"
00003 #include "TrackPropagation/RungeKutta/interface/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   // access to the field in field frame local coordinates
00016     RKLocalFieldProvider::Vector B = theField.inTesla( pos.x(), pos.y(), pos.z());
00017 
00018     // Frame::GlobalVector localZ = Frame::GlobalVector( B.unit()); // local Z along field
00019     // transform field axis to global frame
00020     Frame::GlobalVector localZ = theFieldFrame->toGlobal( Frame::LocalVector( B.unit())); // local Z along field
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 // frame in which the field is along Z
00035     Frame frame( fpos, frot);
00036 
00037 //    cout << "PathToPlane2Order frame " << frame.position() << endl << frame.rotation() << endl;
00038 
00039 // transform the position and direction to that frame
00040     Frame::LocalPoint localPos = frame.toLocal( fpos); // same as LocalPoint(0,0,0)
00041 
00042     //transform momentum from field frame to new frame via global frame
00043     Frame::GlobalVector gmom( theFieldFrame->toGlobal( Frame::LocalVector(momentum)));
00044     Frame::LocalVector localMom = frame.toLocal( gmom); 
00045 
00046     // transform the plane to the same frame
00047     FrameChanger changer;
00048     FrameChanger::PlanePtr localPlane = changer.transformPlane( plane, frame);
00049 /*
00050      cout << "PathToPlane2Order input plane       " << plane.position() << endl 
00051          << plane.rotation() << endl;
00052      cout << "PathToPlane2Order transformed plane " << localPlane->position() << endl 
00053          << localPlane->rotation() << endl;
00054 */
00055     double k = 2.99792458e-3;
00056     double transverseMomentum = localMom.perp();   // transverse to the field
00057     double curvature = -k * charge * B.mag() / transverseMomentum;
00058 /*
00059      cout << "PathToPlane2Order curvature " << curvature << endl;
00060      cout << "transverseMomentum " << transverseMomentum << endl;
00061      cout << "B.mag() " << B.mag() << endl;
00062      cout << "localZ " << localZ << endl;
00063      cout << "pos      " << pos << endl;
00064      cout << "momentum " << momentum << endl;
00065      cout << "localPos " << localPos << endl;
00066      cout << "localMom " << localMom << endl;
00067 */
00068 /*
00069     cout << "PathToPlane2Order: local pos " << localPos << " mom " << localMom 
00070          << " curvature " << curvature << endl;
00071     cout << "PathToPlane2Order: local plane pos " << localPlane->position() 
00072          << " normal " << localPlane->normalVector() << endl;
00073 */
00074     HelixArbitraryPlaneCrossing crossing( localPos.basicVector(), localMom.basicVector(), 
00075                                           curvature, propDir);
00076     std::pair<bool,double> res = crossing.pathLength(*localPlane);
00077 
00078     return res;
00079 }

Generated on Tue Jun 9 17:48:43 2009 for CMSSW by  doxygen 1.5.4