Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TrajectoriesToPrototracks.cpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file TrajectoriesToPrototracks.cpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2022 CERN for the benefit of the Acts project
4 //
5 // This Source Code Form is subject to the terms of the Mozilla Public
6 // License, v. 2.0. If a copy of the MPL was not distributed with this
7 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 
10 
14 
15 #include <utility>
16 #include <vector>
17 
18 namespace ActsExamples {
19 class IndexSourceLink;
20 struct AlgorithmContext;
21 
24  : IAlgorithm("TrajectoriesToPrototracks", lvl), m_cfg(std::move(cfg)) {
27 }
28 
30  const AlgorithmContext& ctx) const {
31  const auto trajectories = m_inputTrajectories(ctx);
32 
34 
35  for (const auto& trajectory : trajectories) {
36  for (const auto tip : trajectory.tips()) {
37  ProtoTrack track;
38 
39  trajectory.multiTrajectory().visitBackwards(tip, [&](const auto& state) {
40  if (not state.typeFlags().test(Acts::TrackStateFlag::MeasurementFlag)) {
41  return true;
42  }
43 
44  auto source_link =
45  state.getUncalibratedSourceLink().template get<IndexSourceLink>();
46  track.push_back(source_link.index());
47 
48  return true;
49  });
50 
51  tracks.push_back(track);
52  }
53  }
54 
55  m_outputProtoTracks(ctx, std::move(tracks));
56 
57  return ProcessCode::SUCCESS;
58 }
59 } // namespace ActsExamples