5 #include <vdt/vdtMath.h>
23 double positiveMomentumPhi = ((phi > 0) ? phi : (2 *
M_PI + phi));
24 double positionPhi = impactDistance.
phi();
25 double positivePositionPhi = ((positionPhi > 0) ? positionPhi : (2 *
M_PI + positionPhi));
26 double phiDiff = positiveMomentumPhi - positivePositionPhi;
28 phiDiff += (2 *
M_PI);
29 double signEpsilon = ((phiDiff >
M_PI) ? -1.0 : 1.0);
32 signEpsilon *
sqrt(impactDistance.
x() * impactDistance.
x() + impactDistance.
y() * impactDistance.
y());
37 double signTC = -originalFTS.
charge();
38 bool isCharged = (signTC != 0) && (
std::abs(field) > 1.e-10);
40 theTrackParameters[0] = field / pt * signTC;
42 theTrackParameters[0] = 1 /
pt;
44 theTrackParameters[1] =
theta;
45 theTrackParameters[2] =
phi;
46 theTrackParameters[3] =
epsilon;
47 theTrackParameters[4] = impactDistance.
z();
66 return GlobalPoint(theVector[3] * vdt::fast_sin(theVector[2]) + referencePoint.
x(),
67 -theVector[3] * vdt::fast_cos(theVector[2]) + referencePoint.
y(),
68 theVector[4] + referencePoint.
z());
75 vdt::fast_sin(parameters.
phi()) * pt,
76 pt / vdt::fast_tan(parameters.
theta()));
86 if (charge != 0 &&
std::abs(bz) > 1.e-10) {
94 vdt::fast_cos(momentum[2]) * pt, vdt::fast_sin(momentum[2]) * pt, pt / vdt::fast_tan(momentum[1]));
107 referencePoint,
momentumFromPerigee(momentum, charge, referencePoint, field), charge, field),
119 if (charge != 0 &&
std::abs(bField) > 1.
e-10
f)
123 vdt::fast_sincosf(momentum[1], s1, c1);
125 vdt::fast_sincosf(momentum[2], s2, c2);
126 float f1 = factor / (momentum[0] * momentum[0]);
127 float f2 = factor / momentum[0];
130 frameTransJ(0, 0) = 1;
131 frameTransJ(1, 1) = 1;
132 frameTransJ(2, 2) = 1;
133 frameTransJ(3, 3) = (f1 * c2);
134 frameTransJ(4, 3) = (f1 * s2);
135 frameTransJ(5, 3) = (f1 * c1 / s1);
137 frameTransJ(3, 5) = (f2 * s2);
138 frameTransJ(4, 5) = -(f2 * c2);
139 frameTransJ(5, 4) = (f2 / (s1 * s1));
163 double Q = -B.
mag() * qbp;
164 double alphaQ = alpha * Q;
167 double sinlambda, coslambda;
168 vdt::fast_sincos(lambda, sinlambda, coslambda);
169 double seclambda = 1. / coslambda;
171 double ITI = 1. / T.
dot(I);
172 double NU = N.
dot(U);
173 double NV = N.
dot(V);
174 double UI = U.
dot(I);
175 double VI = V.
dot(I);
176 double UJ = U.
dot(J);
177 double VJ = V.
dot(J);
178 double UK = U.
dot(K);
179 double VK = V.
dot(K);
184 jac(0, 0) = seclambda;
185 jac(0, 1) = sinlambda * seclambda * seclambda *
std::abs(qbp);
188 jac(0, 0) = -Bz * seclambda;
189 jac(0, 1) = -Bz * sinlambda * seclambda * seclambda * qbp;
190 jac(1, 3) = alphaQ * NV * UI * ITI;
191 jac(1, 4) = alphaQ * NV * VI * ITI;
192 jac(0, 3) = -jac(0, 1) * jac(1, 3);
193 jac(0, 4) = -jac(0, 1) * jac(1, 4);
194 jac(2, 3) = -alphaQ * seclambda * NU * UI * ITI;
195 jac(2, 4) = -alphaQ * seclambda * NU * VI * ITI;
199 jac(3, 3) = VK * ITI;
200 jac(3, 4) = -UK * ITI;
201 jac(4, 3) = -VJ * ITI;
202 jac(4, 4) = UJ * ITI;
226 double Q = -B.
mag() * qbp;
227 double alphaQ = alpha * Q;
230 double sinlambda, coslambda;
231 vdt::fast_sincos(lambda, sinlambda, coslambda);
232 double seclambda = 1. / coslambda;
234 double mqbpt = -1. / coslambda * qbp;
236 double TJ = T.
dot(J);
237 double TK = T.
dot(K);
238 double NU = N.
dot(U);
239 double NV = N.
dot(V);
240 double UJ = U.
dot(J);
241 double VJ = V.
dot(J);
242 double UK = U.
dot(K);
243 double VK = V.
dot(K);
248 jac(0, 0) = coslambda;
249 jac(0, 1) = sinlambda / coslambda / gtp.
momentum().
mag();
251 jac(0, 0) = -coslambda / B.
z();
252 jac(0, 1) = -sinlambda * mqbpt;
253 jac(1, 3) = -alphaQ * NV * TJ;
254 jac(1, 4) = -alphaQ * NV * TK;
255 jac(2, 3) = -alphaQ * seclambda * NU * TJ;
256 jac(2, 4) = -alphaQ * seclambda * NU * TK;
TrajectoryStateClosestToPoint trajectoryStateClosestToPoint(const AlgebraicVector3 &momentum, const GlobalPoint &referencePoint, const TrackCharge &charge, const AlgebraicSymMatrix66 &theCovarianceMatrix, const MagneticField *field)
const AlgebraicVector5 & vector() const
Vector3DBase< typename PreciseFloatType< T, U >::Type, FrameTag > cross(const Vector3DBase< U, FrameTag > &v) const
PerigeeTrajectoryParameters ftsToPerigeeParameters(const FTS &originalFTS, const GlobalPoint &referencePoint, double &pt)
const GlobalTrajectoryParameters & parameters() const
Geom::Phi< T > phi() const
Global3DPoint GlobalPoint
Geom::Theta< T > theta() const
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepStd< double, 5, 5 > > AlgebraicMatrix55
PreciseFloatType< T, U >::Type dot(const Vector3DBase< U, FrameTag > &v) const
TrackCharge charge() const
GlobalVector magneticFieldInInverseGeV(const GlobalPoint &x) const
const CurvilinearTrajectoryError & curvilinearError() const
Geom::Theta< T > theta() const
float transverseCurvature() const
GlobalVector inInverseGeV(const GlobalPoint &gp) const
Field value ad specified global point, in 1/Gev.
uint32_t T const *__restrict__ uint32_t const *__restrict__ int32_t int Histo::index_type cudaStream_t V
float signedInverseMomentum() const
AlgebraicMatrix66 jacobianParameters2Cartesian(const AlgebraicVector3 &momentum, const GlobalPoint &position, const TrackCharge &charge, const MagneticField *field)
GlobalVector momentum() const
Abs< T >::type abs(const T &t)
ROOT::Math::SVector< double, 5 > AlgebraicVector5
const std::complex< double > I
AlgebraicMatrix55 jacobianPerigee2Curvilinear(const GlobalTrajectoryParameters >p)
GlobalVector momentum() const
ROOT::Math::SMatrix< double, 6, 6, ROOT::Math::MatRepStd< double, 6, 6 > > AlgebraicMatrix66
const AlgebraicSymMatrix55 & covarianceMatrix() const
ROOT::Math::SMatrix< double, 6, 6, ROOT::Math::MatRepSym< double, 6 > > AlgebraicSymMatrix66
Vector3DBase unit() const
GlobalPoint position() const
GlobalPoint positionFromPerigee(const PerigeeTrajectoryParameters ¶meters, const GlobalPoint &referencePoint)
GlobalVector momentumFromPerigee(const AlgebraicVector3 &momentum, const TrackCharge &charge, const GlobalPoint &referencePoint, const MagneticField *field)
CurvilinearTrajectoryError curvilinearError(const PerigeeTrajectoryError &perigeeError, const GlobalTrajectoryParameters >p)
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
AlgebraicMatrix55 jacobianCurvilinear2Perigee(const FreeTrajectoryState &fts)
double transverseCurvature() const
const AlgebraicSymMatrix55 & matrix() const
static int position[264][3]
ROOT::Math::SVector< double, 3 > AlgebraicVector3
PerigeeTrajectoryError ftsToPerigeeError(const FTS &originalFTS)
double signedInverseMomentum() const
Global3DVector GlobalVector