File indexing completed on 2025-01-18 09:10:44
0001
0002
0003
0004
0005
0006
0007
0008
0009 #pragma once
0010
0011 #include "Acts/EventData/MultiTrajectoryHelpers.hpp"
0012 #include "Acts/EventData/SourceLink.hpp"
0013 #include "Acts/EventData/TrackContainer.hpp"
0014 #include "Acts/EventData/TrackContainerFrontendConcept.hpp"
0015 #include "Acts/Utilities/Delegate.hpp"
0016 #include "Acts/Utilities/Logger.hpp"
0017
0018 #include <memory>
0019
0020 #include <boost/container/flat_map.hpp>
0021 #include <boost/container/flat_set.hpp>
0022
0023 namespace Acts {
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038 class GreedyAmbiguityResolution {
0039 public:
0040 struct Config {
0041
0042 std::uint32_t maximumSharedHits = 1;
0043
0044 std::uint32_t maximumIterations = 1000;
0045
0046
0047 std::size_t nMeasurementsMin = 7;
0048 };
0049
0050 struct State {
0051 std::size_t numberOfTracks{};
0052
0053 std::vector<int> trackTips;
0054 std::vector<float> trackChi2;
0055 std::vector<std::vector<std::size_t>> measurementsPerTrack;
0056
0057
0058 boost::container::flat_map<std::size_t,
0059 boost::container::flat_set<std::size_t>>
0060 tracksPerMeasurement;
0061 std::vector<std::size_t> sharedMeasurementsPerTrack;
0062
0063
0064 boost::container::flat_set<std::size_t> selectedTracks;
0065 };
0066
0067 GreedyAmbiguityResolution(const Config& cfg,
0068 std::unique_ptr<const Logger> logger =
0069 getDefaultLogger("GreedyAmbiguityResolution",
0070 Logging::INFO))
0071 : m_cfg{cfg}, m_logger{std::move(logger)} {}
0072
0073
0074
0075
0076
0077
0078
0079
0080
0081 template <TrackContainerFrontend track_container_t,
0082 typename source_link_hash_t, typename source_link_equality_t>
0083 void computeInitialState(const track_container_t& tracks, State& state,
0084 source_link_hash_t&& sourceLinkHash,
0085 source_link_equality_t&& sourceLinkEquality) const;
0086
0087
0088
0089
0090
0091 void resolve(State& state) const;
0092
0093 private:
0094 Config m_cfg;
0095
0096
0097 std::unique_ptr<const Logger> m_logger;
0098
0099
0100 const Logger& logger() const { return *m_logger; }
0101 };
0102
0103 }
0104
0105 #include "Acts/AmbiguityResolution/GreedyAmbiguityResolution.ipp"