ATLAS Offline Software
Loading...
Searching...
No Matches
ConditionTestAlg.cxx
Go to the documentation of this file.
1
2
3/*
4 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
5*/
6
7// ConditionTestAlg.cxx
8// Implementation file for class ConditionTestAlg
9// Author: B. Wynne <bwynne@cern.ch>
11
12#include "ConditionTestAlg.h"
13
14// STL includes
15
16// FrameWork includes
18
19namespace AthViews {
20
22// Public methods:
24
25// Constructors
27ConditionTestAlg::ConditionTestAlg( const std::string& name,
28 ISvcLocator* pSvcLocator ) :
29 ::AthCondAlgorithm( name, pSvcLocator )
30{
31 //
32 // Property declaration
33 //
34 //declareProperty( "Property", m_nProperty );
35}
36
37// Destructor
41
42// Athena Algorithm's Hooks
45{
46 ATH_MSG_INFO ("Initializing " << name() << "...");
47
48 CHECK( m_condKeyTest.initialize() );
49
50 return StatusCode::SUCCESS;
51}
52
54{
55 ATH_MSG_INFO ("Finalizing " << name() << "...");
56
57 return StatusCode::SUCCESS;
58}
59
60StatusCode ConditionTestAlg::execute(const EventContext& ctx) const
61{
63
64 if ( condHandleTest.isValid() ) {
65 ATH_MSG_DEBUG("CondHandle " << condHandleTest.fullKey() << " is already valid.");
66 return StatusCode::SUCCESS;
67 }
68
69 ATH_MSG_INFO ("Creating " << m_condKeyTest);
70
71 ATH_MSG_DEBUG( name() << " running with store " << Atlas::getExtendedEventContext(ctx).proxy()->name() );
72
73 // Make a (large) validity range
74 EventIDBase begin (0,
75 EventIDBase::UNDEFEVT, // event
76 EventIDBase::UNDEFNUM, // timestamp
77 EventIDBase::UNDEFNUM, // timestamp ns
78 0);
79 EventIDBase end (10000,
80 EventIDBase::UNDEFEVT, // event
81 EventIDBase::UNDEFNUM, // timestamp
82 EventIDBase::UNDEFNUM, // timestamp ns
83 10000);
84 EventIDRange range( begin, end );
85
86 // Write a dummy object with this validity range
87 ATH_CHECK( condHandleTest.record( range, std::make_unique< CondDataObj >( 987 ) ) );
88
89 return StatusCode::SUCCESS;
90}
91
92} //> end namespace AthViews
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_INFO(x)
#define ATH_MSG_DEBUG(x)
#define CHECK(...)
Evaluate an expression and check for errors.
Base class for conditions algorithms.
ConditionTestAlg()
Default constructor:
virtual ~ConditionTestAlg()
Destructor:
virtual StatusCode execute(const EventContext &ctx) const override
virtual StatusCode finalize() override
virtual StatusCode initialize() override
SG::WriteCondHandleKey< CondDataObj > m_condKeyTest
Containers.
StatusCode record(const EventIDRange &range, T *t)
record handle, with explicit range DEPRECATED
const DataObjID & fullKey() const
const ExtendedEventContext & getExtendedEventContext(const EventContext &ctx)
Retrieve an extended context from a context object.