CMS 3D CMS Logo

Typedefs | Functions
PerigeeConversions Namespace Reference

Typedefs

typedef FreeTrajectoryState FTS
 

Functions

CurvilinearTrajectoryError curvilinearError (const PerigeeTrajectoryError &perigeeError, const GlobalTrajectoryParameters &gtp)
 
PerigeeTrajectoryError ftsToPerigeeError (const FTS &originalFTS)
 
PerigeeTrajectoryParameters ftsToPerigeeParameters (const FTS &originalFTS, const GlobalPoint &referencePoint, double &pt)
 
AlgebraicMatrix55 jacobianCurvilinear2Perigee (const FreeTrajectoryState &fts)
 
AlgebraicMatrix66 jacobianParameters2Cartesian (const AlgebraicVector3 &momentum, const GlobalPoint &position, const TrackCharge &charge, const MagneticField *field)
 
AlgebraicMatrix55 jacobianPerigee2Curvilinear (const GlobalTrajectoryParameters &gtp)
 
GlobalVector momentumFromPerigee (const AlgebraicVector3 &momentum, const TrackCharge &charge, const GlobalPoint &referencePoint, const MagneticField *field)
 
GlobalVector momentumFromPerigee (const PerigeeTrajectoryParameters &parameters, double pt, const GlobalPoint &referencePoint)
 
GlobalPoint positionFromPerigee (const PerigeeTrajectoryParameters &parameters, const GlobalPoint &referencePoint)
 
TrajectoryStateClosestToPoint trajectoryStateClosestToPoint (const AlgebraicVector3 &momentum, const GlobalPoint &referencePoint, const TrackCharge &charge, const AlgebraicSymMatrix66 &theCovarianceMatrix, const MagneticField *field)
 

Detailed Description

namespace provides several functions to transform perigee parameters to and from various other parametrisations.

Typedef Documentation

◆ FTS

Definition at line 16 of file PerigeeConversions.h.

Function Documentation

◆ curvilinearError()

CurvilinearTrajectoryError PerigeeConversions::curvilinearError ( const PerigeeTrajectoryError perigeeError,
const GlobalTrajectoryParameters gtp 
)

Definition at line 57 of file PerigeeConversions.cc.

References PerigeeTrajectoryError::covarianceMatrix(), and jacobianPerigee2Curvilinear().

Referenced by TrajectoryStateClosestToPoint::calculateFTS().

58  {
60  return CurvilinearTrajectoryError(ROOT::Math::Similarity(perigee2curv, perigeeError.covarianceMatrix()));
61 }
const AlgebraicSymMatrix55 & covarianceMatrix() const
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepStd< double, 5, 5 > > AlgebraicMatrix55
AlgebraicMatrix55 jacobianPerigee2Curvilinear(const GlobalTrajectoryParameters &gtp)

◆ ftsToPerigeeError()

PerigeeTrajectoryError PerigeeConversions::ftsToPerigeeError ( const FTS originalFTS)

Definition at line 51 of file PerigeeConversions.cc.

References FreeTrajectoryState::curvilinearError(), jacobianCurvilinear2Perigee(), and CurvilinearTrajectoryError::matrix().

Referenced by MatcherUsingTracksAlgorithm::getChi2(), TrackFromSeedProducer::produce(), and TrajectoryStateClosestToPoint::TrajectoryStateClosestToPoint().

51  {
52  AlgebraicSymMatrix55 errorMatrix = originalFTS.curvilinearError().matrix();
53  AlgebraicMatrix55 curv2perigee = jacobianCurvilinear2Perigee(originalFTS);
54  return PerigeeTrajectoryError(ROOT::Math::Similarity(curv2perigee, errorMatrix));
55 }
const CurvilinearTrajectoryError & curvilinearError() const
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepStd< double, 5, 5 > > AlgebraicMatrix55
const AlgebraicSymMatrix55 & matrix() const
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
AlgebraicMatrix55 jacobianCurvilinear2Perigee(const FreeTrajectoryState &fts)

◆ ftsToPerigeeParameters()

PerigeeTrajectoryParameters PerigeeConversions::ftsToPerigeeParameters ( const FTS originalFTS,
const GlobalPoint referencePoint,
double &  pt 
)

calculates the perigee parameters from a given FTS and a reference point.

Definition at line 7 of file PerigeeConversions.cc.

