Analysis Software
Documentation for sPHENIX simulation software
 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 
15 
16 #include <cstdlib>
17 #include <memory>
18 
19 #include "HelloLoggerAlgorithm.hpp"
20 #include "HelloRandomAlgorithm.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.
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
39 
40  // setup basic tools shared among algorithms
41  auto rnd = std::make_shared<ActsExamples::RandomNumbers>(
43 
44  // setup the sequencer first w/ config derived from options
45  ActsExamples::Sequencer sequencer(
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.
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
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 }