Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-03-28 07:45:49

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/HelloWorld/HelloWhiteBoardAlgorithm.hpp"
0010 
0011 namespace ActsExamples {
0012 
0013 HelloWhiteBoardAlgorithm::HelloWhiteBoardAlgorithm(
0014     const Config& cfg, std::unique_ptr<const Acts::Logger> logger)
0015     : IAlgorithm("HelloWhiteBoard", std::move(logger)), m_cfg(cfg) {
0016   // non-optional config settings must be checked on construction.
0017   if (m_cfg.input.empty()) {
0018     throw std::invalid_argument("Missing input collection");
0019   }
0020   m_readHandle.initialize(m_cfg.input);
0021   if (m_cfg.output.empty()) {
0022     throw std::invalid_argument("Missing output collection");
0023   }
0024   m_writeHandle.initialize(m_cfg.output);
0025 }
0026 
0027 ProcessCode HelloWhiteBoardAlgorithm::execute(
0028     const AlgorithmContext& ctx) const {
0029   // event-store is append-only and always returns a const reference.
0030   ACTS_INFO("Reading HelloDataCollection " << m_cfg.input);
0031   const auto& in = m_readHandle(ctx);
0032   ACTS_VERBOSE("Read HelloDataCollection with size " << in.size());
0033 
0034   // create a copy
0035   HelloDataCollection copy(in);
0036 
0037   // transfer the copy to the event store. this always transfers ownership
0038   // via r-value reference/ move construction.
0039   ACTS_INFO("Writing HelloDataCollection " << m_cfg.output);
0040   m_writeHandle(ctx, std::move(copy));
0041 
0042   return ProcessCode::SUCCESS;
0043 }
0044 
0045 }  // namespace ActsExamples