Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /acts/Examples/Algorithms/Utilities/src/TrajectoriesToProtoTracks.cpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

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/TrajectoriesToProtoTracks.hpp"
0010 
0011 #include "ActsExamples/EventData/IndexSourceLink.hpp"
0012 #include "ActsExamples/EventData/ProtoTrack.hpp"
0013 #include "ActsExamples/EventData/Trajectories.hpp"
0014 
0015 #include <utility>
0016 #include <vector>
0017 
0018 namespace ActsExamples {
0019 
0020 TrajectoriesToProtoTracks::TrajectoriesToProtoTracks(
0021     Config cfg, std::unique_ptr<const Acts::Logger> logger)
0022     : IAlgorithm("TrajectoriesToProtoTracks", std::move(logger)),
0023       m_cfg(std::move(cfg)) {
0024   m_inputTrajectories.initialize(m_cfg.inputTrajectories);
0025   m_outputProtoTracks.initialize(m_cfg.outputProtoTracks);
0026 }
0027 
0028 ProcessCode TrajectoriesToProtoTracks::execute(
0029     const AlgorithmContext& ctx) const {
0030   const auto trajectories = m_inputTrajectories(ctx);
0031 
0032   ProtoTrackContainer tracks;
0033 
0034   for (const auto& trajectory : trajectories) {
0035     for (const auto tip : trajectory.tips()) {
0036       ProtoTrack track;
0037 
0038       trajectory.multiTrajectory().visitBackwards(tip, [&](const auto& state) {
0039         if (!state.typeFlags().isMeasurement()) {
0040           return true;
0041         }
0042 
0043         const auto sourceLink =
0044             state.getUncalibratedSourceLink().template get<IndexSourceLink>();
0045         track.push_back(sourceLink.index());
0046 
0047         return true;
0048       });
0049 
0050       tracks.push_back(track);
0051     }
0052   }
0053 
0054   m_outputProtoTracks(ctx, std::move(tracks));
0055 
0056   return ProcessCode::SUCCESS;
0057 }
0058 }  // namespace ActsExamples