Analysis Software
Documentation for
sPHENIX
simulation software
Home page
Related Pages
Modules
Namespaces
Classes
Files
Examples
External Links
File List
File Members
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
9
#include "
ActsExamples/Utilities/TrajectoriesToPrototracks.hpp
"
10
11
#include "
Acts/EventData/MultiTrajectory.hpp
"
12
#include "
ActsExamples/EventData/ProtoTrack.hpp
"
13
#include "
ActsExamples/EventData/Trajectories.hpp
"
14
15
#include <utility>
16
#include <vector>
17
18
namespace
ActsExamples {
19
class
IndexSourceLink;
20
struct
AlgorithmContext;
21
22
TrajectoriesToPrototracks::TrajectoriesToPrototracks
(
Config
cfg
,
23
Acts::Logging::Level
lvl)
24
:
IAlgorithm
(
"TrajectoriesToPrototracks"
, lvl),
m_cfg
(std::
move
(cfg)) {
25
m_inputTrajectories
.
initialize
(
m_cfg
.
inputTrajectories
);
26
m_outputProtoTracks
.
initialize
(
m_cfg
.
outputProtoTracks
);
27
}
28
29
ProcessCode
TrajectoriesToPrototracks::execute
(
30
const
AlgorithmContext
& ctx)
const
{
31
const
auto
trajectories =
m_inputTrajectories
(ctx);
32
33
ProtoTrackContainer
tracks
;
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
acts
blob
sPHENIX
Examples
Algorithms
Utilities
src
TrajectoriesToPrototracks.cpp
Built by
Jin Huang
. updated:
Sat Feb 17 2024 22:17:37
using
1.8.2 with
sPHENIX GitHub integration