Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RootTrajectoryStatesWriter.hpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file RootTrajectoryStatesWriter.hpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2019-2023 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 
21 
22 #include <array>
23 #include <cstdint>
24 #include <mutex>
25 #include <string>
26 #include <vector>
27 
28 class TFile;
29 class TTree;
30 namespace ActsFatras {
31 class Barcode;
32 } // namespace ActsFatras
33 
34 namespace ActsExamples {
35 struct AlgorithmContext;
36 
52 class RootTrajectoryStatesWriter final : public WriterT<TrajectoriesContainer> {
53  public:
56 
57  struct Config {
69  std::string filePath = "trackstates.root";
71  std::string treeName = "trackstates";
73  std::string fileMode = "RECREATE";
74  };
75 
81 
82  ~RootTrajectoryStatesWriter() override;
83 
85  ProcessCode finalize() override;
86 
88  const Config& config() const { return m_cfg; }
89 
90  protected:
95  const TrajectoriesContainer& trajectories) override;
96 
97  private:
99 
103  this, "InputMeasurementParticlesMaps"};
105  this, "InputMeasurementSimHitsMap"};
106 
107  std::mutex m_writeMutex;
108  TFile* m_outputFile{nullptr};
109  TTree* m_outputTree{nullptr};
110  uint32_t m_eventNr{0};
111  uint32_t m_multiTrajNr{0};
112  unsigned int m_subTrajNr{0};
113 
114  std::vector<float> m_t_x;
115  std::vector<float> m_t_y;
116  std::vector<float> m_t_z;
117  std::vector<float> m_t_r;
118  std::vector<float>
120  std::vector<float>
122  std::vector<float>
124 
125  std::vector<float> m_t_eLOC0;
126  std::vector<float> m_t_eLOC1;
127  std::vector<float> m_t_ePHI;
128  std::vector<float> m_t_eTHETA;
129  std::vector<float> m_t_eQOP;
130  std::vector<float> m_t_eT;
131 
132  unsigned int m_nStates{0};
133  unsigned int m_nMeasurements{0};
134  std::vector<int> m_volumeID;
135  std::vector<int> m_layerID;
136  std::vector<int> m_moduleID;
137  std::vector<float> m_pathLength;
138  std::vector<float> m_lx_hit;
139  std::vector<float> m_ly_hit;
140  std::vector<float> m_x_hit;
141  std::vector<float> m_y_hit;
142  std::vector<float> m_z_hit;
143  std::vector<float> m_res_x_hit;
144  std::vector<float> m_res_y_hit;
145  std::vector<float> m_err_x_hit;
146  std::vector<float> m_err_y_hit;
147  std::vector<float> m_pull_x_hit;
148  std::vector<float> m_pull_y_hit;
149  std::vector<int> m_dim_hit;
150 
151  std::array<int, 4>
153 
154  std::array<std::vector<bool>, 4>
156 
157  std::array<std::vector<float>, 4>
159  std::array<std::vector<float>, 4>
161  std::array<std::vector<float>, 4>
163  std::array<std::vector<float>, 4>
165  std::array<std::vector<float>, 4>
167  std::array<std::vector<float>, 4>
169  std::array<std::vector<float>, 4>
171 
172  std::array<std::vector<float>, 4>
174 
175  std::array<std::vector<float>, 4>
177 
178  std::array<std::vector<float>, 4>
180 
181  std::array<std::vector<float>, 4>
183 
184  std::array<std::vector<float>, 4>
186  std::array<std::vector<float>, 4>
188 
189  std::array<std::vector<float>, 4>
191 
192  std::array<std::vector<float>, 4>
194 
195  std::array<std::vector<float>, 4>
197 
198  std::array<std::vector<float>, 4>
200 
201  std::array<std::vector<float>, 4>
203  std::array<std::vector<float>, 4>
205 
206  std::array<std::vector<float>, 4>
208 
209  std::array<std::vector<float>, 4>
211 
212  std::array<std::vector<float>, 4>
214 
215  std::array<std::vector<float>, 4>
217 
218  std::array<std::vector<float>, 4>
220  std::array<std::vector<float>, 4>
221  m_x;
222  std::array<std::vector<float>, 4>
223  m_y;
224  std::array<std::vector<float>, 4>
225  m_z;
226  std::array<std::vector<float>, 4>
228  std::array<std::vector<float>, 4>
230  std::array<std::vector<float>, 4>
232  std::array<std::vector<float>, 4>
234  std::array<std::vector<float>, 4>
236 
237  std::vector<float> m_chi2;
238 };
239 
240 } // namespace ActsExamples