10 void PerigeeLinearizedTrackState::computeJacobians()
const
14 thePredState = builder(theTSOS, paramPt);
15 if unlikely(!thePredState.isValid())
return;
17 double field = theTrack.field()->inInverseGeV(thePredState.theState().position()).
z();
19 if ((
std::abs(theCharge)<1
e-5)||(fabs(field)<1.e-10)){
21 computeNeutralJacobians();
24 computeChargedJacobians();
27 jacobiansAvailable =
true;
34 const PerigeeLinearizedTrackState* otherP =
35 dynamic_cast<const PerigeeLinearizedTrackState*
>(&other);
37 throw VertexException(
"PerigeeLinearizedTrackState: don't know how to compare myself to non-perigee track state");
39 return (otherP->track() == theTrack);
45 const PerigeeLinearizedTrackState* otherP =
46 dynamic_cast<const PerigeeLinearizedTrackState*
>(other.get());
48 throw VertexException(
"PerigeeLinearizedTrackState: don't know how to compare myself to non-perigee track state");
50 return (otherP->track() == theTrack);
54 PerigeeLinearizedTrackState::RefCountedLinearizedTrackState
55 PerigeeLinearizedTrackState::stateWithNewLinearizationPoint
58 return RefCountedLinearizedTrackState(
59 new PerigeeLinearizedTrackState(newLP, track(), theTSOS));
62 PerigeeLinearizedTrackState::RefCountedRefittedTrackState
63 PerigeeLinearizedTrackState::createRefittedTrackState(
70 vectorParameters, vertexPosition,
charge(), covarianceMatrix, theTrack.field());
74 std::vector< PerigeeLinearizedTrackState::RefCountedLinearizedTrackState >
77 std::vector<RefCountedLinearizedTrackState>
result; result.reserve(1);
78 result.push_back(RefCountedLinearizedTrackState(
79 const_cast<PerigeeLinearizedTrackState*>(
this)));
85 const RefCountedRefittedTrackState & theRefittedState)
const
87 auto p = theRefittedState->position();
90 if ((momentum(2)*predictedStateMomentumParameters()(2) < 0)&&(fabs(momentum(2))>
M_PI/2) ) {
91 if (predictedStateMomentumParameters()(2) < 0.) momentum(2)-= 2*
M_PI;
92 if (predictedStateMomentumParameters()(2) > 0.) momentum(2)+= 2*
M_PI;
94 AlgebraicVectorN param = constantTerm() +
95 positionJacobian() * vertexPosition +
96 momentumJacobian() * momentum;
97 if (param(2) >
M_PI) param(2)-= 2*
M_PI;
98 if (param(2) < -
M_PI) param(2)+= 2*
M_PI;
110 void PerigeeLinearizedTrackState::computeChargedJacobians()
const
114 double field = theTrack.field()->inInverseGeV(thePredState.theState().position()).
z();
115 double signTC = -theCharge;
117 double thetaAtEP = thePredState.perigeeParameters().theta();
118 double phiAtEP = thePredState.perigeeParameters().phi();
119 double ptAtEP = thePredState.pt();
120 double transverseCurvatureAtEP = field / ptAtEP*signTC;
122 double x_v = thePredState.theState().position().x();
123 double y_v = thePredState.theState().position().y();
124 double z_v = thePredState.theState().position().z();
125 double X = x_v - paramPt.x() -
sin(phiAtEP) / transverseCurvatureAtEP;
126 double Y = y_v - paramPt.y() +
cos(phiAtEP) / transverseCurvatureAtEP;
127 double SS = X*X + Y*Y;
132 theExpandedParams[0] = transverseCurvatureAtEP;
133 theExpandedParams[1] = thetaAtEP;
134 theExpandedParams[3] = 1/transverseCurvatureAtEP - signTC * S;
137 double signX = (X>0.0? +1.0:-1.0);
138 phiFEP = -signTC * signX*acos(signTC*Y/S);
140 phiFEP = asin(-signTC*X/S);
142 phiFEP =
M_PI - phiFEP;
145 theExpandedParams[2] = phiFEP;
146 theExpandedParams[4] = z_v - paramPt.z() -
147 (phiAtEP - theExpandedParams[2]) /
tan(thetaAtEP)/transverseCurvatureAtEP;
154 thePositionJacobian(2,0) = - Y / (SS);
155 thePositionJacobian(2,1) = X / (SS);
156 thePositionJacobian(3,0) = - signTC * X / S;
157 thePositionJacobian(3,1) = - signTC * Y / S;
158 thePositionJacobian(4,0) = thePositionJacobian(2,0)/
tan(thetaAtEP)/transverseCurvatureAtEP;
159 thePositionJacobian(4,1) = thePositionJacobian(2,1)/
tan(thetaAtEP)/transverseCurvatureAtEP;
160 thePositionJacobian(4,2) = 1;
165 theMomentumJacobian(0,0) = 1;
166 theMomentumJacobian(1,1) = 1;
168 theMomentumJacobian(2,0) = -
169 (X*
cos(phiAtEP) + Y*
sin(phiAtEP))/
170 (SS*transverseCurvatureAtEP*transverseCurvatureAtEP);
172 theMomentumJacobian(2,2) = (Y*
cos(phiAtEP) - X*
sin(phiAtEP)) /
173 (SS*transverseCurvatureAtEP);
175 theMomentumJacobian(3,0) =
176 (signTC * (Y*
cos(phiAtEP) - X*
sin(phiAtEP)) / S - 1)/
177 (transverseCurvatureAtEP*transverseCurvatureAtEP);
179 theMomentumJacobian(3,2) = signTC *(X*
cos(phiAtEP) + Y*
sin(phiAtEP))/
180 (S*transverseCurvatureAtEP);
182 theMomentumJacobian(4,0) = (phiAtEP - theExpandedParams[2]) /
183 tan(thetaAtEP)/(transverseCurvatureAtEP*transverseCurvatureAtEP)+
184 theMomentumJacobian(2,0) /
tan(thetaAtEP)/transverseCurvatureAtEP;
186 theMomentumJacobian(4,1) = (phiAtEP - theExpandedParams[2]) *
187 (1 + 1/(
tan(thetaAtEP)*
tan(thetaAtEP)))/transverseCurvatureAtEP;
189 theMomentumJacobian(4,2) = (theMomentumJacobian(2,2) - 1) /
190 tan(thetaAtEP)/transverseCurvatureAtEP;
194 auto p = thePredState.theState().position();
196 AlgebraicVector3 momentumAtExpansionPoint( transverseCurvatureAtEP,thetaAtEP,phiAtEP);
199 thePositionJacobian * expansionPoint -
200 theMomentumJacobian * momentumAtExpansionPoint );
208 void PerigeeLinearizedTrackState::computeNeutralJacobians()
const
213 double thetaAtEP = thePredState.theState().momentum().theta();
214 double phiAtEP = thePredState.theState().momentum().phi();
215 double ptAtEP = thePredState.theState().momentum().perp();
217 double x_v = thePredState.theState().position().x();
218 double y_v = thePredState.theState().position().y();
219 double z_v = thePredState.theState().position().z();
220 double X = x_v - paramPt.x();
221 double Y = y_v - paramPt.y();
225 theExpandedParams(0) = 1 / ptAtEP;
226 theExpandedParams(1) = thetaAtEP;
227 theExpandedParams(2) = phiAtEP;
228 theExpandedParams(3) = X*
sin(phiAtEP) - Y*
cos(phiAtEP);
229 theExpandedParams(4) = z_v - paramPt.z() -
230 (X*
cos(phiAtEP) + Y*
sin(phiAtEP)) /
tan(thetaAtEP);
237 thePositionJacobian(3,0) =
sin(phiAtEP);
238 thePositionJacobian(3,1) = -
cos(phiAtEP);
239 thePositionJacobian(4,0) = -
cos(phiAtEP)/
tan(thetaAtEP);
240 thePositionJacobian(4,1) = -
sin(phiAtEP)/
tan(thetaAtEP);
241 thePositionJacobian(4,2) = 1;
247 theMomentumJacobian(0,0) = 1;
248 theMomentumJacobian(1,1) = 1;
249 theMomentumJacobian(2,2) = 1;
251 theMomentumJacobian(3,2) = X*
cos(phiAtEP) + Y*
sin(phiAtEP);
253 theMomentumJacobian(4,1) = theMomentumJacobian(3,2)*
254 (1 + 1/(
tan(thetaAtEP)*
tan(thetaAtEP)));
256 theMomentumJacobian(4,2) = (X*
sin(phiAtEP) - Y*
cos(phiAtEP))/
tan(thetaAtEP);
260 auto p = thePredState.theState().position();
265 thePositionJacobian * expansionPoint -
266 theMomentumJacobian * momentumAtExpansionPoint );
TrajectoryStateClosestToPoint trajectoryStateClosestToPoint(const AlgebraicVector3 &momentum, const GlobalPoint &referencePoint, const TrackCharge &charge, const AlgebraicSymMatrix66 &theCovarianceMatrix, const MagneticField *field)
Sin< T >::type sin(const T &t)
ROOT::Math::SMatrix< double, 6, 6, ROOT::Math::MatRepSym< double, 6 > > AlgebraicSymMatrix66
bool operator==(const QGLikelihoodParameters &lhs, const QGLikelihoodCategory &rhs)
Test if parameters are compatible with category.
Cos< T >::type cos(const T &t)
ROOT::Math::SVector< double, 3 > AlgebraicVector3
Tan< T >::type tan(const T &t)
Abs< T >::type abs(const T &t)
ROOT::Math::SVector< double, 5 > AlgebraicVector5