EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Sequencer.hpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file Sequencer.hpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2017 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 
9 #pragma once
10 
17 
18 #include <cstddef>
19 #include <memory>
20 #include <string>
21 #include <utility>
22 #include <vector>
23 
24 namespace ActsExamples {
25 
31 class Sequencer {
32  public:
33  struct Config {
35  size_t skip = 0;
37  size_t events = SIZE_MAX;
41  int numThreads = -1;
43  std::string outputDir;
44  };
45 
46  Sequencer(const Config& cfg);
47 
51  void addService(std::shared_ptr<IService> service);
55  void addContextDecorator(std::shared_ptr<IContextDecorator> decorator);
59  void addReader(std::shared_ptr<IReader> reader);
63  void addAlgorithm(std::shared_ptr<IAlgorithm> algorithm);
67  void addWriter(std::shared_ptr<IWriter> writer);
68 
95  int run();
96 
97  private:
99  std::vector<std::string> listAlgorithmNames() const;
101  std::pair<size_t, size_t> determineEventsRange() const;
102 
104  std::vector<std::shared_ptr<IService>> m_services;
105  std::vector<std::shared_ptr<IContextDecorator>> m_decorators;
106  std::vector<std::shared_ptr<IReader>> m_readers;
107  std::vector<std::shared_ptr<IAlgorithm>> m_algorithms;
108  std::vector<std::shared_ptr<IWriter>> m_writers;
109  std::unique_ptr<const Acts::Logger> m_logger;
110 
111  const Acts::Logger& logger() const { return *m_logger; }
112 };
113 
114 } // namespace ActsExamples