References funct::abs(), FreeTrajectoryState::charge(), geometryDiff::epsilon, Exception, M_PI, GlobalTrajectoryParameters::magneticFieldInInverseGeV(), FreeTrajectoryState::momentum(), FreeTrajectoryState::parameters(), PV3DBase< T, PVType, FrameType >::perp(), PV3DBase< T, PVType, FrameType >::phi(), PVValHelper::phi, FreeTrajectoryState::position(), DiDispStaMuonMonitor_cfi::pt, mathSSE::sqrt(), PV3DBase< T, PVType, FrameType >::theta(), theta(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by MatcherUsingTracksAlgorithm::getChi2(), and TrajectoryStateClosestToPoint::TrajectoryStateClosestToPoint().

11 {
12  GlobalVector impactDistance = originalFTS.position() - referencePoint;
13 
14  pt = originalFTS.momentum().perp();
15  if (pt == 0.)
16  throw cms::Exception("PerigeeConversions", "Track with pt=0");
17 
18  double theta = originalFTS.momentum().theta();
19  double phi = originalFTS.momentum().phi();
20  double field = originalFTS.parameters().magneticFieldInInverseGeV().z();
21  // if (field==0.) throw cms::Exception("PerigeeConversions", "Field is 0") << " at " << originalFTS.position() << "\n" ;
22 
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;
27  if (phiDiff < 0.0)
28  phiDiff += (2 * M_PI);
29  double signEpsilon = ((phiDiff > M_PI) ? -1.0 : 1.0);
30 
31  double epsilon =
32  signEpsilon * sqrt(impactDistance.x() * impactDistance.x() + impactDistance.y() * impactDistance.y());
33 
34  // The track parameters:
35  AlgebraicVector5 theTrackParameters;
36 
37  double signTC = -originalFTS.charge();
38  bool isCharged = (signTC != 0) && (std::abs(field) > 1.e-10);
39  if (isCharged) {
40  theTrackParameters[0] = field / pt * signTC;
41  } else {
42  theTrackParameters[0] = 1 / pt;
43  }
44  theTrackParameters[1] = theta;
45  theTrackParameters[2] = phi;
46  theTrackParameters[3] = epsilon;
47  theTrackParameters[4] = impactDistance.z();
48  return PerigeeTrajectoryParameters(theTrackParameters, isCharged);
49 }
T perp() const
Definition: PV3DBase.h:69
T z() const
Definition: PV3DBase.h:61
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
const GlobalTrajectoryParameters & parameters() const
GlobalPoint position() const
T x() const
Definition: PV3DBase.h:59
T y() const
Definition: PV3DBase.h:60
T sqrt(T t)
Definition: SSEVec.h:19
TrackCharge charge() const
GlobalVector momentum() const
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
ROOT::Math::SVector< double, 5 > AlgebraicVector5
GlobalVector magneticFieldInInverseGeV(const GlobalPoint &x) const
#define M_PI
Geom::Theta< T > theta() const
Geom::Theta< T > theta() const
Definition: PV3DBase.h:72

◆ jacobianCurvilinear2Perigee()

AlgebraicMatrix55 PerigeeConversions::jacobianCurvilinear2Perigee ( const FreeTrajectoryState fts)

Jacobians of tranformations between curvilinear frame at point of closest approach in transverse plane and perigee frame. The fts must therefore be given at exactly this point in order to yield the correct Jacobians.

Definition at line 144 of file PerigeeConversions.cc.

References funct::abs(), simBeamSpotPI::alpha, B, MillePedeFileConverter_cfg::e, data-class-funcs::H, Exhume::I, M_PI, PV3DBase< T, PVType, FrameType >::mag(), GlobalTrajectoryParameters::magneticFieldInInverseGeV(), FreeTrajectoryState::momentum(), N, AlCaHLTBitMon_ParallelJobs::p, FreeTrajectoryState::parameters(), FreeTrajectoryState::signedInverseMomentum(), FreeTrajectoryState::transverseCurvature(), mitigatedMETSequence_cff::U, Vector3DBase< T, FrameTag >::unit(), cms::cuda::V, and beamSpotPI::Z.

Referenced by ftsToPerigeeError(), and PerigeeKinematicState::PerigeeKinematicState().

144  {
145  GlobalVector p = fts.momentum();
146 
147  GlobalVector Z = GlobalVector(0., 0., 1.);
148  GlobalVector T = p.unit();
149  GlobalVector U = Z.cross(T).unit();
150  ;
151  GlobalVector V = T.cross(U);
152 
153  GlobalVector I = GlobalVector(-p.x(), -p.y(), 0.); //opposite to track dir.
154  I = I.unit();
155  GlobalVector J(-I.y(), I.x(), 0.); //counterclockwise rotation
156  const GlobalVector& K(Z);
158  GlobalVector H = B.unit();
159  GlobalVector HxT = H.cross(T);
160  GlobalVector N = HxT.unit();
161  double alpha = HxT.mag();
162  double qbp = fts.signedInverseMomentum();
163  double Q = -B.mag() * qbp;
164  double alphaQ = alpha * Q;
165 
166  double lambda = 0.5 * M_PI - p.theta();
167  double sinlambda, coslambda;
168  vdt::fast_sincos(lambda, sinlambda, coslambda);
169  double seclambda = 1. / coslambda;
170 
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);
180 
181  AlgebraicMatrix55 jac;
182 
183  if (fabs(fts.transverseCurvature()) < 1.e-10) {
184  jac(0, 0) = seclambda;
185  jac(0, 1) = sinlambda * seclambda * seclambda * std::abs(qbp);
186  } else {
187  double Bz = B.z();
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;
196  }
197  jac(1, 1) = -1.;
198  jac(2, 2) = 1.;
199  jac(3, 3) = VK * ITI;
200  jac(3, 4) = -UK * ITI;
201  jac(4, 3) = -VJ * ITI;
202  jac(4, 4) = UJ * ITI;
203 
204  return jac;
205 }
Definition: APVGainStruct.h:7
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepStd< double, 5, 5 > > AlgebraicMatrix55
const GlobalTrajectoryParameters & parameters() const
uint32_t T const *__restrict__ uint32_t const *__restrict__ int32_t int Histo::index_type cudaStream_t V
T mag() const
Definition: PV3DBase.h:64
GlobalVector momentum() const
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double signedInverseMomentum() const
const std::complex< double > I
Definition: I.h:8
GlobalVector magneticFieldInInverseGeV(const GlobalPoint &x) const
#define M_PI
double transverseCurvature() const
#define N
Definition: blowfish.cc:9
Vector3DBase unit() const
Definition: Vector3DBase.h:54
long double T
Global3DVector GlobalVector
Definition: GlobalVector.h:10

