ATLAS Offline Software
Loading...
Searching...
No Matches
ViewTestAlg.cxx
Go to the documentation of this file.
1
2
3/*
4 Copyright (C) 2002-2019 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
18ViewTestAlg::ViewTestAlg( const std::string& name, ISvcLocator* pSvcLocator ) : AthAlgorithm( name, pSvcLocator )
19{
20}
21
25
27{
28 ATH_MSG_DEBUG( "Initializing " << name() << "..." );
29
30 if ( m_output.key() == "" )
31 {
33 }
34 else
35 {
36 CHECK( m_output.initialize() );
37 }
38
39 return StatusCode::SUCCESS;
40}
41
43{
44 ATH_MSG_DEBUG( "Finalizing " << name() << "..." );
45
46 return StatusCode::SUCCESS;
47}
48
50{
51 ATH_MSG_DEBUG( "Executing " << name() << "..." );
52
53 auto theStore = Atlas::getExtendedEventContext( getContext() ).proxy();
54 ATH_MSG_INFO( name() << " running with store " << theStore->name() );
55
56 // Make (optional) output
57 if ( m_output.key() != "" )
58 {
59 auto output = SG::makeHandle( m_output, getContext() );
60 output = std::make_unique<int>( 1 );
61 }
62
63 // Identify if this is a view
64 SG::View* theView = dynamic_cast< SG::View* >( theStore );
65 if ( theView )
66 {
67 ATH_MSG_INFO( theView->dump() );
68 }
69 else
70 {
71 ATH_MSG_INFO( "This is not an EventView" );
72 }
73
74 return StatusCode::SUCCESS;
75}
76
77} //> end namespace AthViews
#define ATH_MSG_INFO(x)
#define ATH_MSG_DEBUG(x)
#define CHECK(...)
Evaluate an expression and check for errors.
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
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 execute()
SG::WriteHandleKey< int > m_output
Definition ViewTestAlg.h:40
virtual StatusCode finalize()
virtual StatusCode initialize()
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())