Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:31:42

0001 #include "TrackingTools/PatternTools/interface/TSCBLBuilderWithPropagator.h"
0002 #include "TrackingTools/GeomPropagators/interface/AnalyticalPropagator.h"
0003 #include "TrackingTools/PatternTools/interface/TrajectoryExtrapolatorToLine.h"
0004 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0005 
0006 using namespace std;
0007 
0008 TSCBLBuilderWithPropagator::TSCBLBuilderWithPropagator(const MagneticField* field)
0009     : thePropagator(new AnalyticalPropagator(field, anyDirection)) {}
0010 
0011 TSCBLBuilderWithPropagator::TSCBLBuilderWithPropagator(const Propagator& u) : thePropagator(u.clone()) {
0012   thePropagator->setPropagationDirection(anyDirection);
0013 }
0014 
0015 TrajectoryStateClosestToBeamLine TSCBLBuilderWithPropagator::operator()(const FreeTrajectoryState& originalFTS,
0016                                                                         const reco::BeamSpot& beamSpot) const {
0017   GlobalPoint bspos(beamSpot.position().x(), beamSpot.position().y(), beamSpot.position().z());
0018   GlobalVector bsvec(beamSpot.dxdz(), beamSpot.dydz(), 1.);
0019   Line bsline(bspos, bsvec);
0020 
0021   TrajectoryExtrapolatorToLine tetl;
0022 
0023   TrajectoryStateOnSurface tsosfinal = tetl.extrapolate(originalFTS, bsline, *thePropagator);
0024 
0025   if (!tsosfinal.isValid())
0026     return TrajectoryStateClosestToBeamLine();
0027 
0028   //Compute point on beamline of closest approach
0029   GlobalPoint tp = tsosfinal.globalPosition();  //position of trajectory closest approach
0030   GlobalVector hyp(
0031       tp.x() - bspos.x(), tp.y() - bspos.y(), tp.z() - bspos.z());  //difference between traj and beamline reference
0032   double l = bsline.direction().dot(hyp);                           //length along beamline away from reference point
0033   GlobalPoint closepoint = bspos + l * bsvec;
0034 
0035   //Get the free state and return the TSCBL
0036   const FreeTrajectoryState theFTS = *tsosfinal.freeState();
0037   return TrajectoryStateClosestToBeamLine(theFTS, closepoint, beamSpot);
0038 }