CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/TrackingTools/PatternTools/src/TSCBLBuilderWithPropagator.cc

Go to the documentation of this file.
00001 #include "TrackingTools/PatternTools/interface/TSCBLBuilderWithPropagator.h"
00002 #include "TrackingTools/GeomPropagators/interface/AnalyticalPropagator.h"
00003 #include "TrackingTools/PatternTools/interface/TrajectoryExtrapolatorToLine.h"
00004 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00005 
00006 using namespace std;
00007 
00008 TSCBLBuilderWithPropagator::TSCBLBuilderWithPropagator (const MagneticField* field) :
00009   thePropagator(new AnalyticalPropagator(field, anyDirection)) {}
00010 
00011 TSCBLBuilderWithPropagator::TSCBLBuilderWithPropagator (const Propagator& u) :
00012   thePropagator(u.clone()) 
00013 {
00014   thePropagator->setPropagationDirection(anyDirection);
00015 }
00016 
00017 
00018 TrajectoryStateClosestToBeamLine
00019 TSCBLBuilderWithPropagator::operator()
00020         (const FreeTrajectoryState& originalFTS,
00021          const reco::BeamSpot& beamSpot) const
00022 {
00023 
00024   GlobalPoint bspos(beamSpot.position().x(), beamSpot.position().y(), beamSpot.position().z());
00025   GlobalVector bsvec(beamSpot.dxdz(), beamSpot.dydz(), 1.);
00026   Line bsline(bspos,bsvec);
00027 
00028   TrajectoryExtrapolatorToLine tetl;
00029 
00030   TrajectoryStateOnSurface tsosfinal = tetl.extrapolate(originalFTS,bsline,*thePropagator);
00031 
00032   //Compute point on beamline of closest approach
00033   GlobalPoint tp = tsosfinal.globalPosition(); //position of trajectory closest approach
00034   GlobalVector hyp(tp.x() - bspos.x(),tp.y() - bspos.y(),tp.z() - bspos.z()); //difference between traj and beamline reference
00035   double l=bsline.direction().dot(hyp); //length along beamline away from reference point
00036   GlobalPoint closepoint = bspos + l*bsvec;
00037 
00038   //Get the free state and return the TSCBL
00039   const FreeTrajectoryState theFTS = *tsosfinal.freeState();
00040   return TrajectoryStateClosestToBeamLine(theFTS, closepoint, beamSpot);
00041 }