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
RootAthenaNTupleReader.hpp
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file RootAthenaNTupleReader.hpp
1
// This file is part of the Acts project.
2
//
3
// Copyright (C) 2017-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
11
#include "
Acts/Definitions/Algebra.hpp
"
12
#include "
Acts/EventData/TrackParameters.hpp
"
13
#include "
Acts/Propagator/MaterialInteractor.hpp
"
14
#include "
Acts/Utilities/Logger.hpp
"
15
#include "
Acts/Vertexing/Vertex.hpp
"
16
#include "
ActsExamples/EventData/Track.hpp
"
17
#include "
ActsExamples/Framework/DataHandle.hpp
"
18
#include "
ActsExamples/Framework/IReader.hpp
"
19
#include "
ActsExamples/Framework/ProcessCode.hpp
"
20
21
#include <algorithm>
22
#include <cstddef>
23
#include <memory>
24
#include <mutex>
25
#include <string>
26
#include <utility>
27
#include <vector>
28
29
class
TChain;
30
31
namespace
ActsExamples {
32
struct
AlgorithmContext;
33
34
class
RootAthenaNTupleReader
:
public
ActsExamples::IReader
{
35
public
:
37
struct
Config
{
38
// name of the input tree
39
std::string
inputTreeName
;
40
// The name of the input file
41
std::string
inputFilePath
;
42
43
std::string
outputTrackParameters
=
"nTupleTrackParameters"
;
44
std::string
outputTruthVtxParameters
=
"nTupleTruthVtxParameters"
;
45
std::string
outputRecoVtxParameters
=
"nTupleRecoVtxParameters"
;
46
std::string
outputBeamspotConstraint
=
"beamspotConstraint"
;
47
};
48
49
// clang-format off
50
// name | typename | interpretation
51
// ---------------------+--------------------------+-------------------------------
52
// mcChannelNumber | int32_t | AsDtype('>i4')
53
// EventNumber | int32_t | AsDtype('>i4')
54
// RunNumber | int32_t | AsDtype('>i4')
55
// BCID | int32_t | AsDtype('>i4')
56
// mu | float | AsDtype('>f4')
57
// muActual | float | AsDtype('>f4')
58
// beamspot_x | float | AsDtype('>f4')
59
// beamspot_y | float | AsDtype('>f4')
60
// beamspot_z | float | AsDtype('>f4')
61
// beamspot_sigX | float | AsDtype('>f4')
62
// beamspot_sigY | float | AsDtype('>f4')
63
// beamspot_sigZ | float | AsDtype('>f4')
64
// met_Truth | std::vector<float> | AsJagged(AsDtype('>f4'), he...
65
// mpx_Truth | std::vector<float> | AsJagged(AsDtype('>f4'), he...
66
// mpy_Truth | std::vector<float> | AsJagged(AsDtype('>f4'), he...
67
// sumet_Truth | std::vector<float> | AsJagged(AsDtype('>f4'), he...
68
// track_prob | std::vector<float> | AsJagged(AsDtype('>f4'), he...
69
// track_d0 | std::vector<float> | AsJagged(AsDtype('>f4'), he...
70
// track_z0 | std::vector<float> | AsJagged(AsDtype('>f4'), he...
71
// track_theta | std::vector<float> | AsJagged(AsDtype('>f4'), he...
72
// track_phi | std::vector<float> | AsJagged(AsDtype('>f4'), he...
73
// track_qOverP | std::vector<float> | AsJagged(AsDtype('>f4'), he...
74
// track_t | std::vector<float> | AsJagged(AsDtype('>f4'), he...
75
// track_z | std::vector<float> | AsJagged(AsDtype('>f4'), he...
76
// track_var_d0 | std::vector<float> | AsJagged(AsDtype('>f4'), he...
77
// track_var_z0 | std::vector<float> | AsJagged(AsDtype('>f4'), he...
78
// track_var_phi | std::vector<float> | AsJagged(AsDtype('>f4'), he...
79
// track_var_theta | std::vector<float> | AsJagged(AsDtype('>f4'), he...
80
// track_var_qOverP | std::vector<float> | AsJagged(AsDtype('>f4'), he...
81
// track_cov_d0z0 | std::vector<float> | AsJagged(AsDtype('>f4'), he...
82
// track_cov_d0phi | std::vector<float> | AsJagged(AsDtype('>f4'), he...
83
// track_cov_d0theta | std::vector<float> | AsJagged(AsDtype('>f4'), he...
84
// track_cov_d0qOverP | std::vector<float> | AsJagged(AsDtype('>f4'), he...
85
// track_cov_z0phi | std::vector<float> | AsJagged(AsDtype('>f4'), he...
86
// track_cov_z0theta | std::vector<float> | AsJagged(AsDtype('>f4'), he...
87
// track_cov_z0qOverP | std::vector<float> | AsJagged(AsDtype('>f4'), he...
88
// track_cov_phitheta | std::vector<float> | AsJagged(AsDtype('>f4'), he...
89
// track_cov_phiqOverP | std::vector<float> | AsJagged(AsDtype('>f4'), he...
90
// track_cov_tehtaqO... | std::vector<float> | AsJagged(AsDtype('>f4'), he...
91
// track_t30 | std::vector<float> | AsJagged(AsDtype('>f4'), he...
92
// track_t60 | std::vector<float> | AsJagged(AsDtype('>f4'), he...
93
// track_t90 | std::vector<float> | AsJagged(AsDtype('>f4'), he...
94
// track_t120 | std::vector<float> | AsJagged(AsDtype('>f4'), he...
95
// track_t180 | std::vector<float> | AsJagged(AsDtype('>f4'), he...
96
// tracks_numPix | std::vector<int32_t> | AsJagged(AsDtype('>i4'), he...
97
// tracks_numSCT | std::vector<int32_t> | AsJagged(AsDtype('>i4'), he...
98
// tracks_numPix1L | std::vector<int32_t> | AsJagged(AsDtype('>i4'), he...
99
// tracks_numPix2L | std::vector<int32_t> | AsJagged(AsDtype('>i4'), he...
100
// jet_pt | std::vector<float> | AsJagged(AsDtype('>f4'), he...
101
// jet_eta | std::vector<float> | AsJagged(AsDtype('>f4'), he...
102
// jet_phi | std::vector<float> | AsJagged(AsDtype('>f4'), he...
103
// jet_m | std::vector<float> | AsJagged(AsDtype('>f4'), he...
104
// jet_q | std::vector<float> | AsJagged(AsDtype('>f4'), he...
105
// jet_ptmatched_pt | std::vector<float> | AsJagged(AsDtype('>f4'), he...
106
// jet_ptmatched_eta | std::vector<float> | AsJagged(AsDtype('>f4'), he...
107
// jet_ptmatched_phi | std::vector<float> | AsJagged(AsDtype('>f4'), he...
108
// jet_ptmatched_m | std::vector<float> | AsJagged(AsDtype('>f4'), he...
109
// jet_drmatched_pt | std::vector<float> | AsJagged(AsDtype('>f4'), he...
110
// jet_drmatched_eta | std::vector<float> | AsJagged(AsDtype('>f4'), he...
111
// jet_drmatched_phi | std::vector<float> | AsJagged(AsDtype('>f4'), he...
112
// jet_drmatched_m | std::vector<float> | AsJagged(AsDtype('>f4'), he...
113
// jet_isPU | std::vector<int32_t> | AsJagged(AsDtype('>i4'), he...
114
// jet_isHS | std::vector<int32_t> | AsJagged(AsDtype('>i4'), he...
115
// jet_label | std::vector<int32_t> | AsJagged(AsDtype('>i4'), he...
116
// recovertex_x | std::vector<float> | AsJagged(AsDtype('>f4'), he...
117
// recovertex_y | std::vector<float> | AsJagged(AsDtype('>f4'), he...
118
// recovertex_z | std::vector<float> | AsJagged(AsDtype('>f4'), he...
119
// recovertex_sumPt2 | std::vector<float> | AsJagged(AsDtype('>f4'), he...
120
// recovertex_isPU | std::vector<int32_t> | AsJagged(AsDtype('>i4'), he...
121
// recovertex_isHS | std::vector<int32_t> | AsJagged(AsDtype('>i4'), he...
122
// truthvertex_x | std::vector<float> | AsJagged(AsDtype('>f4'), he...
123
// truthvertex_y | std::vector<float> | AsJagged(AsDtype('>f4'), he...
124
// truthvertex_z | std::vector<float> | AsJagged(AsDtype('>f4'), he...
125
// truthvertex_t | std::vector<float> | AsJagged(AsDtype('>f4'), he...
126
// truthvertex_isPU | std::vector<int32_t> | AsJagged(AsDtype('>i4'), he...
127
// truthvertex_isHS | std::vector<int32_t> | AsJagged(AsDtype('>i4'), he...
128
// jet_tracks_idx | std::vector<std::vect... | AsObjects(AsVector(True, As...
129
// recovertex_tracks... | std::vector<std::vect... | AsObjects(AsVector(True, As...
130
// truthvertex_track... | std::vector<std::vect... | AsObjects(AsVector(True, As...
131
// clang-format on
132
133
struct
BranchPointerWrapper
{
134
std::vector<float>
track_d0
;
135
std::vector<float>
track_z0
;
136
std::vector<float>
track_theta
;
137
std::vector<float>
track_phi
;
138
std::vector<float>
track_qOverP
;
139
std::vector<float>
track_t
;
140
std::vector<float>
track_z
;
141
142
std::vector<float>
track_var_d0
;
143
std::vector<float>
track_var_z0
;
144
std::vector<float>
track_var_phi
;
145
std::vector<float>
track_var_theta
;
146
std::vector<float>
track_var_qOverP
;
147
std::vector<float>
track_cov_d0z0
;
148
std::vector<float>
track_cov_d0phi
;
149
std::vector<float>
track_cov_d0theta
;
150
std::vector<float>
track_cov_d0qOverP
;
151
std::vector<float>
track_cov_z0phi
;
152
std::vector<float>
track_cov_z0theta
;
153
std::vector<float>
track_cov_z0qOverP
;
154
std::vector<float>
track_cov_phitheta
;
155
std::vector<float>
track_cov_phiqOverP
;
156
std::vector<float>
track_cov_tehtaqOverP
;
157
158
std::vector<float>
truthvertex_x
;
159
std::vector<float>
truthvertex_y
;
160
std::vector<float>
truthvertex_z
;
161
std::vector<float>
truthvertex_t
;
162
163
std::vector<float>
recovertex_x
;
164
std::vector<float>
recovertex_y
;
165
std::vector<float>
recovertex_z
;
166
167
std::vector<std::vector<int>>
truthvertex_tracks_idx
;
168
169
float
beamspot_x
= 0;
170
float
beamspot_y
= 0;
171
float
beamspot_z
= 0;
172
float
beamspot_sigX
= 0;
173
float
beamspot_sigY
= 0;
174
float
beamspot_sigZ
= 0;
175
};
176
179
RootAthenaNTupleReader
(
const
Config
&
config
,
Acts::Logging::Level
level
);
180
182
std::string
name
() const final {
return
"RootAthenaNTupleReader"
; }
183
185
std::pair<std::size_t, std::size_t>
availableEvents
() const final {
186
return
{0
u
,
m_events
};
187
}
188
192
ActsExamples::ProcessCode
read
(
193
const
ActsExamples::AlgorithmContext
&context)
final
;
194
196
const
Config
&
config
()
const
{
return
m_cfg
; }
197
199
const
BranchPointerWrapper
&
branches
()
const
{
return
m_branches
; }
200
201
private
:
203
const
Acts::Logger
&
logger
()
const
{
return
*
m_logger
; }
204
206
Config
m_cfg
;
207
208
std::unique_ptr<const Acts::Logger>
m_logger
;
209
211
std::mutex
m_read_mutex
;
212
214
std::size_t
m_events
= 0;
215
217
TChain *
m_inputChain
=
nullptr
;
218
220
BranchPointerWrapper
m_branches
;
221
222
WriteDataHandle<TrackParametersContainer>
m_outputTrackParameters
{
223
this
,
"OutputTrackParameters"
};
224
225
WriteDataHandle<std::vector<Acts::Vector4>
>
m_outputTruthVtxParameters
{
226
this
,
"OutputTruthVertices"
};
227
228
WriteDataHandle<std::vector<Acts::Vector4>
>
m_outputRecoVtxParameters
{
229
this
,
"OutputRecoVertices"
};
230
231
WriteDataHandle<Acts::Vertex<Acts::BoundTrackParameters>
>
232
m_outputBeamspotConstraint
{
this
,
"OutputBeamsspotConstraint"
};
233
};
234
235
}
// namespace ActsExamples
acts
blob
sPHENIX
Examples
Io
Root
include
ActsExamples
Io
Root
RootAthenaNTupleReader.hpp
Built by
Jin Huang
. updated:
Sat Feb 17 2024 22:17:38
using
1.8.2 with
sPHENIX GitHub integration