Analysis Software
Documentation for
sPHENIX
simulation software
Home page
Related Pages
Modules
Namespaces
Classes
Files
Examples
External Links
File List
File Members
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
9
#include "
HelloWhiteBoardAlgorithm.hpp
"
10
11
#include "
ActsExamples/Framework/WhiteBoard.hpp
"
12
13
#include "
HelloData.hpp
"
14
15
ActsExamples::HelloWhiteBoardAlgorithm::HelloWhiteBoardAlgorithm
(
16
const
Config
&
cfg
,
Acts::Logging::Level
level
)
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
}
22
m_readHandle
.
initialize
(
m_cfg
.
input
);
23
if
(
m_cfg
.
output
.empty()) {
24
throw
std::invalid_argument(
"Missing output collection"
);
25
}
26
m_writeHandle
.
initialize
(
m_cfg
.
output
);
27
}
28
29
ActsExamples::ProcessCode
ActsExamples::HelloWhiteBoardAlgorithm::execute
(
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
44
return
ActsExamples::ProcessCode::SUCCESS
;
45
}
acts
blob
sPHENIX
Examples
Run
HelloWorld
HelloWhiteBoardAlgorithm.cpp
Built by
Jin Huang
. updated:
Sat Feb 17 2024 22:17:40
using
1.8.2 with
sPHENIX GitHub integration