Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #include "TrackingTools/PatternTools/interface/TSCBLBuilderNoMaterial.h"
0002 #include "TrackingTools/AnalyticalJacobians/interface/AnalyticalCurvilinearJacobian.h"
0003 #include "TrackingTools/PatternTools/interface/TwoTrackMinimumDistance.h"
0004 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0005 
0006 using namespace std;
0007 
0008 TrajectoryStateClosestToBeamLine TSCBLBuilderNoMaterial::operator()(const FreeTrajectoryState& originalFTS,
0009                                                                     const reco::BeamSpot& beamSpot) const {
0010   TwoTrackMinimumDistance ttmd;
0011   bool status = ttmd.calculate(
0012       originalFTS.parameters(),
0013       GlobalTrajectoryParameters(GlobalPoint(beamSpot.position().x(), beamSpot.position().y(), beamSpot.position().z()),
0014                                  GlobalVector(beamSpot.dxdz(), beamSpot.dydz(), 1.),
0015                                  0,
0016                                  &(originalFTS.parameters().magneticField())));
0017   if (!status) {
0018     LogDebug("TrackingTools|PatternTools")
0019         << "TSCBLBuilderNoMaterial: Failure in TTMD when searching for PCA of track to beamline.\n"
0020         << "TrajectoryStateClosestToBeamLine is now invalid.";
0021     return TrajectoryStateClosestToBeamLine();
0022   }
0023 
0024   pair<GlobalPoint, GlobalPoint> points = ttmd.points();
0025 
0026   GlobalPoint xTrack = points.first;
0027   GlobalVector pTrack = GlobalVector(
0028       GlobalVector::Cylindrical(originalFTS.momentum().perp(), ttmd.firstAngle(), originalFTS.momentum().z()));
0029 
0030   double s = ttmd.pathLength().first;
0031 
0032   FreeTrajectoryState theFTS;
0033   if (originalFTS.hasError()) {
0034     const AlgebraicSymMatrix55& errorMatrix = originalFTS.curvilinearError().matrix();
0035     AnalyticalCurvilinearJacobian curvilinJacobian(originalFTS.parameters(), xTrack, pTrack, s);
0036     const AlgebraicMatrix55& jacobian = curvilinJacobian.jacobian();
0037     CurvilinearTrajectoryError cte(ROOT::Math::Similarity(jacobian, errorMatrix));
0038 
0039     theFTS = FreeTrajectoryState(
0040         GlobalTrajectoryParameters(xTrack, pTrack, originalFTS.charge(), &(originalFTS.parameters().magneticField())),
0041         cte);
0042   } else {
0043     theFTS = FreeTrajectoryState(
0044         GlobalTrajectoryParameters(xTrack, pTrack, originalFTS.charge(), &(originalFTS.parameters().magneticField())));
0045   }
0046   return TrajectoryStateClosestToBeamLine(theFTS, points.second, beamSpot);
0047 }