22 #include <system_error>
30 throw std::invalid_argument(
31 "You have to either provide track parameters or trajectories");
34 throw std::invalid_argument(
"Missing input proto vertices collection");
50 auto propagator = std::make_shared<Propagator>(
64 auto [inputTrackParameters, inputTrackPointers] =
67 if (inputTrackParameters.size() != inputTrackPointers.size()) {
68 ACTS_ERROR(
"Input track containers do not align: "
69 << inputTrackParameters.size()
70 <<
" != " << inputTrackPointers.size());
73 ACTS_VERBOSE(
"Have " << inputTrackParameters.size() <<
" track parameters");
74 const auto& protoVertices = m_inputProtoVertices(ctx);
75 ACTS_VERBOSE(
"Have " << protoVertices.size() <<
" proto vertices");
77 std::vector<const Acts::BoundTrackParameters*> inputTrackPtrCollection;
81 for (
const auto& protoVertex : protoVertices) {
83 if ((not
m_cfg.doConstrainedFit) and (protoVertex.size() < 2)) {
85 "Skip un-constrained vertex fit on proto-vertex with less than two "
91 inputTrackPtrCollection.clear();
92 inputTrackPtrCollection.reserve(protoVertex.size());
93 for (
const auto& trackIdx : protoVertex) {
94 if (trackIdx >= inputTrackParameters.size()) {
95 ACTS_ERROR(
"track parameters " << trackIdx <<
" does not exist");
99 inputTrackPtrCollection.push_back(inputTrackPointers[trackIdx]);
102 if (!
m_cfg.doConstrainedFit) {
105 auto fitRes = vertexFitter.
fit(inputTrackPtrCollection, linearizer,
108 fittedVertices.push_back(*fitRes);
110 ACTS_ERROR(
"Error in vertex fitter: " << fitRes.error().message());
123 auto fitRes = vertexFitter.
fit(inputTrackPtrCollection, linearizer,
124 vfOptionsConstr,
state);
126 fittedVertices.push_back(*fitRes);
129 "Error in constrained vertex fitter: " << fitRes.error().message());
133 if (fittedVertices.empty()) {
137 << fittedVertices.back().fullPosition().transpose());
139 "Tracks at fitted Vertex: " << fittedVertices.back().tracks().size());
143 m_outputVertices(ctx,
std::move(fittedVertices));