20 track.reserve(seed.
sp().size());
21 for (
auto spacePointPtr : seed.
sp()) {
22 for (
const auto& slink : spacePointPtr->sourceLinks()) {
24 track.emplace_back(islink.index());
34 return std::any_of(sls.begin(), sls.end(), [&](
const auto& sl) {
35 return sl.template get<IndexSourceLink>().
index() ==
index;
39 auto found = std::find_if(spacepoints.begin(), spacepoints.end(), match);
41 if (found == spacepoints.end()) {
53 if (found ==
nullptr) {
54 throw std::runtime_error(
"No spacepoint found for source-link index " +
60 const auto s = track.size();
62 throw std::runtime_error(
63 "Cannot convert track with less then 3 spacepoints to seed");
66 std::vector<const SimSpacePoint*>
ps;
67 ps.reserve(track.size());
72 [](
const auto&
a,
const auto&
b) {
return a->r() <
b->r(); });
77 (ps.back()->r() - ps.front()->r()) / (ps.back()->z() - ps.front()->z());
78 const auto t = ps.front()->r() - m * ps.front()->z();
79 const auto z_vertex = -
t /
m;
81 return SimSeed(*ps[0], *ps[
s / 2], *ps[
s - 1], z_vertex);