Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:31:41

0001 // -*- C++ -*-
0002 //
0003 //
0004 /**
0005 
0006  Description: Utility class to create FTS from supercluster
0007 
0008 */
0009 //
0010 // Original Author:  Ursula Berthon, Claude Charlot
0011 //         Created:  Mon Mar 27 13:22:06 CEST 2006
0012 //
0013 //
0014 #include "TrackingTools/TrajectoryState/interface/ftsFromVertexToPoint.h"
0015 #include "MagneticField/Engine/interface/MagneticField.h"
0016 
0017 FreeTrajectoryState trackingTools::ftsFromVertexToPoint(MagneticField const& magField,
0018                                                         GlobalPoint const& xmeas,
0019                                                         GlobalPoint const& xvert,
0020                                                         float momentum,
0021                                                         TrackCharge charge) {
0022   auto magFieldAtPoint = magField.inTesla(xmeas);
0023   auto BInTesla = magFieldAtPoint.z();
0024   GlobalVector xdiff = xmeas - xvert;
0025   auto mom = momentum * xdiff.unit();
0026   auto pt = mom.perp();
0027   auto pz = mom.z();
0028   auto pxOld = mom.x();
0029   auto pyOld = mom.y();
0030 
0031   auto curv = (BInTesla * 0.29979f * 0.01f) / pt;
0032 
0033   // stays as doc...
0034   // auto alpha = std::asin(0.5f*xdiff.perp()*curv);
0035   // auto ca = std::cos(float(charge)*alpha);
0036   // auto sa = std::sin(float(charge)*alpha);
0037 
0038   auto sa = 0.5f * xdiff.perp() * curv * float(charge);
0039   auto ca = sqrt(1.f - sa * sa);
0040 
0041   auto pxNew = ca * pxOld + sa * pyOld;
0042   auto pyNew = -sa * pxOld + ca * pyOld;
0043   GlobalVector pNew(pxNew, pyNew, pz);
0044 
0045   GlobalTrajectoryParameters gp(xmeas, pNew, charge, &magField, std::move(magFieldAtPoint));
0046 
0047   return FreeTrajectoryState(gp);
0048 }