File indexing completed on 2025-01-18 09:11:43
0001
0002
0003
0004
0005
0006
0007
0008
0009 #include "ActsExamples/Utilities/PrototracksToSeeds.hpp"
0010
0011 #include "ActsExamples/EventData/IndexSourceLink.hpp"
0012 #include "ActsExamples/EventData/ProtoTrack.hpp"
0013 #include "ActsExamples/EventData/SimSeed.hpp"
0014 #include "ActsExamples/Framework/WhiteBoard.hpp"
0015 #include "ActsExamples/Utilities/EventDataTransforms.hpp"
0016
0017 #include <algorithm>
0018
0019 namespace ActsExamples {
0020
0021 PrototracksToSeeds::PrototracksToSeeds(Config cfg, Acts::Logging::Level lvl)
0022 : IAlgorithm("PrototracksToSeeds", lvl), m_cfg(std::move(cfg)) {
0023 m_outputSeeds.initialize(m_cfg.outputSeeds);
0024 m_outputProtoTracks.initialize(m_cfg.outputProtoTracks);
0025 m_inputProtoTracks.initialize(m_cfg.inputProtoTracks);
0026 m_inputSpacePoints.initialize(m_cfg.inputSpacePoints);
0027 }
0028
0029 ProcessCode PrototracksToSeeds::execute(const AlgorithmContext& ctx) const {
0030 auto prototracks = m_inputProtoTracks(ctx);
0031
0032 const auto nBefore = prototracks.size();
0033 prototracks.erase(std::remove_if(prototracks.begin(), prototracks.end(),
0034 [](const auto& t) { return t.size() < 3; }),
0035 prototracks.end());
0036 ACTS_DEBUG("Discarded " << prototracks.size() - nBefore
0037 << " prototracks with less then 3 hits");
0038
0039 SimSeedContainer seeds;
0040 seeds.reserve(prototracks.size());
0041
0042 const auto& sps = m_inputSpacePoints(ctx);
0043 std::transform(prototracks.begin(), prototracks.end(),
0044 std::back_inserter(seeds),
0045 [&](const auto& pt) { return prototrackToSeed(pt, sps); });
0046
0047 m_outputSeeds(ctx, std::move(seeds));
0048 m_outputProtoTracks(ctx, std::move(prototracks));
0049
0050 return ProcessCode::SUCCESS;
0051 }
0052
0053 }