CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_1/src/TrackingTools/TrajectoryState/src/TrajectoryStateClosestToBeamLine.cc

Go to the documentation of this file.
00001 #include "TrackingTools/TrajectoryState/interface/TrajectoryStateClosestToBeamLine.h"
00002 
00003 TrajectoryStateClosestToBeamLine::TrajectoryStateClosestToBeamLine
00004         (const FreeTrajectoryState& stateAtPCA, const GlobalPoint & pointOnBeamLine,
00005          const reco::BeamSpot& beamSpot) :
00006           valid(true), theFTS(stateAtPCA) , thePointOnBeamLine(pointOnBeamLine),
00007         theBeamSpot(beamSpot)
00008 {}
00009 
00010 Measurement1D TrajectoryStateClosestToBeamLine::transverseImpactParameter() const
00011 {
00012   if (!isValid()) throw TrajectoryStateException(
00013     "TrajectoryStateClosestToBeamLine is invalid.");
00014   AlgebraicSymMatrix33 error = theBeamSpot.rotatedCovariance3D() +
00015         theFTS.cartesianError().matrix().Sub<AlgebraicSymMatrix33>(0,0);
00016 
00017   GlobalPoint impactPoint=theFTS.position();
00018   AlgebraicVector3 transverseFlightPath(
00019         impactPoint.x()-thePointOnBeamLine.x(),impactPoint.y()-thePointOnBeamLine.y(),0.);
00020   double length = ROOT::Math::Mag(transverseFlightPath);
00021   // Warning: after the transverseFlightPath.Unit() statement, the
00022   // transverseFlightPath vector is CHANGED to a UNIT vector.
00023   double ipError = sqrt( ROOT::Math::Similarity(transverseFlightPath.Unit(),error) );
00024   return Measurement1D (length, ipError);
00025 }
00026