13 template <
typename input_track_t,
typename linearizer_t>
23 auto fitRes = fitImpl(state, linearizer, vertexingOptions);
26 return fitRes.error();
32 template <
typename input_track_t,
typename linearizer_t>
48 bool isSmallShift =
true;
51 unsigned int nIter = 0;
54 while (nIter < m_cfg.maxIterations &&
64 currentVtxInfo.
oldPosition = currentVtx->fullPosition();
68 double perpDist = std::sqrt(dist[0] * dist[0] + dist[1] * dist[1]);
70 if (perpDist > m_cfg.maxDistToLinPoint) {
74 prepareVertexForFit(state, currentVtx, vertexingOptions);
77 if (state.
vtxInfoMap[currentVtx].constraintVertex.fullCovariance() !=
78 SpacePointSymMatrix::Zero()) {
79 currentVtx->setFullPosition(
80 state.
vtxInfoMap[currentVtx].constraintVertex.fullPosition());
81 currentVtx->setFitQuality(
82 state.
vtxInfoMap[currentVtx].constraintVertex.fitQuality());
83 currentVtx->setFullCovariance(
84 state.
vtxInfoMap[currentVtx].constraintVertex.fullCovariance());
87 else if (currentVtx->fullCovariance() == SpacePointSymMatrix::Zero()) {
88 return VertexingError::NoCovariance;
93 currentVtx->setFullCovariance(currentVtx->fullCovariance() *
weight);
97 setAllVertexCompatibilities(state, currentVtx, vertexingOptions);
103 setWeightsAndUpdate(state, linearizer, vertexingOptions);
107 isSmallShift = checkSmallShift(state);
114 if (m_cfg.doSmoothing) {
121 template <
typename input_track_t,
typename linearizer_t>
127 if (state.
vtxInfoMap[&newVertex].trackLinks.empty()) {
128 return VertexingError::EmptyInput;
131 std::vector<Vertex<input_track_t>*> verticesToFit;
135 auto res = prepareVertexForFit(state, &newVertex, vertexingOptions);
140 std::vector<Vertex<input_track_t>*> lastIterAddedVertices = {&newVertex};
142 std::vector<Vertex<input_track_t>*> currentIterAddedVertices;
146 while (!lastIterAddedVertices.empty()) {
147 for (
auto& lastVtxIter : lastIterAddedVertices) {
149 const std::vector<const input_track_t*>& trks =
151 for (
const auto& trk : trks) {
158 for (
auto vtxIter = range.first; vtxIter != range.second; ++vtxIter) {
159 auto newVtxIter = vtxIter->second;
160 if (!isAlreadyInList(newVtxIter, verticesToFit)) {
162 verticesToFit.push_back(newVtxIter);
166 if (newVtxIter != lastVtxIter) {
167 currentIterAddedVertices.push_back(newVtxIter);
174 lastIterAddedVertices = currentIterAddedVertices;
175 currentIterAddedVertices.clear();
181 auto fitRes = fitImpl(state, linearizer, vertexingOptions);
183 return fitRes.error();
189 template <
typename input_track_t,
typename linearizer_t>
194 return std::find(verticesVec.begin(), verticesVec.end(), vtx) !=
198 template <
typename input_track_t,
typename linearizer_t>
206 const Vector3D& seedPos = currentVtxInfo.seedPosition.template head<3>();
209 for (
const auto& trk : currentVtxInfo.trackLinks) {
210 auto res = m_cfg.ipEst.estimate3DImpactParameters(
212 m_extractParameters(*trk), seedPos);
217 currentVtxInfo.ip3dParams.emplace(trk, *(res.value()));
222 template <
typename input_track_t,
typename linearizer_t>
232 for (
const auto& trk : currentVtxInfo.
trackLinks) {
239 auto res = m_cfg.ipEst.estimate3DImpactParameters(
241 m_extractParameters(*trk),
247 currentVtxInfo.
ip3dParams.emplace(trk, *(res.value()));
250 auto compRes = m_cfg.ipEst.get3dVertexCompatibility(
254 return compRes.error();
256 trkAtVtx.vertexCompatibility = *compRes;
261 template <
typename input_track_t,
typename linearizer_t>
269 for (
const auto& trk : currentVtxInfo.
trackLinks) {
273 double currentTrkWeight = m_cfg.annealingTool.getWeight(
275 collectTrackToVertexCompatibilities(state, trk));
276 trkAtVtx.trackWeight = currentTrkWeight;
278 if (trkAtVtx.trackWeight > m_cfg.minWeight) {
280 if (trkAtVtx.linearizedState.covarianceAtPCA ==
281 BoundSymMatrix::Zero() ||
283 auto result = linearizer.linearizeTrack(
284 m_extractParameters(*trk), state.
vtxInfoMap[vtx].oldPosition,
287 return result.error();
289 trkAtVtx.linearizedState = *result;
293 KalmanVertexUpdater::updateVertexWithTrack<input_track_t>(*vtx,
300 ACTS_VERBOSE(
"New vertex position: " << vtx->fullPosition());
306 template <
typename input_track_t,
typename linearizer_t>
310 const input_track_t* trk)
const {
311 std::vector<double> trkToVtxCompatibilities;
315 for (
auto vtxIter = range.first; vtxIter != range.second; ++vtxIter) {
316 trkToVtxCompatibilities.push_back(
318 .vertexCompatibility);
321 return trkToVtxCompatibilities;
324 template <
typename input_track_t,
typename linearizer_t>
328 auto diff = state.
vtxInfoMap[vtx].oldPosition.template head<3>() -
329 vtx->fullPosition().template head<3>();
331 (vtx->fullCovariance().template
block<3, 3>(0, 0)).inverse();
332 double relativeShift = diff.dot(vtxWgt * diff);
333 if (relativeShift > m_cfg.maxRelativeShift) {
340 template <
typename input_track_t,
typename linearizer_t>
344 for (
const auto trk : state.
vtxInfoMap[vtx].trackLinks) {
345 KalmanVertexTrackUpdater::update<input_track_t>(