Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:11:43

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/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 }  // namespace ActsExamples