◆ jacobianParameters2Cartesian()

AlgebraicMatrix66 PerigeeConversions::jacobianParameters2Cartesian ( const AlgebraicVector3 momentum,
const GlobalPoint position,
const TrackCharge charge,
const MagneticField field 
)

Jacobians of tranformations between the parametrixation (x, y, z, transverse curvature, theta, phi) to Cartesian

Definition at line 113 of file PerigeeConversions.cc.

References funct::abs(), Calorimetry_cff::bField, alignmentValidation::c1, ALCARECOTkAlJpsiMuMu_cff::charge, MillePedeFileConverter_cfg::e, f, DeadROC_duringRun::f1, DeadROC_duringRun::f2, MagneticField::inInverseGeV(), position, and PV3DBase< T, PVType, FrameType >::z().

Referenced by KinematicPerigeeConversions::jacobianParameters2Kinematic(), and trajectoryStateClosestToPoint().

116  {
117  float factor = -1.;
118  float bField = field->inInverseGeV(position).z();
119  if (charge != 0 && std::abs(bField) > 1.e-10f)
120  factor = bField * charge;
121 
122  float s1, c1;
123  vdt::fast_sincosf(momentum[1], s1, c1);
124  float s2, c2;
125  vdt::fast_sincosf(momentum[2], s2, c2);
126  float f1 = factor / (momentum[0] * momentum[0]);
127  float f2 = factor / momentum[0];
128 
129  AlgebraicMatrix66 frameTransJ;
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);
136 
137  frameTransJ(3, 5) = (f2 * s2);
138  frameTransJ(4, 5) = -(f2 * c2);
139  frameTransJ(5, 4) = (f2 / (s1 * s1));
140 
141  return frameTransJ;
142 }
T z() const
Definition: PV3DBase.h:61
GlobalVector inInverseGeV(const GlobalPoint &gp) const
Field value ad specified global point, in 1/Gev.
Definition: MagneticField.h:36
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double f[11][100]
ROOT::Math::SMatrix< double, 6, 6, ROOT::Math::MatRepStd< double, 6, 6 > > AlgebraicMatrix66
static int position[264][3]
Definition: ReadPGInfo.cc:289

