5 #include <vdt/vdtMath.h>
14 if (pt==0.)
throw cms::Exception(
"PerigeeConversions",
"Track with pt=0");
21 double positiveMomentumPhi = ( (phi>0) ? phi : (2*
M_PI+phi) );
22 double positionPhi = impactDistance.
phi();
23 double positivePositionPhi =
24 ( (positionPhi>0) ? positionPhi : (2*
M_PI+positionPhi) );
25 double phiDiff = positiveMomentumPhi - positivePositionPhi;
26 if (phiDiff<0.0) phiDiff+= (2*
M_PI);
27 double signEpsilon = ( (phiDiff >
M_PI) ? -1.0 : 1.0);
30 sqrt ( impactDistance.
x()*impactDistance.
x() +
31 impactDistance.
y()*impactDistance.
y() );
36 double signTC = - originalFTS.
charge();
37 bool isCharged = (signTC!=0) && (
std::abs(field)>1.e-10);
39 theTrackParameters[0] = field / pt*signTC;
41 theTrackParameters[0] = 1 /
pt;
43 theTrackParameters[1] =
theta;
44 theTrackParameters[2] =
phi;
45 theTrackParameters[3] =
epsilon;
46 theTrackParameters[4] = impactDistance.
z();
52 (
const FTS& originalFTS)
71 return GlobalPoint(theVector[3]*vdt::fast_sin(theVector[2])+referencePoint.
x(),
72 -theVector[3]*vdt::fast_cos(theVector[2])+referencePoint.
y(),
73 theVector[4]+referencePoint.
z());
81 vdt::fast_sin(parameters.
phi()) * pt,
82 pt /vdt::fast_tan(parameters.
theta()));
93 if ( charge!=0 &&
std::abs(bz)>1.e-10 ) {
101 vdt::fast_sin(momentum[2]) * pt,
102 pt/vdt::fast_tan(momentum[1]));
112 (momentum, referencePoint, charge, field);
117 field), cartesianTrajErr);
131 factor = bField*charge;
134 float s1,
c1; vdt::fast_sincosf(momentum[1],s1,c1);
135 float s2,c2; vdt::fast_sincosf(momentum[2],s2,c2);
136 float f1 = factor/(momentum[0]*momentum[0]);
137 float f2 = factor/momentum[0];
140 frameTransJ(0,0) = 1;
141 frameTransJ(1,1) = 1;
142 frameTransJ(2,2) = 1;
143 frameTransJ(3,3) = (f1 * c2);
144 frameTransJ(4,3) = (f1 *
s2);
145 frameTransJ(5,3) = (f1*c1/s1);
147 frameTransJ(3,5) = (f2 *
s2);
148 frameTransJ(4,5) = -(f2 * c2);
149 frameTransJ(5,4) = (f2/(s1*s1));
175 double Q = -B.
mag() * qbp;
176 double alphaQ = alpha * Q;
179 double sinlambda, coslambda; vdt::fast_sincos(lambda, sinlambda, coslambda);
180 double seclambda = 1./coslambda;
182 double ITI = 1./T.
dot(I);
183 double NU = N.
dot(U);
184 double NV = N.
dot(V);
185 double UI = U.
dot(I);
186 double VI = V.
dot(I);
187 double UJ = U.
dot(J);
188 double VJ = V.
dot(J);
189 double UK = U.
dot(K);
190 double VK = V.
dot(K);
195 jac(0,0) = seclambda;
196 jac(0,1) = sinlambda*seclambda*seclambda*
std::abs(qbp);
199 jac(0,0) = -Bz * seclambda;
200 jac(0,1) = -Bz * sinlambda*seclambda*seclambda*qbp;
201 jac(1,3) = alphaQ * NV * UI*ITI;
202 jac(1,4) = alphaQ * NV * VI*ITI;
203 jac(0,3) = -jac(0,1) * jac(1,3);
204 jac(0,4) = -jac(0,1) * jac(1,4);
205 jac(2,3) = -alphaQ*seclambda * NU * UI*ITI;
206 jac(2,4) = -alphaQ*seclambda * NU * VI*ITI;
241 double Q = -B.
mag() * qbp;
242 double alphaQ = alpha * Q;
246 double sinlambda, coslambda; vdt::fast_sincos(lambda, sinlambda, coslambda);
247 double seclambda = 1./coslambda;
249 double mqbpt = -1./coslambda * qbp;
251 double TJ = T.
dot(J);
252 double TK = T.
dot(K);
253 double NU = N.
dot(U);
254 double NV = N.
dot(V);
255 double UJ = U.
dot(J);
256 double VJ = V.
dot(J);
257 double UK = U.
dot(K);
258 double VK = V.
dot(K);
263 jac(0,0) = coslambda;
264 jac(0,1) = sinlambda/coslambda/gtp.
momentum().
mag();
266 jac(0,0) = -coslambda/B.
z();
267 jac(0,1) = -sinlambda * mqbpt;
268 jac(1,3) = -alphaQ * NV * TJ;
269 jac(1,4) = -alphaQ * NV * TK;
270 jac(2,3) = -alphaQ*seclambda * NU * TJ;
271 jac(2,4) = -alphaQ*seclambda * NU * TK;
const double Z[kNumberCalorimeter]
TrajectoryStateClosestToPoint trajectoryStateClosestToPoint(const AlgebraicVector3 &momentum, const GlobalPoint &referencePoint, const TrackCharge &charge, const AlgebraicSymMatrix66 &theCovarianceMatrix, const MagneticField *field)
const AlgebraicVector5 & vector() const
PerigeeTrajectoryParameters ftsToPerigeeParameters(const FTS &originalFTS, const GlobalPoint &referencePoint, double &pt)
const GlobalTrajectoryParameters & parameters() const
ROOT::Math::SMatrix< double, 6, 6, ROOT::Math::MatRepStd< double, 6, 6 > > AlgebraicMatrix66
ROOT::Math::SMatrix< double, 6, 6, ROOT::Math::MatRepSym< double, 6 > > AlgebraicSymMatrix66
Geom::Phi< T > phi() const
Global3DPoint GlobalPoint
Geom::Theta< T > theta() const
PreciseFloatType< T, U >::Type dot(const Vector3DBase< U, FrameTag > &v) const
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
TrackCharge charge() const
GlobalVector magneticFieldInInverseGeV(const GlobalPoint &x) const
const CurvilinearTrajectoryError & curvilinearError() const
static int position[TOTALCHAMBERS][3]
Geom::Theta< T > theta() const
float transverseCurvature() const
GlobalVector inInverseGeV(const GlobalPoint &gp) const
Field value ad specified global point, in 1/Gev.
float signedInverseMomentum() const
Vector3DBase< typename PreciseFloatType< T, U >::Type, FrameTag > cross(const Vector3DBase< U, FrameTag > &v) const
AlgebraicMatrix66 jacobianParameters2Cartesian(const AlgebraicVector3 &momentum, const GlobalPoint &position, const TrackCharge &charge, const MagneticField *field)
GlobalVector momentum() const
ROOT::Math::SVector< double, 3 > AlgebraicVector3
Abs< T >::type abs(const T &t)
const std::complex< double > I
AlgebraicMatrix55 jacobianPerigee2Curvilinear(const GlobalTrajectoryParameters >p)
GlobalVector momentum() const
const AlgebraicSymMatrix55 & covarianceMatrix() const
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)
ROOT::Math::SVector< double, 5 > AlgebraicVector5
CurvilinearTrajectoryError curvilinearError(const PerigeeTrajectoryError &perigeeError, const GlobalTrajectoryParameters >p)
AlgebraicMatrix55 jacobianCurvilinear2Perigee(const FreeTrajectoryState &fts)
double transverseCurvature() const
const AlgebraicSymMatrix55 & matrix() const
PerigeeTrajectoryError ftsToPerigeeError(const FTS &originalFTS)
double signedInverseMomentum() const
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepStd< double, 5, 5 > > AlgebraicMatrix55
Global3DVector GlobalVector