Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:11:49

0001 // This file is part of the ACTS project.
0002 //
0003 // Copyright (C) 2016 CERN for the benefit of the ACTS project
0004 //
0005 // This Source Code Form is subject to the terms of the Mozilla Public
0006 // License, v. 2.0. If a copy of the MPL was not distributed with this
0007 // file, You can obtain one at https://mozilla.org/MPL/2.0/.
0008 
0009 #include "ActsExamples/Framework/RandomNumbers.hpp"
0010 #include "ActsExamples/Framework/Sequencer.hpp"
0011 
0012 #include <cstdlib>
0013 #include <memory>
0014 
0015 #include "HelloLoggerAlgorithm.hpp"
0016 #include "HelloRandomAlgorithm.hpp"
0017 #include "HelloWhiteBoardAlgorithm.hpp"
0018 
0019 int main(void) {
0020   Acts::Logging::Level logLevel = Acts::Logging::INFO;
0021 
0022   // setup basic tools shared among algorithms
0023   auto rnd = std::make_shared<ActsExamples::RandomNumbers>(
0024       ActsExamples::RandomNumbers::Config{});
0025 
0026   // setup the sequencer first w/ config derived from options
0027   ActsExamples::Sequencer::Config seqCfg;
0028   seqCfg.events = 10;
0029   seqCfg.numThreads = -1;
0030   ActsExamples::Sequencer sequencer(seqCfg);
0031 
0032   // add HelloWorld algorithm that does nothing
0033   sequencer.addAlgorithm(
0034       std::make_shared<ActsExamples::HelloLoggerAlgorithm>(logLevel));
0035 
0036   // add HelloRandom algorithm that uses RandomNumbers to generate some
0037   // random numbers from various distributions.
0038   ActsExamples::HelloRandomAlgorithm::Config rndCfg;
0039   rndCfg.randomNumbers = rnd;
0040   rndCfg.gaussParameters = {{0., 2.5}};
0041   rndCfg.uniformParameters = {{-1.23, 4.25}};
0042   rndCfg.gammaParameters = {{1., 1.}};
0043   rndCfg.drawsPerEvent = 5000;
0044   rndCfg.output = "random_data";
0045   sequencer.addAlgorithm(
0046       std::make_shared<ActsExamples::HelloRandomAlgorithm>(rndCfg, logLevel));
0047 
0048   // add HelloWhiteBoardAlgorithm the reads/writes data from/to the event store
0049   ActsExamples::HelloWhiteBoardAlgorithm::Config wbCfg;
0050   // use data from previous algorithm as input
0051   wbCfg.input = rndCfg.output;
0052   wbCfg.output = "copied_data";
0053   sequencer.addAlgorithm(
0054       std::make_shared<ActsExamples::HelloWhiteBoardAlgorithm>(wbCfg,
0055                                                                logLevel));
0056 
0057   // Run all configured algorithms and return the appropriate status.
0058   return sequencer.run();
0059 }