EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RootParticleWriter.hpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file RootParticleWriter.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 
13 
14 #include <cstdint>
15 #include <mutex>
16 #include <string>
17 
18 class TFile;
19 class TTree;
20 
21 namespace ActsExamples {
22 
31 class RootParticleWriter final : public WriterT<SimParticleContainer> {
32  public:
33  struct Config {
35  std::string inputParticles;
37  std::string filePath;
39  std::string fileMode = "RECREATE";
41  std::string treeName = "particles";
42  };
43 
49 
51  ~RootParticleWriter() final override;
52 
54  ProcessCode endRun() final override;
55 
56  protected:
62  const SimParticleContainer& particles) final override;
63 
64  private:
66  std::mutex m_writeMutex;
67  TFile* m_outputFile = nullptr;
68  TTree* m_outputTree = nullptr;
72  uint64_t m_particleId;
74  int32_t m_particleType;
78  float m_vx, m_vy, m_vz;
79  // Production time in ns.
80  float m_vt;
82  float m_px, m_py, m_pz;
84  float m_m;
86  float m_q;
87  // Derived kinematic quantities
89  float m_eta;
91  float m_phi;
93  float m_pt;
94  // Decoded particle identifier; see Barcode definition for details.
100 };
101 
102 } // namespace ActsExamples