Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RootSpacepointWriter.hpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file RootSpacepointWriter.hpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2022 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 
15 
16 #include <cstdint>
17 #include <limits>
18 #include <mutex>
19 #include <string>
20 
21 class TFile;
22 class TTree;
23 
24 namespace ActsExamples {
25 struct AlgorithmContext;
26 
35 class RootSpacepointWriter final : public WriterT<SimSpacePointContainer> {
36  public:
37  struct Config {
43  std::string fileMode = "RECREATE";
45  std::string treeName = "spacepoints";
46  };
47 
53 
55  ~RootSpacepointWriter() final;
56 
58  ProcessCode finalize() final;
59 
61  const Config& config() const { return m_cfg; }
62 
63  protected:
69  const SimSpacePointContainer& spacepoints) final;
70 
71  private:
73  std::mutex m_writeMutex;
74  TFile* m_outputFile = nullptr;
75  TTree* m_outputTree = nullptr;
77  uint32_t m_eventId = 0;
79  uint64_t m_measurementId = 0;
81  uint64_t m_geometryId = 0;
83  float m_x = std::numeric_limits<float>::infinity();
84  float m_y = std::numeric_limits<float>::infinity();
85  float m_z = std::numeric_limits<float>::infinity();
86  // Global space point position uncertainties
87  float m_var_r = std::numeric_limits<float>::infinity();
88  float m_var_z = std::numeric_limits<float>::infinity();
89 };
90 
91 } // namespace ActsExamples