21 namespace ActsExamples {
22 struct AlgorithmContext;
27 : ActsExamples::
IAlgorithm(
"SurfaceSortingAlgorithm", level),
30 throw std::invalid_argument(
"Missing input proto track collection");
33 throw std::invalid_argument(
"Missing input simulated hits collection");
36 throw std::invalid_argument(
"Missing input measurement sim hits map");
39 throw std::invalid_argument(
"Missing output proto track collection");
50 const auto& protoTracks = m_inputProtoTracks(ctx);
51 const auto& simHits = m_inputSimHits(ctx);
52 const auto& simHitsMap = m_inputMeasurementSimHitsMap(ctx);
55 sortedTracks.reserve(protoTracks.size());
58 for (std::size_t itrack = 0; itrack < protoTracks.size(); ++itrack) {
59 const auto& protoTrack = protoTracks[itrack];
62 sortedProtoTrack.reserve(protoTrack.size());
65 if (protoTrack.empty()) {
69 for (
const auto hit : protoTrack) {
70 const auto simHitIndex = simHitsMap.find(hit)->second;
71 auto simHit = simHits.nth(simHitIndex);
72 auto simHitTime = simHit->time();
73 trackHitList.insert(std::make_pair(simHitTime, hit));
77 for (
auto const& [
time, hit] : trackHitList) {
78 sortedProtoTrack.emplace_back(hit);
81 sortedTracks.emplace_back(
std::move(sortedProtoTrack));
84 m_outputProtoTracks(ctx,
std::move(sortedTracks));