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
HelloWorld.cpp
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file HelloWorld.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
11
12
#include "
ActsExamples/Framework/RandomNumbers.hpp
"
13
#include "
ActsExamples/Framework/Sequencer.hpp
"
14
#include "
ActsExamples/Options/CommonOptions.hpp
"
15
16
#include <cstdlib>
17
#include <memory>
18
19
#include "
HelloLoggerAlgorithm.hpp
"
20
#include "
HelloRandomAlgorithm.hpp
"
21
#include "
HelloWhiteBoardAlgorithm.hpp
"
22
23
int
main
(
int
argc,
char
* argv[]) {
24
// setup options
25
// every component should have an associated option setup function
26
// that should be called here.
27
auto
opt =
ActsExamples::Options::makeDefaultOptions
();
28
ActsExamples::Options::addSequencerOptions
(opt);
29
ActsExamples::Options::addRandomNumbersOptions
(opt);
30
// parse options from command line flags
31
auto
vm =
ActsExamples::Options::parse
(opt, argc, argv);
32
// an empty variables map indicates an error
33
if
(vm.empty()) {
34
return
EXIT_FAILURE;
35
}
36
37
// extract some common options
38
auto
logLevel
=
ActsExamples::Options::readLogLevel
(vm);
39
40
// setup basic tools shared among algorithms
41
auto
rnd
= std::make_shared<ActsExamples::RandomNumbers>(
42
ActsExamples::Options::readRandomNumbersConfig
(vm));
43
44
// setup the sequencer first w/ config derived from options
45
ActsExamples::Sequencer
sequencer(
46
ActsExamples::Options::readSequencerConfig
(vm));
47
48
// add HelloWorld algorithm that does nothing
49
sequencer.addAlgorithm(
50
std::make_shared<ActsExamples::HelloLoggerAlgorithm>(
logLevel
));
51
52
// add HelloRandom algorithm that uses RandomNumbers to generate some
53
// random numbers from various distributions.
54
ActsExamples::HelloRandomAlgorithm::Config
rndCfg;
55
rndCfg.
randomNumbers
=
rnd
;
56
rndCfg.
gaussParameters
= {{0., 2.5}};
57
rndCfg.
uniformParameters
= {{-1.23, 4.25}};
58
rndCfg.
gammaParameters
= {{1., 1.}};
59
rndCfg.
drawsPerEvent
= 5000;
60
rndCfg.
output
=
"random_data"
;
61
sequencer.addAlgorithm(
62
std::make_shared<ActsExamples::HelloRandomAlgorithm>(rndCfg,
logLevel
));
63
64
// add HelloWhiteBoardAlgorithm the reads/writes data from/to the event store
65
ActsExamples::HelloWhiteBoardAlgorithm::Config
wbCfg;
66
// use data from previous algorithm as input
67
wbCfg.
input
= rndCfg.
output
;
68
wbCfg.
output
=
"copied_data"
;
69
sequencer.addAlgorithm(
70
std::make_shared<ActsExamples::HelloWhiteBoardAlgorithm>(wbCfg,
71
logLevel
));
72
73
// Run all configured algorithms and return the appropriate status.
74
return
sequencer.run();
75
}
acts
blob
sPHENIX
Examples
Run
HelloWorld
HelloWorld.cpp
Built by
Jin Huang
. updated:
Sat Feb 17 2024 22:17:40
using
1.8.2 with
sPHENIX GitHub integration