The Gaudi Framework
master (181af51f)
Loading...
Searching...
No Matches
User.cpp
Go to the documentation of this file.
1
/***********************************************************************************\
2
* (c) Copyright 1998-2019 CERN for the benefit of the LHCb and ATLAS collaborations *
3
* *
4
* This software is distributed under the terms of the Apache version 2 licence, *
5
* copied verbatim in the file "LICENSE". *
6
* *
7
* In applying this licence, CERN does not waive the privileges and immunities *
8
* granted to it by virtue of its status as an Intergovernmental Organization *
9
* or submit itself to any jurisdiction. *
10
\***********************************************************************************/
11
#include <
Gaudi/Algorithm.h
>
12
#include <
Gaudi/TestSuite/Conditions/ConditionAccessorHolder.h
>
13
14
namespace
Gaudi::TestSuite::Conditions
{
17
class
UserAlg
:
public
ConditionAccessorHolder
<Algorithm> {
19
using
base_class::base_class
;
20
22
ConditionAccessor<int>
m_cond
{
this
,
"MyCondition"
,
"condition/key"
};
23
24
StatusCode
initialize
()
override
{
25
auto
status =
base_class::initialize
();
26
if
( !status )
return
status;
27
28
info
() <<
"initialize"
<<
endmsg
;
29
30
return
status;
31
}
32
33
StatusCode
execute
(
const
EventContext
& ctx )
const override
{
34
// get the condition slot for the current event
35
const
auto
& condCtx =
getConditionContext
( ctx );
36
// get the condition value from the current condition slot.
37
const
auto
& cond =
m_cond
.get( condCtx );
38
39
info
() <<
"got condition value "
<< cond <<
endmsg
;
40
41
return
StatusCode::SUCCESS
;
42
}
43
44
StatusCode
finalize
()
override
{
45
info
() <<
"finalize"
<<
endmsg
;
46
47
return
base_class::finalize
();
48
}
49
};
50
DECLARE_COMPONENT
( UserAlg )
51
}
// namespace Gaudi::TestSuite::Conditions
ConditionAccessorHolder.h
Algorithm.h
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition
MsgStream.h:198
DECLARE_COMPONENT
#define DECLARE_COMPONENT(type)
Definition
PluginServiceV1.h:45
CommonMessagingBase::info
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
Definition
CommonMessaging.h:113
EventContext
This class represents an entry point to all the event specific data.
Definition
EventContext.h:34
Gaudi::Algorithm::finalize
StatusCode finalize() override
the default (empty) implementation of IStateful::finalize() method
Definition
Algorithm.h:181
Gaudi::TestSuite::Conditions::ConditionAccessorHolder
Example of a ConditionAccessorHolder implementation.
Definition
ConditionAccessorHolder.h:77
Gaudi::TestSuite::Conditions::ConditionAccessorHolder< Algorithm >::base_class
ConditionAccessorHolder< Algorithm > base_class
Definition
ConditionAccessorHolder.h:84
Gaudi::TestSuite::Conditions::ConditionAccessorHolder< Algorithm >::getConditionContext
const ConditionContext & getConditionContext(const EventContext &ctx) const
Definition
ConditionAccessorHolder.h:141
Gaudi::TestSuite::Conditions::ConditionAccessorHolder< Algorithm >::initialize
StatusCode initialize() override
Definition
ConditionAccessorHolder.h:127
Gaudi::TestSuite::Conditions::UserAlg
Example of a simple algorithm using conditions via the ConditionAccessorHolder pattern.
Definition
User.cpp:17
Gaudi::TestSuite::Conditions::UserAlg::m_cond
ConditionAccessor< int > m_cond
Data member to access condition values for the current event.
Definition
User.cpp:22
Gaudi::TestSuite::Conditions::UserAlg::execute
StatusCode execute(const EventContext &ctx) const override
Definition
User.cpp:33
Gaudi::TestSuite::Conditions::UserAlg::finalize
StatusCode finalize() override
Definition
User.cpp:44
Gaudi::TestSuite::Conditions::UserAlg::initialize
StatusCode initialize() override
Definition
User.cpp:24
StatusCode
This class is used for returning status codes from appropriate routines.
Definition
StatusCode.h:64
StatusCode::SUCCESS
constexpr static const auto SUCCESS
Definition
StatusCode.h:99
Gaudi::TestSuite::Conditions
Definition
ConditionAccessorHolder.h:21
GaudiTestSuite
src
ConditionAccessor
User.cpp
Generated on Wed Oct 8 2025 09:53:38 for The Gaudi Framework by
1.13.1