ATLAS Offline Software
Loading...
Searching...
No Matches
ViewTestAlg.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// ViewTestAlg.cxx
8// Implementation file for class ViewTestAlg
9// Author: B. Wynne <bwynne@cern.ch>
11
12#include "ViewTestAlg.h"
14#include "AthViews/View.h"
15
16namespace AthViews {
17
19{
20 ATH_MSG_DEBUG( "Initializing " << name() << "..." );
21
22 if ( m_output.key() == "" )
23 {
25 }
26 else
27 {
28 CHECK( m_output.initialize() );
29 }
30
31 return StatusCode::SUCCESS;
32}
33
35{
36 ATH_MSG_DEBUG( "Finalizing " << name() << "..." );
37
38 return StatusCode::SUCCESS;
39}
40
41StatusCode ViewTestAlg::execute(const EventContext& ctx) const
42{
43 ATH_MSG_DEBUG( "Executing " << name() << "..." );
44
45 auto theStore = Atlas::getExtendedEventContext( ctx ).proxy();
46 ATH_MSG_INFO( name() << " running with store " << theStore->name() );
47
48 // Make (optional) output
49 if ( m_output.key() != "" )
50 {
51 auto output = SG::makeHandle( m_output, ctx );
52 output = std::make_unique<int>( 1 );
53 }
54
55 // Identify if this is a view
56 SG::View* theView = dynamic_cast< SG::View* >( theStore );
57 if ( theView )
58 {
59 ATH_MSG_INFO( theView->dump() );
60 }
61 else
62 {
63 ATH_MSG_INFO( "This is not an EventView" );
64 }
65
66 return StatusCode::SUCCESS;
67}
68
69} //> end namespace AthViews
#define ATH_MSG_INFO(x)
#define ATH_MSG_DEBUG(x)
#define CHECK(...)
Evaluate an expression and check for errors.
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)
virtual StatusCode initialize() override
SG::WriteHandleKey< int > m_output
Definition ViewTestAlg.h:32
virtual StatusCode execute(const EventContext &ctx) const override
virtual StatusCode finalize() override
A "view" of the event store (IProxyDict).
Definition View.h:46
std::string dump(const std::string &indent="") const
Print content of the view.
Definition View.cxx:164
const ExtendedEventContext & getExtendedEventContext(const EventContext &ctx)
Retrieve an extended context from a context object.
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())