Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
HelloWhiteBoardAlgorithm.cpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file HelloWhiteBoardAlgorithm.cpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2017-2019 CERN for the benefit of the Acts project
4 //
5 // This Source Code Form is subject to the terms of the Mozilla Public
6 // License, v. 2.0. If a copy of the MPL was not distributed with this
7 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 
10 
12 
13 #include "HelloData.hpp"
14 
17  : ActsExamples::IAlgorithm("HelloWhiteBoard", level), m_cfg(cfg) {
18  // non-optional config settings must be checked on construction.
19  if (m_cfg.input.empty()) {
20  throw std::invalid_argument("Missing input collection");
21  }
23  if (m_cfg.output.empty()) {
24  throw std::invalid_argument("Missing output collection");
25  }
27 }
28 
30  const ActsExamples::AlgorithmContext& ctx) const {
31  // event-store is append-only and always returns a const reference.
32  ACTS_INFO("Reading HelloDataCollection " << m_cfg.input);
33  const auto& in = m_readHandle(ctx);
34  ACTS_VERBOSE("Read HelloDataCollection with size " << in.size());
35 
36  // create a copy
37  HelloDataCollection copy(in);
38 
39  // transfer the copy to the event store. this always transfers ownership
40  // via r-value reference/ move construction.
41  ACTS_INFO("Writing HelloDataCollection " << m_cfg.output);
42  m_writeHandle(ctx, std::move(copy));
43 
45 }