ECCE @ EIC Software
Reference for
ECCE @ EIC
simulation and reconstruction software on GitHub
Home page
Related Pages
Modules
Namespaces
Classes
Files
External Links
File List
File Members
ECCE @ EIC Software
Deprecated List
Modules
Namespaces
Classes
Files
File List
acts
blob
master
CI
Core
doc
Examples
Algorithms
Detectors
Framework
Io
Run
Common
EventGenerator
Fatras
Geometry
HelloWorld
HelloData.hpp
HelloLoggerAlgorithm.cpp
HelloLoggerAlgorithm.hpp
HelloRandomAlgorithm.cpp
HelloRandomAlgorithm.hpp
HelloService.cpp
HelloService.hpp
HelloWhiteBoardAlgorithm.cpp
HelloWhiteBoardAlgorithm.hpp
HelloWorld.cpp
HepMC3
MagneticField
MaterialMapping
Misc
Propagation
ReadCsv
Reconstruction
Vertexing
Scripts
Fatras
Plugins
Tests
thirdparty
analysis
coresoftware
Doxygen_Assist
ecce-detectors
fun4all_eicdetectors
geant4
macros
online_distribution
tutorials
doxygen_mainpage.h
File Members
External Links
•
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 <cstdlib>
13
#include <memory>
14
15
#include "
ACTFW/Framework/RandomNumbers.hpp
"
16
#include "
ACTFW/Framework/Sequencer.hpp
"
17
#include "
ACTFW/Options/CommonOptions.hpp
"
18
#include "
HelloLoggerAlgorithm.hpp
"
19
#include "
HelloRandomAlgorithm.hpp
"
20
#include "
HelloService.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 =
FW::Options::makeDefaultOptions
();
28
FW::Options::addSequencerOptions
(opt);
29
FW::Options::addRandomNumbersOptions
(opt);
30
// parse options from command line flags
31
auto
vm =
FW::Options::parse
(opt, argc, argv);
32
// an empty varaibles map indicates an error
33
if
(vm.empty()) {
34
return
EXIT_FAILURE;
35
}
36
37
// extract some common options
38
auto
logLevel =
FW::Options::readLogLevel
(vm);
39
40
// setup basic tools shared among algorithms
41
auto
rnd = std::make_shared<FW::RandomNumbers>(
42
FW::Options::readRandomNumbersConfig
(vm));
43
44
// setup the sequencer first w/ config derived from options
45
FW::Sequencer
sequencer(
FW::Options::readSequencerConfig
(vm));
46
47
// add HelloWorld algorithm that does nothing
48
sequencer.addAlgorithm(std::make_shared<FW::HelloLoggerAlgorithm>(logLevel));
49
50
// add HelloRandom algorithm that uses RandomNumbers to generate some
51
// random numbers from various distributions.
52
FW::HelloRandomAlgorithm::Config
rndCfg;
53
rndCfg.
randomNumbers
= rnd;
54
rndCfg.
gaussParameters
= {{0., 2.5}};
55
rndCfg.
uniformParameters
= {{-1.23, 4.25}};
56
rndCfg.
gammaParameters
= {{1., 1.}};
57
rndCfg.
drawsPerEvent
= 5000;
58
rndCfg.
output
=
"random_data"
;
59
sequencer.addAlgorithm(
60
std::make_shared<FW::HelloRandomAlgorithm>(rndCfg, logLevel));
61
62
// add HelloWhiteBoardAlgorithm the reads/writes data from/to the event store
63
FW::HelloWhiteBoardAlgorithm::Config
wbCfg;
64
// use data from previous algorithm as input
65
wbCfg.
input
= rndCfg.
output
;
66
wbCfg.
output
=
"copied_data"
;
67
sequencer.addAlgorithm(
68
std::make_shared<FW::HelloWhiteBoardAlgorithm>(wbCfg, logLevel));
69
70
// add HelloService that generates an event block index.
71
FW::HelloService::Config
svcCfg;
72
svcCfg.
eventsPerBlock
= 3;
73
sequencer.addService(std::make_shared<FW::HelloService>(svcCfg, logLevel));
74
75
// Run all configured algorithms and return the appropriate status.
76
return
sequencer.run();
77
}
acts
blob
master
Examples
Run
HelloWorld
HelloWorld.cpp
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:24:24
using
1.8.2 with
ECCE GitHub integration