Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:11:33

0001 // This file is part of the ACTS project.
0002 //
0003 // Copyright (C) 2016 CERN for the benefit of the ACTS project
0004 //
0005 // This Source Code Form is subject to the terms of the Mozilla Public
0006 // License, v. 2.0. If a copy of the MPL was not distributed with this
0007 // file, You can obtain one at https://mozilla.org/MPL/2.0/.
0008 
0009 #include "Acts/Vertexing/KalmanVertexUpdater.hpp"
0010 
0011 #include "Acts/Vertexing/Vertex.hpp"
0012 
0013 #include <stdexcept>
0014 
0015 namespace Acts::KalmanVertexUpdater {
0016 
0017 namespace detail {
0018 template <unsigned int nDimVertex>
0019 void updateVertexWithTrackImpl(Vertex& vtx, TrackAtVertex& trk, int sign);
0020 
0021 template <unsigned int nDimVertex>
0022 void updateTrackWithVertexImpl(TrackAtVertex& track, const Vertex& vtx);
0023 }  // namespace detail
0024 
0025 // The two functions don't contain any of the actual update code, they
0026 // only dispatch into templated functions, effectively doing a
0027 // runtime-to-compile time conversion.
0028 
0029 void updateVertexWithTrack(Vertex& vtx, TrackAtVertex& trk,
0030                            unsigned int nDimVertex) {
0031   if (nDimVertex == 3) {
0032     detail::updateVertexWithTrackImpl<3>(vtx, trk, 1);
0033   } else if (nDimVertex == 4) {
0034     detail::updateVertexWithTrackImpl<4>(vtx, trk, 1);
0035   } else {
0036     throw std::invalid_argument(
0037         "The vertex dimension must either be 3 (when fitting the spatial "
0038         "coordinates) or 4 (when fitting the spatial coordinates + time).");
0039   }
0040 }
0041 
0042 void updateTrackWithVertex(TrackAtVertex& track, const Vertex& vtx,
0043                            unsigned int nDimVertex) {
0044   if (nDimVertex == 3) {
0045     detail::updateTrackWithVertexImpl<3>(track, vtx);
0046   } else if (nDimVertex == 4) {
0047     detail::updateTrackWithVertexImpl<4>(track, vtx);
0048   } else {
0049     throw std::invalid_argument(
0050         "The vertex dimension must either be 3 (when fitting the spatial "
0051         "coordinates) or 4 (when fitting the spatial coordinates + time).");
0052   }
0053 }
0054 
0055 }  // namespace Acts::KalmanVertexUpdater