ATLAS Offline Software
ViewTestAlg.cxx
Go to the documentation of this file.
1 
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 
16 namespace AthViews {
17 
18 ViewTestAlg::ViewTestAlg( const std::string& name, ISvcLocator* pSvcLocator ) : AthAlgorithm( name, pSvcLocator )
19 {
20 }
21 
23 {
24 }
25 
27 {
28  ATH_MSG_DEBUG( "Initializing " << name() << "..." );
29 
30  if ( m_output.key() == "" )
31  {
32  renounce( m_output );
33  }
34  else
35  {
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
AthViews::ViewTestAlg::initialize
virtual StatusCode initialize()
Definition: ViewTestAlg.cxx:26
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
ExtendedEventContext.h
AthCommonDataStore< AthCommonMsg< Algorithm > >::renounce
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)
Definition: AthCommonDataStore.h:380
SG::VarHandleKey::key
const std::string & key() const
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:141
SG::makeHandle
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Definition: ReadCondHandle.h:270
Atlas::getExtendedEventContext
const ExtendedEventContext & getExtendedEventContext(const EventContext &ctx)
Retrieve an extended context from a context object.
Definition: ExtendedEventContext.cxx:32
AthViews::ViewTestAlg::m_output
SG::WriteHandleKey< int > m_output
Definition: ViewTestAlg.h:40
AthViews::ViewTestAlg::~ViewTestAlg
virtual ~ViewTestAlg()
Definition: ViewTestAlg.cxx:22
AthViews::ViewTestAlg::execute
virtual StatusCode execute()
Definition: ViewTestAlg.cxx:49
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
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
AthAlgorithm
Definition: AthAlgorithm.h:47
merge.output
output
Definition: merge.py:17
SG::View::dump
std::string dump(const std::string &indent="") const
for printing the content of the view
Definition: View.h:58
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
AthViews
Definition: ViewDataVerifier.cxx:18
ViewTestAlg.h
AthViews::ViewTestAlg::finalize
virtual StatusCode finalize()
Definition: ViewTestAlg.cxx:42
AthViews::ViewTestAlg::ViewTestAlg
ViewTestAlg()
View.h
SG::View
Definition: View.h:25