Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:09:50

0001 // This file is part of the Acts project.
0002 //
0003 // Copyright (C) 2019-2023 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 http://mozilla.org/MPL/2.0/.
0008 
0009 #include "ActsExamples/Utilities/HitSelector.hpp"
0010 
0011 ActsExamples::HitSelector::HitSelector(const Config& config,
0012                                        Acts::Logging::Level level)
0013     : IAlgorithm("HitSelector", level), m_cfg(config) {
0014   m_inputHits.initialize(m_cfg.inputHits);
0015   m_outputHits.initialize(m_cfg.outputHits);
0016 }
0017 
0018 ActsExamples::ProcessCode ActsExamples::HitSelector::execute(
0019     const ActsExamples::AlgorithmContext& ctx) const {
0020   const auto& hits = m_inputHits(ctx);
0021   SimHitContainer selectedHits;
0022 
0023   std::copy_if(hits.begin(), hits.end(),
0024                std::inserter(selectedHits, selectedHits.begin()),
0025                [&](const auto& hit) { return hit.time() < m_cfg.maxTime; });
0026 
0027   ACTS_DEBUG("selected " << selectedHits.size() << " from " << hits.size()
0028                          << " hits");
0029 
0030   m_outputHits(ctx, std::move(selectedHits));
0031 
0032   return {};
0033 }