File indexing completed on 2024-04-06 12:31:35
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
0029 GlobalPoint tp = tsosfinal.globalPosition();
0030 GlobalVector hyp(
0031 tp.x() - bspos.x(), tp.y() - bspos.y(), tp.z() - bspos.z());
0032 double l = bsline.direction().dot(hyp);
0033 GlobalPoint closepoint = bspos + l * bsvec;
0034
0035
0036 const FreeTrajectoryState theFTS = *tsosfinal.freeState();
0037 return TrajectoryStateClosestToBeamLine(theFTS, closepoint, beamSpot);
0038 }