Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RootSimHitWriter.hpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file RootSimHitWriter.hpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 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 
15 
16 #include <cstdint>
17 #include <mutex>
18 #include <string>
19 
20 class TFile;
21 class TTree;
22 
23 namespace ActsExamples {
24 struct AlgorithmContext;
25 
34 class RootSimHitWriter final : public WriterT<SimHitContainer> {
35  public:
36  struct Config {
42  std::string fileMode = "RECREATE";
45  };
46 
52 
54  ~RootSimHitWriter() override;
55 
57  ProcessCode finalize() override;
58 
60  const Config& config() const { return m_cfg; }
61 
62  protected:
68  const SimHitContainer& hits) override;
69 
70  private:
72  std::mutex m_writeMutex;
73  TFile* m_outputFile = nullptr;
74  TTree* m_outputTree = nullptr;
76  uint32_t m_eventId = 0;
78  uint64_t m_geometryId = 0;
80  uint64_t m_particleId = 0;
82  float m_tx = 0, m_ty = 0, m_tz = 0;
83  // True global hit time in ns.
84  float m_tt = 0;
86  float m_tpx = 0, m_tpy = 0, m_tpz = 0, m_te = 0;
88  float m_deltapx = 0, m_deltapy = 0, m_deltapz = 0, m_deltae = 0;
90  int32_t m_index = 0;
91  // Decoded hit surface identifier components.
92  uint32_t m_volumeId = 0;
93  uint32_t m_boundaryId = 0;
94  uint32_t m_layerId = 0;
95  uint32_t m_approachId = 0;
96  uint32_t m_sensitiveId = 0;
97 };
98 
99 } // namespace ActsExamples