ATLAS Offline Software
AsgToolWrapper.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
7 
8 
9 //
10 // includes
11 //
12 
14 
15 #include <EventLoop/MessageCheck.h>
16 #include <RootCoreUtils/Assert.h>
17 
18 //
19 // method implementations
20 //
21 
22 namespace EL
23 {
25  testInvariant () const
26  {
27  RCU_INVARIANT (!m_config.name().empty());
28  }
29 
30 
31 
34  : m_config (std::move (val_config))
35  {
36  RCU_NEW_INVARIANT (this);
37  }
38 
39 
40 
41  std::string_view AsgToolWrapper ::
42  getName () const
43  {
44  RCU_READ_INVARIANT (this);
45  return m_config.name();
46  }
47 
48 
49 
51  hasName (const std::string& name) const
52  {
53  RCU_READ_INVARIANT (this);
54  return m_config.name() == name;
55  }
56 
57 
58 
59  std::unique_ptr<IAlgorithmWrapper> AsgToolWrapper ::
60  makeClone() const
61  {
62  RCU_READ_INVARIANT (this);
63  return std::make_unique<AsgToolWrapper> (m_config);
64  }
65 
66 
67 
69  initialize (const AlgorithmWorkerData& /*workerData*/)
70  {
71  using namespace msgEventLoop;
72  RCU_CHANGE_INVARIANT (this);
73  if (m_config.makeTool (m_tool, m_cleanup).isFailure())
74  {
75  ANA_MSG_ERROR ("failed to create AsgTool: " << m_config.name());
76  return StatusCode::FAILURE;
77  }
78  return StatusCode::SUCCESS;
79  }
80 
81 
82 
84  execute ()
85  {
86  RCU_READ_INVARIANT (this);
87  return StatusCode::SUCCESS;
88  }
89 
90 
91 
93  finalize ()
94  {
95  RCU_READ_INVARIANT (this);
96  return StatusCode::SUCCESS;
97  }
98 
99 
100 
102  fileExecute ()
103  {
104  RCU_READ_INVARIANT (this);
105  return StatusCode::SUCCESS;
106  }
107 
108 
109 
112  {
113  RCU_READ_INVARIANT (this);
114  return StatusCode::SUCCESS;
115  }
116 
117 
118 
120  endInputFile ()
121  {
122  // no-op
123  return StatusCode::SUCCESS;
124  }
125 }
EL::AsgToolWrapper::endInputFile
virtual ::StatusCode endInputFile() override
call endInputFile on the algorithm
Definition: AsgToolWrapper.cxx:120
EL::AsgToolWrapper::execute
virtual StatusCode execute() override
call execute on the algorithm
Definition: AsgToolWrapper.cxx:84
EL::AsgToolWrapper::initialize
virtual StatusCode initialize(const AlgorithmWorkerData &workerData) override
call initialize on the algorithm
Definition: AsgToolWrapper.cxx:69
EL::AsgToolWrapper::finalize
virtual StatusCode finalize() override
call finalize on the algorithm
Definition: AsgToolWrapper.cxx:93
ANA_MSG_ERROR
#define ANA_MSG_ERROR(xmsg)
Macro printing error messages.
Definition: Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:294
Assert.h
MessageCheck.h
EL::AsgToolWrapper::getName
virtual std::string_view getName() const override
Definition: AsgToolWrapper.cxx:42
EL::AsgToolWrapper::m_config
asg::AsgToolConfig m_config
the algorithm configuration
Definition: AsgToolWrapper.h:69
AsgToolWrapper.h
asg::AsgToolConfig
an object that can create a AsgTool
Definition: AsgToolConfig.h:22
EL::AsgToolWrapper::hasName
virtual bool hasName(const std::string &name) const override
whether this algorithm has the given name
Definition: AsgToolWrapper.cxx:51
EL::AsgToolWrapper::m_tool
ToolHandle< asg::AsgTool > m_tool
the actual tool (once instantiated)
Definition: AsgToolWrapper.h:76
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
EL
This module defines the arguments passed from the BATCH driver to the BATCH worker.
Definition: AlgorithmWorkerData.h:24
EL::AsgToolWrapper::beginInputFile
virtual ::StatusCode beginInputFile() override
call beginInputFile on the algorithm
Definition: AsgToolWrapper.cxx:111
RCU_INVARIANT
#define RCU_INVARIANT(x)
Definition: Assert.h:201
EL::AsgToolWrapper::makeClone
virtual std::unique_ptr< IAlgorithmWrapper > makeClone() const override
make a clone of this algorithm
Definition: AsgToolWrapper.cxx:60
EL::AsgToolWrapper::fileExecute
virtual ::StatusCode fileExecute() override
call fileExecute on the algorithm
Definition: AsgToolWrapper.cxx:102
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
EL::AlgorithmWorkerData
all the external components an algorithm needs before initialization (in EventLoop)
Definition: AlgorithmWorkerData.h:34
EL::AsgToolWrapper::m_cleanup
std::shared_ptr< void > m_cleanup
the cleanup pointer for this tool
Definition: AsgToolWrapper.h:83
RCU_CHANGE_INVARIANT
#define RCU_CHANGE_INVARIANT(x)
Definition: Assert.h:231
asg::AsgComponentConfig::name
const std::string & name() const noexcept
the name of the component
Definition: AsgComponentConfig.cxx:90
asg::AsgToolConfig::makeTool
::StatusCode makeTool(ToolHandle< T > &toolHandle, std::shared_ptr< void > &cleanup, bool allowNestedName=false) const
make a tool with the given configuration
EL::AsgToolWrapper::testInvariant
void testInvariant() const
test the invariant of this object
Definition: AsgToolWrapper.cxx:25
RCU_READ_INVARIANT
#define RCU_READ_INVARIANT(x)
Definition: Assert.h:229
EL::AsgToolWrapper::AsgToolWrapper
AsgToolWrapper()
standard default constructor for serialization
Definition: AsgToolWrapper.h:33
RCU_NEW_INVARIANT
#define RCU_NEW_INVARIANT(x)
Definition: Assert.h:233