Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RootPlanarClusterWriter.hpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file RootPlanarClusterWriter.hpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2017-2018 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 
19 
20 #include <cstdint>
21 #include <memory>
22 #include <mutex>
23 #include <string>
24 #include <vector>
25 
26 class TFile;
27 class TTree;
28 namespace Acts {
29 class PlanarModuleCluster;
30 class TrackingGeometry;
31 } // namespace Acts
32 
33 namespace ActsExamples {
34 struct AlgorithmContext;
35 
48  : public WriterT<GeometryIdMultimap<Acts::PlanarModuleCluster>> {
49  public:
50  struct Config {
56  std::string fileMode = "RECREATE";
57  std::string treeName = "clusters";
58 
59  std::shared_ptr<const Acts::TrackingGeometry> trackingGeometry;
60  };
61 
66 
68  ~RootPlanarClusterWriter() override;
69 
71  ProcessCode finalize() override;
72 
74  const Config& config() const { return m_cfg; }
75 
76  protected:
83  const AlgorithmContext& ctx,
85 
86  private:
88  std::mutex m_writeMutex;
89  TFile* m_outputFile{nullptr};
90  TTree* m_outputTree{nullptr};
91  int m_eventNr = 0;
92  int m_volumeID = 0;
93  int m_layerID = 0;
94  int m_surfaceID = 0;
95  float m_x = 0;
96  float m_y = 0;
97  float m_z = 0;
98  float m_t = 0;
99  float m_lx = 0;
100  float m_ly = 0;
101  float m_cov_lx = 0;
102  float m_cov_ly = 0;
103  std::vector<int> m_cell_IDx;
104  std::vector<int> m_cell_IDy;
105  std::vector<float> m_cell_lx;
106  std::vector<float> m_cell_ly;
107  std::vector<float> m_cell_data;
108 
109  // (optional) the truth position
110  std::vector<float> m_t_gx;
111  std::vector<float> m_t_gy;
112  std::vector<float> m_t_gz;
113  std::vector<float> m_t_gt;
114  std::vector<float> m_t_lx;
115  std::vector<float> m_t_ly;
116  std::vector<uint64_t> m_t_barcode;
117 
119 };
120 
121 } // namespace ActsExamples