00001 #include "TrackingTools/TrajectoryState/interface/TrajectoryStateClosestToBeamLine.h"
00002
00003 TrajectoryStateClosestToBeamLine::TrajectoryStateClosestToBeamLine
00004 (const FreeTrajectoryState& stateAtPCA, const GlobalPoint & pointOnBeamLine,
00005 const reco::BeamSpot& beamSpot) :
00006 theFTS(stateAtPCA) , thePointOnBeamLine(pointOnBeamLine),
00007 theBeamSpot(beamSpot), valid(true)
00008 {}
00009
00010 Measurement1D TrajectoryStateClosestToBeamLine::transverseImpactParameter() const
00011 {
00012 if (!isValid()) throw TrajectoryStateException(
00013 "TrajectoryStateClosestToBeamLine is invalid.");
00014 AlgebraicSymMatrix33 error = theBeamSpot.covariance3D() +
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
00022
00023 double ipError = sqrt( ROOT::Math::Similarity(transverseFlightPath.Unit(),error) );
00024 return Measurement1D (length, ipError);
00025 }
00026