Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
EventGenerator.hpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file EventGenerator.hpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2019-2020 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 
12 
13 #pragma once
14 
22 
23 #include <cstddef>
24 #include <functional>
25 #include <memory>
26 #include <string>
27 #include <utility>
28 #include <vector>
29 
30 namespace ActsExamples {
31 struct AlgorithmContext;
32 
38 class EventGenerator final : public ActsExamples::IReader {
39  public:
52 
56  virtual ~MultiplicityGenerator() = default;
61  virtual size_t operator()(RandomEngine& rng) const = 0;
62  };
63 
65  struct VertexGenerator {
67  virtual ~VertexGenerator() = default;
72  virtual Acts::Vector4 operator()(RandomEngine& rng) const = 0;
73  };
74 
78  virtual ~ParticlesGenerator() = default;
86  };
87 
89  struct Generator {
90  std::shared_ptr<MultiplicityGenerator> multiplicity = nullptr;
91  std::shared_ptr<VertexGenerator> vertex = nullptr;
92  std::shared_ptr<ParticlesGenerator> particles = nullptr;
93  };
94 
95  struct Config {
99  std::vector<Generator> generators;
101  std::shared_ptr<const RandomNumbers> randomNumbers;
102  };
103 
105 
107  std::string name() const final;
109  std::pair<size_t, size_t> availableEvents() const final;
111  ProcessCode read(const AlgorithmContext& ctx) final;
112 
114  const Config& config() const { return m_cfg; }
115 
116  private:
117  const Acts::Logger& logger() const { return *m_logger; }
118 
120  std::unique_ptr<const Acts::Logger> m_logger;
121 
123  "OutputParticles"};
124 };
125 
126 } // namespace ActsExamples