◆ jacobianPerigee2Curvilinear()

AlgebraicMatrix55 PerigeeConversions::jacobianPerigee2Curvilinear ( const GlobalTrajectoryParameters gtp)

Definition at line 207 of file PerigeeConversions.cc.

References simBeamSpotPI::alpha, B, MillePedeFileConverter_cfg::e, f, data-class-funcs::H, Exhume::I, M_PI, PV3DBase< T, PVType, FrameType >::mag(), GlobalTrajectoryParameters::magneticFieldInInverseGeV(), GlobalTrajectoryParameters::momentum(), N, AlCaHLTBitMon_ParallelJobs::p, GlobalTrajectoryParameters::signedInverseMomentum(), GlobalTrajectoryParameters::transverseCurvature(), mitigatedMETSequence_cff::U, Vector3DBase< T, FrameTag >::unit(), cms::cuda::V, and beamSpotPI::Z.

Referenced by curvilinearError().

207  {
208  GlobalVector p = gtp.momentum();
209 
210  GlobalVector Z = GlobalVector(0.f, 0.f, 1.f);
211  GlobalVector T = p.unit();
212  GlobalVector U = Z.cross(T).unit();
213  ;
214  GlobalVector V = T.cross(U);
215 
216  GlobalVector I = GlobalVector(-p.x(), -p.y(), 0.f); //opposite to track dir.
217  I = I.unit();
218  GlobalVector J(-I.y(), I.x(), 0.f); //counterclockwise rotation
219  const GlobalVector& K(Z);
221  GlobalVector H = B.unit();
222  GlobalVector HxT = H.cross(T);
223  GlobalVector N = HxT.unit();
224  double alpha = HxT.mag();
225  double qbp = gtp.signedInverseMomentum();
226  double Q = -B.mag() * qbp;
227  double alphaQ = alpha * Q;
228 
229  double lambda = 0.5 * M_PI - p.theta();
230  double sinlambda, coslambda;
231  vdt::fast_sincos(lambda, sinlambda, coslambda);
232  double seclambda = 1. / coslambda;
233 
234  double mqbpt = -1. / coslambda * qbp;
235 
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);
244 
245  AlgebraicMatrix55 jac;
246 
247  if (fabs(gtp.transverseCurvature()) < 1.e-10f) {
248  jac(0, 0) = coslambda;
249  jac(0, 1) = sinlambda / coslambda / gtp.momentum().mag();
250  } else {
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;
257  }
258  jac(1, 1) = -1.;
259  jac(2, 2) = 1.;
260  jac(3, 3) = UJ;
261  jac(3, 4) = UK;
262  jac(4, 3) = VJ;
263  jac(4, 4) = VK;
264 
265  return jac;
266 }
Definition: APVGainStruct.h:7
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepStd< double, 5, 5 > > AlgebraicMatrix55
uint32_t T const *__restrict__ uint32_t const *__restrict__ int32_t int Histo::index_type cudaStream_t V
T mag() const
Definition: PV3DBase.h:64
const std::complex< double > I
Definition: I.h:8
double f[11][100]
GlobalVector magneticFieldInInverseGeV(const GlobalPoint &x) const
#define M_PI
#define N
Definition: blowfish.cc:9
Vector3DBase unit() const
Definition: Vector3DBase.h:54
long double T
Global3DVector GlobalVector
Definition: GlobalVector.h:10

◆ momentumFromPerigee() [1/2]

GlobalVector PerigeeConversions::momentumFromPerigee ( const AlgebraicVector3 momentum,
const TrackCharge charge,
const GlobalPoint referencePoint,
const MagneticField field 
)

returns the (Cartesian) momentum. The parameters need not be the full perigee parameters, as long as the first 3 parameters are the transverse curvature, theta and phi.

Definition at line 79 of file PerigeeConversions.cc.

References funct::abs(), ALCARECOTkAlJpsiMuMu_cff::charge, MagneticField::inInverseGeV(), DiDispStaMuonMonitor_cfi::pt, and PV3DBase< T, PVType, FrameType >::z().

Referenced by TrajectoryStateClosestToPoint::calculateFTS(), TrajectoryStateClosestToPoint::momentum(), and trajectoryStateClosestToPoint().

