Analysis Software
Documentation for
sPHENIX
simulation software
Home page
Related Pages
Modules
Namespaces
Classes
Files
Examples
External Links
File List
File Members
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
11
#include "
Acts/Utilities/Logger.hpp
"
12
#include "
ActsExamples/EventData/SimParticle.hpp
"
13
#include "
ActsExamples/Framework/ProcessCode.hpp
"
14
#include "
ActsExamples/Framework/WriterT.hpp
"
15
16
#include <cstdint>
17
#include <mutex>
18
#include <string>
19
#include <vector>
20
21
class
TFile;
22
class
TTree;
23
24
namespace
ActsExamples {
25
struct
AlgorithmContext;
26
35
class
RootParticleWriter
final :
public
WriterT
<SimParticleContainer> {
36
public
:
37
struct
Config
{
39
std::string
inputParticles
;
41
std::string
filePath
;
43
std::string
fileMode
=
"RECREATE"
;
45
std::string
treeName
=
"particles"
;
46
};
47
52
RootParticleWriter
(
const
Config
&
cfg
,
Acts::Logging::Level
lvl);
53
55
~RootParticleWriter
()
override
;
56
58
ProcessCode
finalize
()
override
;
59
61
const
Config
&
config
()
const
{
return
m_cfg
; }
62
63
protected
:
68
ProcessCode
writeT
(
const
AlgorithmContext
& ctx,
69
const
SimParticleContainer
&
particles
)
override
;
70
71
private
:
72
Config
m_cfg
;
73
std::mutex
m_writeMutex
;
74
TFile*
m_outputFile
=
nullptr
;
75
TTree*
m_outputTree
=
nullptr
;
77
uint32_t
m_eventId
= 0;
79
std::vector<uint64_t>
m_particleId
;
81
std::vector<int32_t>
m_particleType
;
83
std::vector<uint32_t>
m_process
;
85
std::vector<float>
m_vx
;
86
std::vector<float>
m_vy
;
87
std::vector<float>
m_vz
;
88
// Production time in ns.
89
std::vector<float>
m_vt
;
91
std::vector<float>
m_p
;
93
std::vector<float>
m_px
;
94
std::vector<float>
m_py
;
95
std::vector<float>
m_pz
;
97
std::vector<float>
m_m
;
99
std::vector<float>
m_q
;
100
// Derived kinematic quantities
102
std::vector<float>
m_eta
;
104
std::vector<float>
m_phi
;
106
std::vector<float>
m_pt
;
107
// Decoded particle identifier; see Barcode definition for details.
108
std::vector<uint32_t>
m_vertexPrimary
;
109
std::vector<uint32_t>
m_vertexSecondary
;
110
std::vector<uint32_t>
m_particle
;
111
std::vector<uint32_t>
m_generation
;
112
std::vector<uint32_t>
m_subParticle
;
113
};
114
115
}
// namespace ActsExamples
acts
blob
sPHENIX
Examples
Io
Root
include
ActsExamples
Io
Root
RootParticleWriter.hpp
Built by
Jin Huang
. updated:
Sat Feb 17 2024 22:17:38
using
1.8.2 with
sPHENIX GitHub integration