Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RootMaterialTrackWriter.hpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file RootMaterialTrackWriter.hpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2017-2019 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 
16 
17 #include <cstddef>
18 #include <cstdint>
19 #include <mutex>
20 #include <string>
21 #include <unordered_map>
22 #include <utility>
23 #include <vector>
24 
25 class TFile;
26 class TTree;
27 namespace ActsExamples {
28 struct AlgorithmContext;
29 } // namespace ActsExamples
30 
31 namespace Acts {
32 // Using some short hands for Recorded Material
34 // And recorded material track
35 // - this is start: position, start momentum
36 // and the Recorded material
38  std::pair<std::pair<Acts::Vector3, Acts::Vector3>, RecordedMaterial>;
39 } // namespace Acts
40 
41 namespace ActsExamples {
42 
51  : public WriterT<std::unordered_map<size_t, Acts::RecordedMaterialTrack>> {
52  public:
53  struct Config {
55  "material-tracks";
57  std::string fileMode = "RECREATE";
58  std::string treeName = "material-tracks";
59 
61  bool recalculateTotals = false;
63  bool prePostStep = false;
65  bool storeSurface = false;
67  bool storeVolume = false;
70  bool collapseInteractions = false;
71  };
72 
78 
80  ~RootMaterialTrackWriter() override;
81 
84 
86  const Config& config() const { return m_cfg; }
87 
88  protected:
89  // This implementation holds the actual writing method
95  const AlgorithmContext& ctx,
96  const std::unordered_map<size_t, Acts::RecordedMaterialTrack>&
97  materialtracks) override;
98 
99  private:
103  std::mutex m_writeMutex;
105  TFile* m_outputFile = nullptr;
107  TTree* m_outputTree = nullptr;
108 
110  uint32_t m_eventId = 0;
111 
112  float m_v_x = 0;
113  float m_v_y = 0;
114  float m_v_z = 0;
115  float m_v_px = 0;
116  float m_v_py = 0;
117  float m_v_pz = 0;
118  float m_v_phi = 0;
119  float m_v_eta = 0;
120  float m_tX0 = 0;
121  float m_tL0 = 0;
122 
123  std::vector<float> m_step_sx;
124  std::vector<float> m_step_sy;
125  std::vector<float> m_step_sz;
126  std::vector<float> m_step_x;
127  std::vector<float> m_step_y;
128  std::vector<float> m_step_z;
129  std::vector<float> m_step_ex;
130  std::vector<float> m_step_ey;
131  std::vector<float> m_step_ez;
132  std::vector<float> m_step_dx;
133  std::vector<float> m_step_dy;
134  std::vector<float> m_step_dz;
135  std::vector<float> m_step_length;
136  std::vector<float> m_step_X0;
137  std::vector<float> m_step_L0;
138  std::vector<float> m_step_A;
139  std::vector<float> m_step_Z;
140  std::vector<float> m_step_rho;
141 
142  std::vector<std::uint64_t>
144  std::vector<int32_t>
146  std::vector<float> m_sur_x;
147 
148  std::vector<float> m_sur_y;
149 
150  std::vector<float> m_sur_z;
151 
152  std::vector<float>
154 
155  std::vector<float>
157  std::vector<float>
159 
160  std::vector<std::uint64_t>
162 };
163 
164 } // namespace ActsExamples