File indexing completed on 2025-01-18 09:11:43
0001
0002
0003
0004
0005
0006
0007
0008
0009 #include "ActsExamples/Utilities/TracksToParameters.hpp"
0010
0011 #include "Acts/EventData/GenericBoundTrackParameters.hpp"
0012 #include "Acts/EventData/MultiTrajectory.hpp"
0013 #include "Acts/EventData/TrackContainer.hpp"
0014 #include "Acts/EventData/TrackProxy.hpp"
0015 #include "Acts/Surfaces/Surface.hpp"
0016 #include "Acts/Utilities/HashedString.hpp"
0017 #include "ActsExamples/EventData/Track.hpp"
0018 #include "ActsExamples/EventData/Trajectories.hpp"
0019
0020 #include <optional>
0021 #include <utility>
0022 #include <vector>
0023
0024 namespace ActsExamples {
0025
0026 TracksToParameters::TracksToParameters(Config cfg, Acts::Logging::Level lvl)
0027 : IAlgorithm("TracksToParameters", lvl), m_cfg(std::move(cfg)) {
0028 m_inputTracks.initialize(m_cfg.inputTracks);
0029 m_outputTrackParameters.initialize(m_cfg.outputTrackParameters);
0030 }
0031
0032 ProcessCode TracksToParameters::execute(const AlgorithmContext& ctx) const {
0033 const auto& tracks = m_inputTracks(ctx);
0034
0035 TrackParametersContainer trackParameters;
0036 trackParameters.reserve(tracks.size());
0037
0038 for (const auto& track : tracks) {
0039 if (!track.hasReferenceSurface()) {
0040 ACTS_ERROR("Track has no reference surface");
0041 } else {
0042 trackParameters.push_back(track.createParametersAtReference());
0043 }
0044 }
0045
0046 ACTS_INFO("Converted " << tracks.size() << " tracks to "
0047 << trackParameters.size() << " track parameters");
0048
0049 m_outputTrackParameters(ctx, std::move(trackParameters));
0050
0051 return ProcessCode::SUCCESS;
0052 }
0053
0054 }