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 #pragma once
0010 
0011 #include "ActsExamples/Framework/DataHandle.hpp"
0012 #include "ActsExamples/Framework/IAlgorithm.hpp"
0013 #include "ActsExamples/Framework/RandomNumbers.hpp"
0014 
0015 #include <array>
0016 #include <memory>
0017 #include <string>
0018 
0019 #include "HelloData.hpp"
0020 
0021 namespace ActsExamples {
0022 
0023 /// An example algorithm that uses the random number generator to generate data.
0024 class HelloRandomAlgorithm : public ActsExamples::IAlgorithm {
0025  public:
0026   struct Config {
0027     std::shared_ptr<ActsExamples::RandomNumbers> randomNumbers = nullptr;
0028     /// Random distribution parameters.
0029     std::array<double, 2> gaussParameters = {{0., 1.}};
0030     std::array<double, 2> uniformParameters = {{0., 1.}};
0031     std::array<double, 2> gammaParameters = {{0., 1.}};
0032     int poissonParameter = 40;
0033     std::size_t drawsPerEvent = 0;
0034     /// Where to store the generated data in the event store.
0035     std::string output;
0036   };
0037 
0038   HelloRandomAlgorithm(const Config& cfg,
0039                        Acts::Logging::Level level = Acts::Logging::INFO);
0040 
0041   // Generate random numbers from various distributions.
0042   ActsExamples::ProcessCode execute(const AlgorithmContext& ctx) const override;
0043 
0044   WriteDataHandle<HelloDataCollection> m_writeHandle{this, "Output"};
0045 
0046  private:
0047   Config m_cfg;
0048 };
0049 
0050 }  // namespace ActsExamples