Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
Main Page
Related Pages
Modules
Namespaces
Namespace List
Namespace Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Enumerations
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
z
Enumerator
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
:
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Enumerations
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Enumerator
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Properties
Related Functions
:
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
r
s
t
v
w
x
z
Files
File List
File Members
All
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
_
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Variables
$
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Enumerations
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
v
x
z
Enumerator
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Macros
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
GitLab
LXR
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Modules
Pages
Control
AthenaExamples
AthExStoreGateExample
src
ExampleAlg.cxx
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration.
3
*/
12
#include "
ExampleAlg.h
"
13
14
15
StatusCode
ExampleAlg::initialize
()
16
{
17
// This will check that the properties were initialized properly
18
// by job condifiguration.
19
ATH_CHECK
(
m_readKey
.
initialize
() );
20
ATH_CHECK
(
m_writeKey
.
initialize
() );
21
return
StatusCode::SUCCESS;
22
}
23
24
25
StatusCode
ExampleAlg::execute
(
const
EventContext& ctx)
const
26
{
27
// Construct handles from the keys.
28
// Since this is a reentrant algorithm, we have an explicit event context,
29
// which we pass to the handles.
30
SG::ReadHandle<MyDataObj>
h_read (
m_readKey
, ctx);
31
SG::WriteHandle<MyDataObj>
h_write (
m_writeKey
, ctx);
32
33
// Now we can dereference the read handle to access input data.
34
int
newval = h_read->
val
()+1;
35
36
// We make a new object, held by a unique_ptr, and record it
37
// in the store using the record method of the handle.
38
ATH_CHECK
( h_write.
record
(std::make_unique<MyDataObj> (newval)) );
39
40
return
StatusCode::SUCCESS;
41
}
ExampleAlg::execute
virtual StatusCode execute(const EventContext &ctx) const override
Definition:
ExampleAlg.cxx:25
SG::ReadHandle< MyDataObj >
MyDataObj::val
void val(int i)
Definition:
MyDataObj.h:24
ExampleAlg::m_writeKey
SG::WriteHandleKey< MyDataObj > m_writeKey
Definition:
ExampleAlg.h:36
ExampleAlg.h
Example of using handles for data access.
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition:
PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_CHECK
#define ATH_CHECK
Definition:
AthCheckMacros.h:40
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition:
AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
ExampleAlg::initialize
virtual StatusCode initialize() override
Definition:
ExampleAlg.cxx:15
SG::WriteHandle
Definition:
StoreGate/StoreGate/WriteHandle.h:73
SG::WriteHandle::record
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
ExampleAlg::m_readKey
SG::ReadHandleKey< MyDataObj > m_readKey
Definition:
ExampleAlg.h:35
Generated on Tue May 6 2025 21:09:38 for ATLAS Offline Software by
1.8.18