19 return StatusCode::FAILURE;
24 return StatusCode::SUCCESS;
30 declareInterface<IVertexTrackUpdator>(
this);
39 if(linTrack ==
nullptr)
44 msg(MSG::INFO) <<
"The VxTrackAtVertex passed does not have a Linearized Track" <<
endmsg;
45 msg(MSG::INFO) <<
"Please produce one with corresponding LinearizedTrackFactory"<<
endmsg;
46 msg(MSG::INFO) <<
"The VxTrackAtVertex returned not refitted"<<
endmsg;
61 const AmgMatrix(5,3) &
A = linTrack->positionJacobian();
62 const AmgMatrix(5,3) & B = linTrack->momentumJacobian();
63 const AmgVector(5) & trkParameters = linTrack->expectedParametersAtPCA();
67 const AmgSymMatrix(5) & trkParametersWeight = linTrack->expectedWeightAtPCA();
70 AmgSymMatrix(3) Sm = B.transpose()*(trkParametersWeight*B);
72 if (Sm.determinant() == 0.0) {
73 ATH_MSG_WARNING(
"Matrix can not be inverted, new type of check as part of Eigen, please monitor."
74 <<
endmsg <<
"Matrix Sm = " << Sm);
77 Sm = Sm.inverse().eval();
78 const AmgVector(5) & theResidual = linTrack->constantTerm();
81 Amg::Vector3D newTrackMomentum = Sm*B.transpose() * trkParametersWeight
82 * (trkParameters - theResidual -
A*fit_vrt_pos);
85 AmgVector(5) refTrkPar; refTrkPar.setZero();
86 refTrkPar(
Trk::phi) = newTrackMomentum(0);
142 const AmgSymMatrix(3)& vrt_cov = vtx.covariancePosition();
143 if (vrt_cov.determinant() == 0.0) {
144 ATH_MSG_WARNING(
"Matrix can not be inverted, new type of check as part of Eigen, please monitor."
145 <<
endmsg <<
"Matrix vrt_cov = " << vrt_cov);
151 vrt_weight = vtx.covariancePosition().inverse();
154 vtx.covariancePosition().computeInverseWithCheck(vrt_weight,invertible);
157 ATH_MSG_VERBOSE (
"The vertex's cov is not invertible, quit updating the track.");
162 AmgSymMatrix(3) posMomentumCovariance = -vrt_cov *
A.transpose() * trkParametersWeight * B *Sm;
171 reduced_vrt_weight = reducedVrt.covariancePosition.inverse();
173 reducedVrt.covariancePosition.computeInverseWithCheck(reduced_vrt_weight,invertible);
175 ATH_MSG_VERBOSE (
"The vertex's cov is not invertible, quit updating the track.");
183 AmgVector(5) smRes = trkParameters - (theResidual +
A*vtx.
position() + B*newTrackMomentum);
185 double chi2 = posDifference.dot(reduced_vrt_weight*posDifference) + smRes.dot(trkParametersWeight*smRes);
190 AmgSymMatrix(3) momentumCovariance = Sm + posMomentumCovariance.transpose()*(vrt_weight*posMomentumCovariance);
194 fullTrkCov.setZero();
196 fullTrkCov.block<3,3>(0,0) = vrt_cov;
197 fullTrkCov.block<3,3>(0,3) = posMomentumCovariance;
198 fullTrkCov.block<3,3>(3,0) = posMomentumCovariance.transpose();
199 fullTrkCov.block<3,3>(3,3) = momentumCovariance;
209 trJac(0,0) = -
sin(refTrkPar[2]);
210 trJac(0,1) =
cos(refTrkPar[2]);
213 trJac(1,0) = -
cos(refTrkPar[2])/
tan(refTrkPar[3]);
214 trJac(1,1) = -
sin(refTrkPar[2])/
tan(refTrkPar[3]);
229 std::move(perFullTrkCov));