Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /acts/Examples/Algorithms/Utilities/src/ProtoTracksToSeeds.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/ProtoTracksToSeeds.hpp"
0010 
0011 #include "ActsExamples/Utilities/EventDataTransforms.hpp"
0012 
0013 #include <algorithm>
0014 #include <cstddef>
0015 
0016 namespace ActsExamples {
0017 
0018 ProtoTracksToSeeds::ProtoTracksToSeeds(
0019     Config cfg, std::unique_ptr<const Acts::Logger> logger)
0020     : IAlgorithm("ProtoTracksToSeeds", std::move(logger)),
0021       m_cfg(std::move(cfg)) {
0022   m_inputSpacePoints.initialize(m_cfg.inputSpacePoints);
0023   m_inputProtoTracks.initialize(m_cfg.inputProtoTracks);
0024   m_outputSeeds.initialize(m_cfg.outputSeeds);
0025   m_outputProtoTracks.initialize(m_cfg.outputProtoTracks);
0026 }
0027 
0028 ProcessCode ProtoTracksToSeeds::execute(const AlgorithmContext& ctx) const {
0029   const SpacePointContainer& spacePoints = m_inputSpacePoints(ctx);
0030   ProtoTrackContainer protoTracks = m_inputProtoTracks(ctx);
0031 
0032   const std::size_t nBefore = protoTracks.size();
0033   protoTracks.erase(
0034       std::remove_if(protoTracks.begin(), protoTracks.end(),
0035                      [](const ProtoTrack& pt) { return pt.size() < 3; }),
0036       protoTracks.end());
0037 
0038   if (protoTracks.size() < nBefore) {
0039     ACTS_DEBUG("Discarded " << nBefore - protoTracks.size()
0040                             << " proto tracks with less then 3 hits");
0041   }
0042 
0043   SeedContainer seeds;
0044   seeds.reserve(protoTracks.size());
0045 
0046   for (const ProtoTrack& pt : protoTracks) {
0047     protoTrackToSeed(pt, spacePoints, seeds);
0048   }
0049 
0050   m_outputSeeds(ctx, std::move(seeds));
0051   m_outputProtoTracks(ctx, std::move(protoTracks));
0052 
0053   return ProcessCode::SUCCESS;
0054 }
0055 
0056 }  // namespace ActsExamples