File indexing completed on 2024-04-06 12:31:40
0001 #include "TrackingTools/TrajectoryParametrization/interface/CurvilinearTrajectoryParameters.h"
0002 #include <cmath>
0003
0004 CurvilinearTrajectoryParameters::CurvilinearTrajectoryParameters(const GlobalPoint& aX,
0005 const GlobalVector& aP,
0006 TrackCharge aCharge) {
0007 theQbp = aCharge / aP.mag();
0008
0009 double pT2 = aP.x() * aP.x() + aP.y() * aP.y();
0010 double pT = sqrt(pT2);
0011 thelambda = atan(aP.z() / pT);
0012 thephi = atan2(aP.y(), aP.x());
0013 thexT = (-aP.y() * aX.x() + aP.x() * aX.y()) / pT;
0014 theyT = (-aX.x() * aP.x() * aP.z() - aX.y() * aP.z() * aP.y() + aX.z() * (pT2)) / (aP.mag() * pT);
0015 }
0016
0017 bool CurvilinearTrajectoryParameters::updateP(double dP) {
0018
0019 double p = 1. / std::abs(Qbp());
0020 if ((p += dP) <= 0.)
0021 return false;
0022 double newQbp = Qbp() > 0 ? 1. / p : -1. / p;
0023 theQbp = newQbp;
0024 return true;
0025 }