CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch13/src/TrackingTools/PatternTools/src/TSCBLBuilderNoMaterial.cc

Go to the documentation of this file.
00001 #include "TrackingTools/PatternTools/interface/TSCBLBuilderNoMaterial.h"
00002 #include "TrackingTools/AnalyticalJacobians/interface/AnalyticalCurvilinearJacobian.h"
00003 #include "TrackingTools/PatternTools/interface/TwoTrackMinimumDistance.h"
00004 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00005 
00006 using namespace std;
00007 
00008 TrajectoryStateClosestToBeamLine
00009 TSCBLBuilderNoMaterial::operator()
00010         (const FreeTrajectoryState& originalFTS,
00011          const reco::BeamSpot& beamSpot) const
00012 {
00013   TwoTrackMinimumDistance ttmd;
00014   bool status = ttmd.calculate( originalFTS.parameters(), 
00015         GlobalTrajectoryParameters(
00016                 GlobalPoint(beamSpot.position().x(), beamSpot.position().y(), beamSpot.position().z()), 
00017                 GlobalVector(beamSpot.dxdz(), beamSpot.dydz(), 1.), 
00018                 0, &(originalFTS.parameters().magneticField()) ) );
00019   if (!status) {
00020     LogDebug  ("TrackingTools|PatternTools")
00021       << "TSCBLBuilderNoMaterial: Failure in TTMD when searching for PCA of track to beamline.\n"
00022       << "TrajectoryStateClosestToBeamLine is now invalid.";
00023     return TrajectoryStateClosestToBeamLine();
00024   }
00025 
00026   pair<GlobalPoint, GlobalPoint> points = ttmd.points();
00027 
00028   GlobalPoint xTrack = points.first;
00029   GlobalVector pTrack = GlobalVector ( GlobalVector::Cylindrical(originalFTS.momentum().perp(), ttmd.firstAngle(), originalFTS.momentum().z()) );
00030 
00031   double s =  ttmd.pathLength().first;
00032 
00033   FreeTrajectoryState theFTS;
00034   if (originalFTS.hasError()) {
00035     const AlgebraicSymMatrix55 &errorMatrix = originalFTS.curvilinearError().matrix();
00036     AnalyticalCurvilinearJacobian curvilinJacobian(originalFTS.parameters(), xTrack,
00037                                                    pTrack, s);
00038     const AlgebraicMatrix55 &jacobian = curvilinJacobian.jacobian();
00039     CurvilinearTrajectoryError cte( ROOT::Math::Similarity(jacobian, errorMatrix) );
00040   
00041     theFTS = FreeTrajectoryState(GlobalTrajectoryParameters(xTrack, pTrack, originalFTS.charge(), 
00042                                         &(originalFTS.parameters().magneticField())),
00043                                 cte);
00044   }
00045   else {
00046     theFTS = FreeTrajectoryState(GlobalTrajectoryParameters(xTrack, pTrack, originalFTS.charge(),
00047                                         &(originalFTS.parameters().magneticField())));
00048   }
00049   return TrajectoryStateClosestToBeamLine(theFTS, points.second, beamSpot);
00050 }