ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Control
DataModelTest
DataModelTestDataCommon
src
xAODTestReadJVec.cxx
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration.
3
*/
10
11
12
#include "
xAODTestReadJVec.h
"
13
#include "
StoreGate/ReadHandle.h
"
14
#include "
StoreGate/ReadDecorHandle.h
"
15
#include "
AthContainers/JaggedVec.h
"
16
#include "AthLinks/ElementLink.h"
17
#include <sstream>
18
19
20
namespace
{
21
22
26
template
<
class
CONT>
27
std::string formEL (
const
ElementLink<CONT>
& el)
28
{
29
std::ostringstream
ss
;
30
ss
<<
"("
<<
el
.dataID() <<
":"
;
31
if
(
static_cast<
int
>
(
el
.index()) == -1) {
32
ss
<<
"inv"
;
33
}
34
else
{
35
ss
<<
el
.index();
36
}
37
ss
<<
")"
;
38
return
ss
.str();
39
}
40
41
45
template
<
class
T>
46
std::string form_vec_elt (
const
T&
x
)
47
{
48
std::ostringstream
ss
;
49
ss
<<
x
;
50
return
ss
.str();
51
}
52
53
54
58
std::string form_vec_elt (
const
std::string&
x
)
59
{
60
return
"'"
+
x
+
"'"
;
61
}
62
63
67
template
<
class
CONT>
68
std::string form_vec_elt (
const
ElementLink<CONT>
&
x
)
69
{
70
return
formEL (
x
);
71
}
72
73
77
template
<
class
RANGE>
78
std::string formJVec (
const
RANGE&
r
) {
79
std::ostringstream
ss
;
80
ss
<<
"["
;
81
std::string
sep
;
82
for
(
const
auto
& elt :
r
) {
83
ss
<<
sep
;
84
sep
=
" "
;
85
ss
<< form_vec_elt (elt);
86
}
87
ss
<<
"]"
;
88
return
ss
.str();
89
}
90
91
92
}
93
94
95
namespace
DMTest
{
96
97
101
StatusCode
xAODTestReadJVec::initialize
()
102
{
103
ATH_CHECK
(
m_jvecContainerKey
.initialize (
SG::AllowEmpty
) );
104
ATH_CHECK
(
m_jvecInfoKey
.initialize (
SG::AllowEmpty
) );
105
ATH_CHECK
(
m_jvecDecorKey
.initialize (
SG::AllowEmpty
) );
106
ATH_CHECK
(
m_jvecInfoDecorKey
.initialize (
SG::AllowEmpty
) );
107
return
StatusCode::SUCCESS;
108
}
109
110
114
StatusCode
xAODTestReadJVec::execute
(
const
EventContext& ctx)
const
115
{
116
if
(!
m_jvecContainerKey
.empty()) {
117
SG::ReadHandle<JVecContainer>
jveccont (
m_jvecContainerKey
, ctx);
118
ATH_MSG_INFO
(
m_jvecContainerKey
.key() );
119
for
(
const
JVec
* jvec : *jveccont) {
120
ATH_CHECK
(
dumpJVec
(*jvec) );
121
ATH_CHECK
(
dumpDecor
(ctx, *jvec) );
122
}
123
}
124
125
if
(!
m_jvecInfoKey
.empty()) {
126
SG::ReadHandle<JVec>
jvecinfo (
m_jvecInfoKey
, ctx);
127
ATH_MSG_INFO
(
m_jvecInfoKey
.key() );
128
ATH_CHECK
(
dumpJVec
(*jvecinfo) );
129
ATH_CHECK
(
dumpInfoDecor
(ctx, *jvecinfo) );
130
}
131
132
return
StatusCode::SUCCESS;
133
}
134
135
139
StatusCode
xAODTestReadJVec::dumpJVec
(
const
JVec
& jvec)
const
140
{
141
std::ostringstream
ss
;
142
ss
<<
" ivec: "
<< formJVec (jvec.
ivec
());
143
ss
<<
" fvec: "
<< formJVec (jvec.
fvec
());
144
ss
<<
" svec: "
<< formJVec (jvec.
svec
());
145
ss
<<
" lvec: "
<< formJVec (jvec.
lvec
());
146
ATH_MSG_INFO
(
ss
.str() );
147
return
StatusCode::SUCCESS;
148
}
149
150
154
StatusCode
155
xAODTestReadJVec::dumpDecor
(
const
EventContext& ctx,
156
const
JVec
& jvec)
const
157
{
158
std::ostringstream
ss
;
159
if
(!
m_jvecDecorKey
.empty()) {
160
SG::ReadDecorHandle<JVecContainer, SG::JaggedVecElt<double>
> decor (
m_jvecDecorKey
, ctx);
161
ss
<<
" decorJVec: "
<< formJVec (decor (jvec));
162
}
163
164
ATH_MSG_INFO
(
ss
.str() );
165
return
StatusCode::SUCCESS;
166
}
167
168
172
StatusCode
173
xAODTestReadJVec::dumpInfoDecor
(
const
EventContext& ctx,
174
const
JVec
& jvec)
const
175
{
176
std::ostringstream
ss
;
177
if
(!
m_jvecInfoDecorKey
.empty()) {
178
SG::ReadDecorHandle<JVec, SG::JaggedVecElt<double>
> decor (
m_jvecInfoDecorKey
, ctx);
179
ss
<<
" decorJVec: "
<< formJVec (decor (jvec));
180
}
181
182
ATH_MSG_INFO
(
ss
.str() );
183
return
StatusCode::SUCCESS;
184
}
185
186
187
}
// namespace DMTest
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_INFO
#define ATH_MSG_INFO(x,...)
Definition
AthMsgStreamMacros.h:45
JaggedVec.h
ss
static Double_t ss
Definition
LArPhysWaveHECTool.cxx:37
ReadDecorHandle.h
Handle class for reading a decoration on an object.
ReadHandle.h
Handle class for reading from StoreGate.
x
#define x
DMTest::JVec_v1::ivec
intRange_t ivec() const
DMTest::JVec_v1::lvec
linkRange_t lvec() const
DMTest::JVec_v1::svec
stringRange_t svec() const
DMTest::JVec_v1::fvec
floatRange_t fvec() const
DMTest::xAODTestReadJVec::m_jvecContainerKey
SG::ReadHandleKey< DMTest::JVecContainer > m_jvecContainerKey
Definition
xAODTestReadJVec.h:71
DMTest::xAODTestReadJVec::m_jvecInfoDecorKey
SG::ReadDecorHandleKey< DMTest::JVec > m_jvecInfoDecorKey
Definition
xAODTestReadJVec.h:80
DMTest::xAODTestReadJVec::dumpJVec
StatusCode dumpJVec(const JVec &jvec) const
Dump a JVec object.
Definition
xAODTestReadJVec.cxx:139
DMTest::xAODTestReadJVec::m_jvecInfoKey
SG::ReadHandleKey< DMTest::JVec > m_jvecInfoKey
Definition
xAODTestReadJVec.h:74
DMTest::xAODTestReadJVec::initialize
virtual StatusCode initialize() override
Algorithm initialization; called at the beginning of the job.
Definition
xAODTestReadJVec.cxx:101
DMTest::xAODTestReadJVec::execute
virtual StatusCode execute(const EventContext &ctx) const override
Algorithm event processing.
Definition
xAODTestReadJVec.cxx:114
DMTest::xAODTestReadJVec::dumpInfoDecor
StatusCode dumpInfoDecor(const EventContext &ctx, const JVec &jvec) const
Dump decorations from a standalone JVec object.
Definition
xAODTestReadJVec.cxx:173
DMTest::xAODTestReadJVec::dumpDecor
StatusCode dumpDecor(const EventContext &ctx, const JVec &jvec) const
Dump decorations from a JVec object.
Definition
xAODTestReadJVec.cxx:155
DMTest::xAODTestReadJVec::m_jvecDecorKey
SG::ReadDecorHandleKey< DMTest::JVecContainer > m_jvecDecorKey
Definition
xAODTestReadJVec.h:77
ElementLink
ElementLink implementation for ROOT usage.
Definition
A/AthLinks/ElementLink.h:40
SG::ReadDecorHandle
Handle class for reading a decoration on an object.
Definition
StoreGate/StoreGate/ReadDecorHandle.h:94
SG::ReadHandle
Definition
StoreGate/StoreGate/ReadHandle.h:67
r
int r
Definition
globals.cxx:22
DMTest
Definition
B.h:23
DMTest::JVec
JVec_v1 JVec
Definition
JVec.h:23
SG::AllowEmpty
@ AllowEmpty
Definition
StoreGate/StoreGate/VarHandleKey.h:27
grepfile.sep
sep
Definition
grepfile.py:38
python.getProblemFolderFromLogs.el
dict el
Definition
getProblemFolderFromLogs.py:51
xAODTestReadJVec.h
For testing jagged vectors.
Generated on
for ATLAS Offline Software by
1.17.0