Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:11:43

0001 // This file is part of the ACTS project.
0002 //
0003 // Copyright (C) 2016 CERN for the benefit of the ACTS project
0004 //
0005 // This Source Code Form is subject to the terms of the Mozilla Public
0006 // License, v. 2.0. If a copy of the MPL was not distributed with this
0007 // file, You can obtain one at https://mozilla.org/MPL/2.0/.
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 }  // namespace ActsExamples