ATLAS Offline Software
Loading...
Searching...
No Matches
AnaAlgorithmWrapper.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// includes
10//
13
15
16//
17// method implementations
18//
19
20namespace EL
21{
22 void AnaAlgorithmWrapper ::
23 testInvariant () const
24 {
25 RCU_INVARIANT (!m_config.name().empty());
26 }
27
28
29
30 AnaAlgorithmWrapper ::
31 AnaAlgorithmWrapper (AnaAlgorithmConfig val_config)
32 : m_config (std::move (val_config))
33 {
34 RCU_NEW_INVARIANT (this);
35 }
36
37
38
39 std::string_view AnaAlgorithmWrapper ::
40 getName () const
41 {
42 RCU_READ_INVARIANT (this);
43 return m_config.name();
44 }
45
46
47
48 bool AnaAlgorithmWrapper ::
49 hasName (const std::string& name) const
50 {
51 RCU_READ_INVARIANT (this);
52 return m_config.name() == name;
53 }
54
55
56
57 std::unique_ptr<IAlgorithmWrapper> AnaAlgorithmWrapper ::
58 makeClone() const
59 {
60 RCU_READ_INVARIANT (this);
61 return std::make_unique<AnaAlgorithmWrapper> (m_config);
62 }
63
64
65
66 StatusCode AnaAlgorithmWrapper ::
67 initialize (const AlgorithmWorkerData& workerData)
68 {
69 using namespace msgAlgorithmConfig;
71 if (m_config.makeAlgorithm (m_algorithm, workerData).isFailure())
72 {
73 ANA_MSG_ERROR ("failed to create AnaAlgorithm: " << m_config.name());
74 return StatusCode::FAILURE;
75 }
76 return StatusCode::SUCCESS;
77 }
78
79
80
81 StatusCode AnaAlgorithmWrapper ::
82 execute ()
83 {
84 using namespace msgAlgorithmConfig;
85 RCU_READ_INVARIANT (this);
86 if (m_algorithm->sysExecute().isFailure())
87 {
88 ANA_MSG_ERROR ("failed to call execute() on algorithm: " << m_config.name());
89 return StatusCode::FAILURE;
90 }
91 return StatusCode::SUCCESS;
92 }
93
94
95
96 StatusCode AnaAlgorithmWrapper ::
97 finalize ()
98 {
99 using namespace msgAlgorithmConfig;
100 RCU_READ_INVARIANT (this);
101 if (m_algorithm->sysFinalize().isFailure())
102 {
103 ANA_MSG_ERROR ("failed to call finalize() on algorithm: " << m_config.name());
104 return StatusCode::FAILURE;
105 }
106 return StatusCode::SUCCESS;
107 }
108
109
110
111 StatusCode AnaAlgorithmWrapper ::
112 fileExecute ()
113 {
114 using namespace msgAlgorithmConfig;
115 RCU_READ_INVARIANT (this);
116 if (m_algorithm->hasFileExecute())
117 {
118 if (m_algorithm->sysFileExecute().isFailure())
119 {
120 ANA_MSG_ERROR ("failed to call fileExecute() on algorithm: " << m_config.name());
121 return StatusCode::FAILURE;
122 }
123 }
124 return StatusCode::SUCCESS;
125 }
126
127
128
129 StatusCode AnaAlgorithmWrapper ::
130 beginInputFile ()
131 {
132 using namespace msgAlgorithmConfig;
133 RCU_READ_INVARIANT (this);
134 if (m_algorithm->hasBeginInputFile())
135 {
136 if (m_algorithm->sysBeginInputFile().isFailure())
137 {
138 ANA_MSG_ERROR ("failed to call beginInputFile() on algorithm: " << m_config.name());
139 return StatusCode::FAILURE;
140 }
141 }
142 return StatusCode::SUCCESS;
143 }
144
145
146
147 ::StatusCode AnaAlgorithmWrapper ::
148 endInputFile ()
149 {
150 using namespace msgAlgorithmConfig;
151 RCU_READ_INVARIANT (this);
152 if (m_algorithm->hasEndInputFile())
153 {
154 if (m_algorithm->sysEndInputFile().isFailure())
155 {
156 ANA_MSG_ERROR ("failed to call endInputFile() on algorithm: " << m_config.name());
157 return StatusCode::FAILURE;
158 }
159 }
160 return StatusCode::SUCCESS;
161 }
162}
#define RCU_INVARIANT(x)
Definition Assert.h:201
#define RCU_CHANGE_INVARIANT(x)
Definition Assert.h:231
#define RCU_NEW_INVARIANT(x)
Definition Assert.h:233
#define RCU_READ_INVARIANT(x)
Definition Assert.h:229
#define ANA_MSG_ERROR(xmsg)
Macro printing error messages.
an object that can create a AnaAlgorithm
std::unique_ptr< AnaAlgorithm > m_algorithm
the actual algorithm (once instantiated)
AnaAlgorithmConfig m_config
the algorithm configuration
This module defines the arguments passed from the BATCH driver to the BATCH worker.
::StatusCode StatusCode
StatusCode definition for legacy code.
STL namespace.
all the external components an algorithm needs before initialization (in EventLoop)