#include <PerigeeConversions.h>
Class provides several methods to transform perigee parameters to and from various other parametrisations.
Definition at line 16 of file PerigeeConversions.h.
typedef FreeTrajectoryState PerigeeConversions::FTS [private] |
Definition at line 18 of file PerigeeConversions.h.
TrackCharge PerigeeConversions::chargeFromPerigee | ( | const PerigeeTrajectoryParameters & | perigee | ) | const |
This method returns the charge.
Definition at line 153 of file PerigeeConversions.cc.
References PerigeeTrajectoryParameters::charge().
{ return parameters.charge(); }
CurvilinearTrajectoryError PerigeeConversions::curvilinearError | ( | const PerigeeTrajectoryError & | perigeeError, |
const GlobalTrajectoryParameters & | gtp | ||
) | const |
Definition at line 102 of file PerigeeConversions.cc.
References PerigeeTrajectoryError::covarianceMatrix().
Referenced by TrajectoryStateClosestToPoint::calculateFTS().
{ AlgebraicMatrix55 perigee2curv = jacobianPerigee2Curvilinear(gtp); return CurvilinearTrajectoryError(ROOT::Math::Similarity(perigee2curv, perigeeError.covarianceMatrix())); }
PerigeeTrajectoryError PerigeeConversions::ftsToPerigeeError | ( | const FTS & | originalFTS | ) | const |
Definition at line 63 of file PerigeeConversions.cc.
References FreeTrajectoryState::curvilinearError(), and CurvilinearTrajectoryError::matrix().
Referenced by MuonTrackingRegionBuilder::region(), and TrajectoryStateClosestToPoint::TrajectoryStateClosestToPoint().
{ AlgebraicSymMatrix55 errorMatrix = originalFTS.curvilinearError().matrix(); AlgebraicMatrix55 curv2perigee = jacobianCurvilinear2Perigee(originalFTS); return PerigeeTrajectoryError(ROOT::Math::Similarity(curv2perigee,errorMatrix)); }
PerigeeTrajectoryParameters PerigeeConversions::ftsToPerigeeParameters | ( | const FTS & | originalFTS, |
const GlobalPoint & | referencePoint, | ||
double & | pt | ||
) | const |
This method calculates the perigee parameters from a given FTS and a reference point.
Definition at line 7 of file PerigeeConversions.cc.
References FreeTrajectoryState::charge(), epsilon, Exception, MagneticField::inInverseGeV(), M_PI, GlobalTrajectoryParameters::magneticField(), FreeTrajectoryState::momentum(), FreeTrajectoryState::parameters(), PV3DBase< T, PVType, FrameType >::perp(), PV3DBase< T, PVType, FrameType >::phi(), phi, FreeTrajectoryState::position(), mathSSE::sqrt(), theta(), PV3DBase< T, PVType, FrameType >::theta(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), PV3DBase< T, PVType, FrameType >::z(), and z.
Referenced by TrajectoryStateClosestToPoint::TrajectoryStateClosestToPoint().
{ GlobalVector impactDistance = originalFTS.position() - referencePoint; pt = originalFTS.momentum().perp(); if (pt==0.) throw cms::Exception("PerigeeConversions", "Track with pt=0"); double theta = originalFTS.momentum().theta(); double phi = originalFTS.momentum().phi(); double field = originalFTS.parameters().magneticField().inInverseGeV(originalFTS.position()).z(); // if (field==0.) throw cms::Exception("PerigeeConversions", "Field is 0") << " at " << originalFTS.position() << "\n" ; double positiveMomentumPhi = ( (phi>0) ? phi : (2*M_PI+phi) ); double positionPhi = impactDistance.phi(); double positivePositionPhi = ( (positionPhi>0) ? positionPhi : (2*M_PI+positionPhi) ); double phiDiff = positiveMomentumPhi - positivePositionPhi; if (phiDiff<0.0) phiDiff+= (2*M_PI); double signEpsilon = ( (phiDiff > M_PI) ? -1.0 : 1.0); double epsilon = signEpsilon * sqrt ( impactDistance.x()*impactDistance.x() + impactDistance.y()*impactDistance.y() ); // The track parameters: AlgebraicVector5 theTrackParameters; double signTC = - originalFTS.charge(); bool isCharged = (signTC!=0) && (fabs(field)>1.e-10); if (isCharged) { theTrackParameters[0] = field / pt*signTC; } else { theTrackParameters[0] = 1 / pt; } theTrackParameters[1] = theta; theTrackParameters[2] = phi; theTrackParameters[3] = epsilon; theTrackParameters[4] = impactDistance.z(); return PerigeeTrajectoryParameters(theTrackParameters, isCharged); }
AlgebraicMatrix55 PerigeeConversions::jacobianCurvilinear2Perigee | ( | const FreeTrajectoryState & | fts | ) | const |
Definition at line 226 of file PerigeeConversions.cc.
References alpha, funct::cos(), Vector3DBase< T, FrameTag >::cross(), Vector3DBase< T, FrameTag >::dot(), Exhume::I, MagneticField::inInverseGeV(), M_PI, PV3DBase< T, PVType, FrameType >::mag(), GlobalTrajectoryParameters::magneticField(), GlobalTrajectoryParameters::momentum(), FreeTrajectoryState::momentum(), MultiGaussianStateTransform::N, L1TEmulatorMonitor_cff::p, FreeTrajectoryState::parameters(), FreeTrajectoryState::position(), FreeTrajectoryState::signedInverseMomentum(), funct::tan(), PV3DBase< T, PVType, FrameType >::theta(), FreeTrajectoryState::transverseCurvature(), Vector3DBase< T, FrameTag >::unit(), PV3DBase< T, PVType, FrameType >::x(), x, PV3DBase< T, PVType, FrameType >::y(), PV3DBase< T, PVType, FrameType >::z(), and Gflash::Z.
Referenced by jacobianCurvilinear2Perigee_old(), and PerigeeKinematicState::PerigeeKinematicState().
{ GlobalVector p = fts.momentum(); GlobalVector Z = GlobalVector(0.,0.,1.); GlobalVector T = p.unit(); GlobalVector U = Z.cross(T).unit();; GlobalVector V = T.cross(U); GlobalVector I = GlobalVector(-p.x(), -p.y(), 0.); //opposite to track dir. I = I.unit(); GlobalVector J(-I.y(), I.x(),0.); //counterclockwise rotation GlobalVector K(Z); GlobalPoint x = fts.position(); GlobalVector B = fts.parameters().magneticField().inInverseGeV(x); GlobalVector H = B.unit(); GlobalVector HxT = H.cross(T); GlobalVector N = HxT.unit(); double alpha = HxT.mag(); double qbp = fts.signedInverseMomentum(); double Q = -B.mag() * qbp; double alphaQ = alpha * Q; double lambda = 0.5 * M_PI - p.theta(); double coslambda = cos(lambda), tanlambda = tan(lambda); double TI = T.dot(I); double NU = N.dot(U); double NV = N.dot(V); double UI = U.dot(I); double VI = V.dot(I); double UJ = U.dot(J); double VJ = V.dot(J); double UK = U.dot(K); double VK = V.dot(K); AlgebraicMatrix55 jac; if( fabs(fts.transverseCurvature())<1.e-10 ) { jac(0,0) = 1/coslambda; jac(0,1) = tanlambda/coslambda/fts.parameters().momentum().mag(); }else{ double Bz = B.z(); jac(0,0) = -Bz/coslambda; jac(0,1) = -Bz * tanlambda/coslambda*qbp; jac(1,3) = alphaQ * NV * UI/TI; jac(1,4) = alphaQ * NV * VI/TI; jac(0,3) = -jac(0,1) * jac(1,3); jac(0,4) = -jac(0,1) * jac(1,4); jac(2,3) = -alphaQ/coslambda * NU * UI/TI; jac(2,4) = -alphaQ/coslambda * NU * VI/TI; } jac(1,1) = -1.; jac(2,2) = 1.; jac(3,3) = VK/TI; jac(3,4) = -UK/TI; jac(4,3) = -VJ/TI; jac(4,4) = UJ/TI; return jac; }
AlgebraicMatrix PerigeeConversions::jacobianCurvilinear2Perigee_old | ( | const FreeTrajectoryState & | fts | ) | const |
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 220 of file PerigeeConversions.cc.
References asHepMatrix(), and jacobianCurvilinear2Perigee().
{ return asHepMatrix(jacobianCurvilinear2Perigee(fts)); }
AlgebraicMatrix66 PerigeeConversions::jacobianParameters2Cartesian | ( | const AlgebraicVector3 & | momentum, |
const GlobalPoint & | position, | ||
const TrackCharge & | charge, | ||
const MagneticField * | field | ||
) | const |
Jacobians of tranformations between the parametrixation (x, y, z, transverse curvature, theta, phi) to Cartesian
Definition at line 193 of file PerigeeConversions.cc.
References ecalTB2006H4_GenSimDigiReco_cfg::bField, DeDxDiscriminatorTools::charge(), funct::cos(), Exception, MagneticField::inInverseGeV(), funct::sin(), funct::tan(), and PV3DBase< T, PVType, FrameType >::z().
Referenced by jacobianParameters2Cartesian_old(), and KinematicPerigeeConversions::jacobianParameters2Kinematic().
{ if (momentum[0]==0.) throw cms::Exception("PerigeeConversions", "Track with rho=0"); double factor = 1.; double bField = field->inInverseGeV(position).z(); if (charge!=0 && fabs(bField)>1.e-10) { // if (bField==0.) throw cms::Exception("PerigeeConversions", "Field is 0"); factor = -bField*charge; } AlgebraicMatrix66 frameTransJ; frameTransJ(0,0) = 1; frameTransJ(1,1) = 1; frameTransJ(2,2) = 1; frameTransJ(3,3) = - factor * cos(momentum[2]) / (momentum[0]*momentum[0]); frameTransJ(4,3) = - factor * sin(momentum[2]) / (momentum[0]*momentum[0]); frameTransJ(5,3) = - factor / tan(momentum[1]) / (momentum[0]*momentum[0]); frameTransJ(3,5) = - factor * sin(momentum[2]) / (momentum[0]); frameTransJ(4,5) = factor * cos(momentum[2]) / (momentum[0]); frameTransJ(5,4) = - factor / (momentum[0]*sin(momentum[1])*sin(momentum[1])); return frameTransJ; }
AlgebraicMatrix PerigeeConversions::jacobianParameters2Cartesian_old | ( | const AlgebraicVector & | momentum, |
const GlobalPoint & | position, | ||
const TrackCharge & | charge, | ||
const MagneticField * | field | ||
) | const |
Jacobians of tranformations between the parametrixation (x, y, z, transverse curvature, theta, phi) to Cartesian
Definition at line 186 of file PerigeeConversions.cc.
References asHepMatrix(), and jacobianParameters2Cartesian().
{ return asHepMatrix(jacobianParameters2Cartesian(asSVector<3>(momentum), position, charge, field)); }
AlgebraicMatrix55 PerigeeConversions::jacobianPerigee2Curvilinear | ( | const GlobalTrajectoryParameters & | gtp | ) | const |
Definition at line 296 of file PerigeeConversions.cc.
References alpha, funct::cos(), Vector3DBase< T, FrameTag >::cross(), Vector3DBase< T, FrameTag >::dot(), Exhume::I, MagneticField::inInverseGeV(), M_PI, PV3DBase< T, PVType, FrameType >::mag(), GlobalTrajectoryParameters::magneticField(), GlobalTrajectoryParameters::momentum(), MultiGaussianStateTransform::N, L1TEmulatorMonitor_cff::p, GlobalTrajectoryParameters::position(), GlobalTrajectoryParameters::signedInverseMomentum(), funct::sin(), PV3DBase< T, PVType, FrameType >::theta(), GlobalTrajectoryParameters::transverseCurvature(), Vector3DBase< T, FrameTag >::unit(), PV3DBase< T, PVType, FrameType >::x(), x, PV3DBase< T, PVType, FrameType >::y(), Gflash::Z, and PV3DBase< T, PVType, FrameType >::z().
Referenced by jacobianPerigee2Curvilinear_old().
{ GlobalVector p = gtp.momentum(); GlobalVector Z = GlobalVector(0.,0.,1.); GlobalVector T = p.unit(); GlobalVector U = Z.cross(T).unit();; GlobalVector V = T.cross(U); GlobalVector I = GlobalVector(-p.x(), -p.y(), 0.); //opposite to track dir. I = I.unit(); GlobalVector J(-I.y(), I.x(),0.); //counterclockwise rotation GlobalVector K(Z); GlobalPoint x = gtp.position(); GlobalVector B = gtp.magneticField().inInverseGeV(x); GlobalVector H = B.unit(); GlobalVector HxT = H.cross(T); GlobalVector N = HxT.unit(); double alpha = HxT.mag(); double qbp = gtp.signedInverseMomentum(); double Q = -B.mag() * qbp; double alphaQ = alpha * Q; double lambda = 0.5 * M_PI - p.theta(); double coslambda = cos(lambda), sinlambda = sin(lambda); double mqbpt = -1./coslambda * qbp; double TJ = T.dot(J); double TK = T.dot(K); double NU = N.dot(U); double NV = N.dot(V); double UJ = U.dot(J); double VJ = V.dot(J); double UK = U.dot(K); double VK = V.dot(K); AlgebraicMatrix55 jac; if( fabs(gtp.transverseCurvature())<1.e-10 ) { jac(0,0) = coslambda; jac(0,1) = sinlambda/coslambda/gtp.momentum().mag(); }else{ jac(0,0) = -coslambda/B.z(); jac(0,1) = -sinlambda * mqbpt; jac(1,3) = -alphaQ * NV * TJ; jac(1,4) = -alphaQ * NV * TK; jac(2,3) = -alphaQ/coslambda * NU * TJ; jac(2,4) = -alphaQ/coslambda * NU * TK; } jac(1,1) = -1.; jac(2,2) = 1.; jac(3,3) = UJ; jac(3,4) = UK; jac(4,3) = VJ; jac(4,4) = VK; return jac; }
AlgebraicMatrix PerigeeConversions::jacobianPerigee2Curvilinear_old | ( | const GlobalTrajectoryParameters & | gtp | ) | const |
Definition at line 291 of file PerigeeConversions.cc.
References asHepMatrix(), and jacobianPerigee2Curvilinear().
{ return asHepMatrix(jacobianPerigee2Curvilinear(gtp)); }
GlobalVector PerigeeConversions::momentumFromPerigee | ( | const AlgebraicVector & | momentum, |
const TrackCharge & | charge, | ||
const GlobalPoint & | referencePoint, | ||
const MagneticField * | field | ||
) | const |
This method 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 127 of file PerigeeConversions.cc.
Referenced by TrajectoryStateClosestToPoint::calculateFTS(), and TrajectoryStateClosestToPoint::momentum().
{ return momentumFromPerigee(asSVector<3>(momentum), charge, referencePoint, field); }
GlobalVector PerigeeConversions::momentumFromPerigee | ( | const PerigeeTrajectoryParameters & | parameters, |
double | pt, | ||
const GlobalPoint & | referencePoint | ||
) | const |
This method returns the (Cartesian) momentum from the PerigeeTrajectoryParameters
Definition at line 119 of file PerigeeConversions.cc.
References funct::cos(), PerigeeTrajectoryParameters::phi(), funct::sin(), funct::tan(), and PerigeeTrajectoryParameters::theta().
GlobalVector PerigeeConversions::momentumFromPerigee | ( | const AlgebraicVector3 & | momentum, |
const TrackCharge & | charge, | ||
const GlobalPoint & | referencePoint, | ||
const MagneticField * | field | ||
) | const |
Definition at line 133 of file PerigeeConversions.cc.
References abs, funct::cos(), Exception, MagneticField::inInverseGeV(), funct::sin(), funct::tan(), and PV3DBase< T, PVType, FrameType >::z().
{ double pt; if (momentum[0]==0.) throw cms::Exception("PerigeeConversions", "Track with rho=0"); double bz = fabs(field->inInverseGeV(referencePoint).z()); if ( charge!=0 && bz>1.e-10 ) { pt = std::abs(bz/momentum[0]); if (pt<1.e-10) throw cms::Exception("PerigeeConversions", "pt is 0"); } else { pt = 1 / momentum[0]; } return GlobalVector(cos(momentum[2]) * pt, sin(momentum[2]) * pt, pt/tan(momentum[1])); }
GlobalPoint PerigeeConversions::positionFromPerigee | ( | const PerigeeTrajectoryParameters & | parameters, |
const GlobalPoint & | referencePoint | ||
) | const |
This method returns the position (on the helix) at which the parameters are defined
Definition at line 109 of file PerigeeConversions.cc.
References funct::cos(), funct::sin(), PerigeeTrajectoryParameters::vector(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().
Referenced by TrajectoryStateClosestToPoint::calculateFTS(), and TrajectoryStateClosestToPoint::position().
{ AlgebraicVector5 theVector = parameters.vector(); return GlobalPoint(theVector[3]*sin(theVector[2])+referencePoint.x(), -theVector[3]*cos(theVector[2])+referencePoint.y(), theVector[4]+referencePoint.z()); }
TrajectoryStateClosestToPoint PerigeeConversions::trajectoryStateClosestToPoint | ( | const AlgebraicVector3 & | momentum, |
const GlobalPoint & | referencePoint, | ||
const TrackCharge & | charge, | ||
const AlgebraicSymMatrix66 & | theCovarianceMatrix, | ||
const MagneticField * | field | ||
) | const |
Definition at line 170 of file PerigeeConversions.cc.
{ AlgebraicMatrix66 param2cart = jacobianParameters2Cartesian (momentum, referencePoint, charge, field); CartesianTrajectoryError cartesianTrajErr(ROOT::Math::Similarity(param2cart, theCovarianceMatrix)); FTS theFTS(GlobalTrajectoryParameters(referencePoint, momentumFromPerigee(momentum, charge, referencePoint, field), charge, field), cartesianTrajErr); return TrajectoryStateClosestToPoint(theFTS, referencePoint); }
TrajectoryStateClosestToPoint PerigeeConversions::trajectoryStateClosestToPoint | ( | const AlgebraicVector & | momentum, |
const GlobalPoint & | referencePoint, | ||
const TrackCharge & | charge, | ||
const AlgebraicMatrix & | theCovarianceMatrix, | ||
const MagneticField * | field | ||
) | const |
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).
field | FIXME !!! why not Sym !!?? |
Definition at line 159 of file PerigeeConversions.cc.
Referenced by PerigeeLinearizedTrackState::createRefittedTrackState(), and PerigeeMultiLTS::createRefittedTrackState().
{ AlgebraicSymMatrix sym; sym.assign(theCovarianceMatrix); // below, this was used for Matrix => SymMatrix return trajectoryStateClosestToPoint(asSVector<3>(momentum), referencePoint, charge, asSMatrix<6>(sym), field); }