ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
D3PDTools
AnaAlgorithm
Root
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
//
11
#include <
AnaAlgorithm/AnaAlgorithmWrapper.h
>
12
#include <
AnaAlgorithm/MessageCheck.h
>
13
14
#include "
RootCoreUtils/Assert.h
"
15
16
//
17
// method implementations
18
//
19
20
namespace
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;
70
RCU_CHANGE_INVARIANT
(
this
);
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 (
const
EventContext& ctx)
83
{
84
using namespace
msgAlgorithmConfig;
85
RCU_READ_INVARIANT
(
this
);
86
if
(
m_algorithm
->sysExecute(ctx).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
}
AnaAlgorithmWrapper.h
Assert.h
RCU_INVARIANT
#define RCU_INVARIANT(x)
Definition
Assert.h:187
RCU_CHANGE_INVARIANT
#define RCU_CHANGE_INVARIANT(x)
Definition
Assert.h:219
RCU_NEW_INVARIANT
#define RCU_NEW_INVARIANT(x)
Definition
Assert.h:221
RCU_READ_INVARIANT
#define RCU_READ_INVARIANT(x)
Definition
Assert.h:217
ANA_MSG_ERROR
#define ANA_MSG_ERROR(xmsg,...)
Macro printing error messages.
Definition
Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:295
MessageCheck.h
EL::AnaAlgorithmConfig
an object that can create a AnaAlgorithm
Definition
AnaAlgorithmConfig.h:29
EL::AnaAlgorithmWrapper::m_algorithm
std::unique_ptr< AnaAlgorithm > m_algorithm
the actual algorithm (once instantiated)
Definition
AnaAlgorithmWrapper.h:76
EL::AnaAlgorithmWrapper::m_config
AnaAlgorithmConfig m_config
the algorithm configuration
Definition
AnaAlgorithmWrapper.h:69
EL
This module defines the arguments passed from the BATCH driver to the BATCH worker.
Definition
AsgComponentFactories.h:16
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition
PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
std
STL namespace.
EL::AlgorithmWorkerData
all the external components an algorithm needs before initialization (in EventLoop)
Definition
AlgorithmWorkerData.h:34
Generated on
for ATLAS Offline Software by
1.17.0