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>
45 bool isSmallShift =
true;
48 unsigned int nIter = 0;
51 while (nIter <
m_cfg.maxIterations &&
68 if (xyDiff.norm() >
m_cfg.maxDistToLinPoint) {
73 prepareVertexForFit(state, vtx, vertexingOptions);
77 if (state.
vtxInfoMap[vtx].constraint.fullCovariance() !=
78 SquareMatrix4::Zero()) {
84 }
else if (vtx->fullCovariance() == SquareMatrix4::Zero()) {
85 return VertexingError::NoCovariance;
88 vtx->setFullCovariance(vtx->fullCovariance() / weight);
92 setAllVertexCompatibilities(state, vtx, vertexingOptions);
96 setWeightsAndUpdate(state, linearizer, vertexingOptions);
104 isSmallShift = checkSmallShift(state);
110 if (
m_cfg.doSmoothing) {
111 doVertexSmoothing(state);
117 template <
typename input_track_t,
typename linearizer_t>
123 if (state.
vtxInfoMap[&newVertex].trackLinks.empty()) {
124 return VertexingError::EmptyInput;
127 std::vector<Vertex<input_track_t>*> verticesToFit;
130 auto res = prepareVertexForFit(state, &newVertex, vertexingOptions);
136 std::vector<Vertex<input_track_t>*> lastIterAddedVertices = {&newVertex};
138 std::vector<Vertex<input_track_t>*> currentIterAddedVertices;
142 while (!lastIterAddedVertices.empty()) {
143 for (
auto& lastIterAddedVertex : lastIterAddedVertices) {
145 const std::vector<const input_track_t*>& trks =
146 state.
vtxInfoMap[lastIterAddedVertex].trackLinks;
147 for (
const auto& trk : trks) {
157 auto vtxToFit =
it->second;
159 if (!isAlreadyInList(vtxToFit, verticesToFit)) {
160 verticesToFit.push_back(vtxToFit);
163 if (vtxToFit != lastIterAddedVertex) {
164 currentIterAddedVertices.push_back(vtxToFit);
171 lastIterAddedVertices = currentIterAddedVertices;
172 currentIterAddedVertices.clear();
178 auto fitRes = fitImpl(state, linearizer, vertexingOptions);
180 return fitRes.error();
186 template <
typename input_track_t,
typename linearizer_t>
193 template <
typename input_track_t,
typename linearizer_t>
201 const Vector3& seedPos = vtxInfo.seedPosition.template head<3>();
204 for (
const auto& trk : vtxInfo.trackLinks) {
205 auto res =
m_cfg.ipEst.estimate3DImpactParameters(
207 m_extractParameters(*trk), seedPos, state.
ipState);
212 vtxInfo.impactParams3D.emplace(trk, res.value());
217 template <
typename input_track_t,
typename linearizer_t>
232 auto res =
m_cfg.ipEst.estimate3DImpactParameters(
245 compatibilityResult =
m_cfg.ipEst.template getVertexCompatibility<4>(
249 compatibilityResult =
m_cfg.ipEst.template getVertexCompatibility<3>(
253 if (!compatibilityResult.ok()) {
254 return compatibilityResult.error();
256 trkAtVtx.vertexCompatibility = *compatibilityResult;
261 template <
typename input_track_t,
typename linearizer_t>
273 const std::shared_ptr<PerigeeSurface> vtxPerigeeSurface =
274 Surface::makeShared<PerigeeSurface>(
281 trkAtVtx.trackWeight =
m_cfg.annealingTool.getWeight(
283 collectTrackToVertexCompatibilities(state, trk));
285 if (trkAtVtx.trackWeight >
m_cfg.minWeight) {
288 if (!trkAtVtx.isLinearized || vtxInfo.
relinearize) {
289 auto result = linearizer.linearizeTrack(
290 m_extractParameters(*trk), vtxInfo.
linPoint[3],
291 *vtxPerigeeSurface, vertexingOptions.
geoContext,
294 return result.error();
297 trkAtVtx.linearizedState = *result;
298 trkAtVtx.isLinearized =
true;
301 KalmanVertexUpdater::updateVertexWithTrack<input_track_t>(*vtx,
307 ACTS_VERBOSE(
"New vertex position: " << vtx->fullPosition().transpose());
313 template <
typename input_track_t,
typename linearizer_t>
317 const input_track_t* trk)
const {
319 std::vector<double> trkToVtxCompatibilities;
332 trkToVtxCompatibilities.push_back(
334 .vertexCompatibility);
337 return trkToVtxCompatibilities;
340 template <
typename input_track_t,
typename linearizer_t>
345 state.
vtxInfoMap[vtx].oldPosition.template head<3>() - vtx->position();
347 double relativeShift = diff.dot(vtxCov.inverse() * diff);
348 if (relativeShift >
m_cfg.maxRelativeShift) {
355 template <
typename input_track_t,
typename linearizer_t>
359 for (
const auto trk : state.
vtxInfoMap[vtx].trackLinks) {
361 if (trkAtVtx.trackWeight >
m_cfg.minWeight) {
362 KalmanVertexTrackUpdater::update<input_track_t>(trkAtVtx, *vtx);