82  {
83  double pt;
84 
85  double bz = fabs(field->inInverseGeV(referencePoint).z());
86  if (charge != 0 && std::abs(bz) > 1.e-10) {
87  pt = std::abs(bz / momentum[0]);
88  // if (pt<1.e-10) throw cms::Exception("PerigeeConversions", "pt is 0");
89  } else {
90  pt = 1 / momentum[0];
91  }
92 
93  return GlobalVector(
94  vdt::fast_cos(momentum[2]) * pt, vdt::fast_sin(momentum[2]) * pt, pt / vdt::fast_tan(momentum[1]));
95 }
T z() const
Definition: PV3DBase.h:61
GlobalVector inInverseGeV(const GlobalPoint &gp) const
Field value ad specified global point, in 1/Gev.
Definition: MagneticField.h:36
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
Global3DVector GlobalVector
Definition: GlobalVector.h:10

◆ momentumFromPerigee() [2/2]

GlobalVector PerigeeConversions::momentumFromPerigee ( const PerigeeTrajectoryParameters parameters,
double  pt,
const GlobalPoint referencePoint 
)

returns the (Cartesian) momentum from the PerigeeTrajectoryParameters

Definition at line 71 of file PerigeeConversions.cc.

References DiDispStaMuonMonitor_cfi::pt.

73  {
74  return GlobalVector(vdt::fast_cos(parameters.phi()) * pt,
75  vdt::fast_sin(parameters.phi()) * pt,
76  pt / vdt::fast_tan(parameters.theta()));
77 }
Global3DVector GlobalVector
Definition: GlobalVector.h:10

◆ positionFromPerigee()

GlobalPoint PerigeeConversions::positionFromPerigee ( const PerigeeTrajectoryParameters parameters,
const GlobalPoint referencePoint 
)

returns the position (on the helix) at which the parameters are defined

Definition at line 63 of file PerigeeConversions.cc.

References PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by TrajectoryStateClosestToPoint::calculateFTS(), and TrajectoryStateClosestToPoint::position().

64  {
65  AlgebraicVector5 theVector = parameters.vector();
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());
69 }
T z() const
Definition: PV3DBase.h:61
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
T x() const
Definition: PV3DBase.h:59
T y() const
Definition: PV3DBase.h:60
ROOT::Math::SVector< double, 5 > AlgebraicVector5

◆ trajectoryStateClosestToPoint()

TrajectoryStateClosestToPoint PerigeeConversions::trajectoryStateClosestToPoint ( const AlgebraicVector3 momentum,
const GlobalPoint referencePoint,
const TrackCharge charge,
const AlgebraicSymMatrix66 theCovarianceMatrix,
const MagneticField field 
)

Public constructor. This constructor takes a momentum, with parameters (transverse curvature, theta, phi) and a position, which is both the reference position and the position at which the momentum is defined. The covariance matrix is defined for these 6 parameters, in the order (x, y, z, transverse curvature, theta, phi).

Definition at line 97 of file PerigeeConversions.cc.

References ALCARECOTkAlJpsiMuMu_cff::charge, jacobianParameters2Cartesian(), and momentumFromPerigee().

Referenced by PrimaryVertexValidation::analyze(), PerigeeMultiLTS::createRefittedTrackState(), and PerigeeLinearizedTrackState::createRefittedTrackState().

102  {
103  AlgebraicMatrix66 param2cart = jacobianParameters2Cartesian(momentum, referencePoint, charge, field);
104  CartesianTrajectoryError cartesianTrajErr(ROOT::Math::Similarity(param2cart, theCovarianceMatrix));
105 
107  referencePoint, momentumFromPerigee(momentum, charge, referencePoint, field), charge, field),
108  cartesianTrajErr);
109 
110  return TrajectoryStateClosestToPoint(theFTS, referencePoint);
111 }
AlgebraicMatrix66 jacobianParameters2Cartesian(const AlgebraicVector3 &momentum, const GlobalPoint &position, const TrackCharge &charge, const MagneticField *field)
ROOT::Math::SMatrix< double, 6, 6, ROOT::Math::MatRepStd< double, 6, 6 > > AlgebraicMatrix66
GlobalVector momentumFromPerigee(const AlgebraicVector3 &momentum, const TrackCharge &charge, const GlobalPoint &referencePoint, const MagneticField *field)