Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RootParticleReader.hpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file RootParticleReader.hpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2017-2021 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 
18 
19 #include <cstddef>
20 #include <cstdint>
21 #include <memory>
22 #include <mutex>
23 #include <string>
24 #include <utility>
25 #include <vector>
26 
27 class TChain;
28 
29 namespace ActsExamples {
30 struct AlgorithmContext;
31 
35 class RootParticleReader : public IReader {
36  public:
38  struct Config {
40  "particleCollection";
44  std::string treeName = "particles";
46 
47  bool orderedEvents = true;
48  };
49 
53 
55  ~RootParticleReader() override;
56 
58  std::string name() const override { return "RootParticleReader"; }
59 
61  std::pair<size_t, size_t> availableEvents() const override;
62 
66  ProcessCode read(const ActsExamples::AlgorithmContext& context) override;
67 
69  const Config& config() const { return m_cfg; }
70 
71  private:
73  const Acts::Logger& logger() const { return *m_logger; }
74 
77 
79  "OutputParticles"};
80 
82  this, "OutputPrimaryVertices"};
84  this, "OutputSecondaryVertices"};
85 
86  std::unique_ptr<const Acts::Logger> m_logger;
87 
89  std::mutex m_read_mutex;
90 
92  size_t m_events = 0;
93 
95  TChain* m_inputChain = nullptr;
96 
98  uint32_t m_eventId = 0;
99 
102  std::vector<long long> m_entryNumbers = {};
103 
104  std::vector<uint64_t>* m_particleId = new std::vector<uint64_t>;
105  std::vector<int32_t>* m_particleType = new std::vector<int32_t>;
106  std::vector<uint32_t>* m_process = new std::vector<uint32_t>;
107  std::vector<float>* m_vx = new std::vector<float>;
108  std::vector<float>* m_vy = new std::vector<float>;
109  std::vector<float>* m_vz = new std::vector<float>;
110  std::vector<float>* m_vt = new std::vector<float>;
111  std::vector<float>* m_px = new std::vector<float>;
112  std::vector<float>* m_py = new std::vector<float>;
113  std::vector<float>* m_pz = new std::vector<float>;
114  std::vector<float>* m_m = new std::vector<float>;
115  std::vector<float>* m_q = new std::vector<float>;
116  std::vector<float>* m_eta = new std::vector<float>;
117  std::vector<float>* m_phi = new std::vector<float>;
118  std::vector<float>* m_pt = new std::vector<float>;
119  std::vector<float>* m_p = new std::vector<float>;
120  std::vector<uint32_t>* m_vertexPrimary = new std::vector<uint32_t>;
121  std::vector<uint32_t>* m_vertexSecondary = new std::vector<uint32_t>;
122  std::vector<uint32_t>* m_particle = new std::vector<uint32_t>;
123  std::vector<uint32_t>* m_generation = new std::vector<uint32_t>;
124  std::vector<uint32_t>* m_subParticle = new std::vector<uint32_t>;
125 };
126 
127 } // namespace ActsExamples