ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
D3PDTools
EventLoopAlgs
Root
WhiteBoardSvc.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3
*/
4
6
7
//
8
// includes
9
//
10
//
11
12
#include <
EventLoopAlgs/WhiteBoardSvc.h
>
13
14
#include <memory>
15
#include <
RootCoreUtils/Assert.h
>
16
#include <
EventLoop/IWorker.h
>
17
#include <
SampleHandler/MetaData.h
>
18
#include <
SampleHandler/MetaVector.h
>
19
20
//
21
// method implementations
22
//
23
24
ClassImp
(
EL::WhiteBoardSvc
)
25
26
namespace
EL
27
{
28
WhiteBoardSvc *
getWhiteBoardSvc
(IWorker *worker)
29
{
30
RCU_REQUIRE_SOFT
(worker != 0);
31
WhiteBoardSvc *
const
result
32
=
dynamic_cast<
WhiteBoardSvc*
>
(worker->getAlg (
"WhiteBoardSvc"
));
33
RCU_ASSERT2_SOFT
(result != 0,
"whiteboard service not found"
);
34
return
result;
35
}
36
37
38
39
void
WhiteBoardSvc ::
40
testInvariant ()
const
41
{
42
RCU_INVARIANT
(
this
!= 0);
43
}
44
45
46
47
WhiteBoardSvc ::
48
WhiteBoardSvc ()
49
{
50
RCU_NEW_INVARIANT
(
this
);
51
}
52
53
54
55
bool
WhiteBoardSvc ::
56
hasVar (
const
std::string& name)
const
57
{
59
return
doHasVar (name);
60
}
61
62
63
64
float
WhiteBoardSvc ::
65
getFloat (
const
std::string& name)
const
66
{
68
return
doGetFloat (name);
69
}
70
71
72
73
void
WhiteBoardSvc ::
74
getArray (
const
std::string& name, std::size_t&
size
,
75
const
float
*& values)
const
76
{
78
std::size_t tmpSize = 0;
79
const
float
*tmpValues = 0;
80
doGetArray (name, tmpSize, tmpValues);
81
size
= tmpSize;
82
values = tmpValues;
83
}
84
85
86
87
TObject *WhiteBoardSvc ::
88
getTObject (
const
std::string& name)
const
89
{
91
TObject *result = doGetTObject (name);
92
RCU_PROVIDE
(result != 0);
93
return
result;
94
}
95
96
97
98
void
WhiteBoardSvc ::
99
setFloat (
const
std::string& name,
float
value)
100
{
102
doSetFloat (name, value);
103
}
104
105
106
107
void
WhiteBoardSvc ::
108
setArray (
const
std::string& name,
const
std::vector<float>& value)
109
{
111
doSetArray (name, value.size(), &value[0]);
112
}
113
114
115
116
void
WhiteBoardSvc ::
117
setArray (
const
std::string& name, std::size_t
size
,
const
float
*values)
118
{
120
doSetArray (name,
size
, values);
121
}
122
123
124
125
void
WhiteBoardSvc ::
126
setTObject (TObject *
object
,
bool
swallow)
127
{
129
doSetTObject (
object
, swallow);
130
}
131
132
133
134
const
char
*WhiteBoardSvc ::
135
GetName ()
const
136
{
137
RCU_READ_INVARIANT
(
this
);
138
return
"WhiteBoardSvc"
;
139
}
140
141
142
143
bool
WhiteBoardSvc ::
144
doHasVar (
const
std::string&
/*name*/
)
const
145
{
146
RCU_ASSERT0_NOIMP
(
"failed to override WhiteBoardSvc::doHasVar"
);
147
return
false
;
// compiler dummy
148
}
149
150
151
152
float
WhiteBoardSvc ::
153
doGetFloat (
const
std::string& name)
const
154
{
156
157
TObject *
const
object
= getTObject (name);
158
RCU_ASSERT
(
object
!= 0);
159
SH::MetaData<float>
*
const
meta
160
=
dynamic_cast<
SH::MetaData<float>
*
>
(object);
161
RCU_ASSERT2_SOFT
(
meta
!= 0, (
"variable "
+ name +
" not of type float"
).c_str());
162
return
meta
->value;
163
}
164
165
166
167
void
WhiteBoardSvc ::
168
doGetArray (
const
std::string& name, std::size_t&
size
,
169
const
float
*& values)
const
170
{
172
173
TObject *
const
object
= getTObject (name);
174
RCU_ASSERT
(
object
!= 0);
175
SH::MetaVector<float>
*
const
meta
176
=
dynamic_cast<
SH::MetaVector<float>
*
>
(object);
177
RCU_ASSERT2_SOFT
(
meta
!= 0, (
"variable "
+ name +
" not of type float array"
).c_str());
178
size
=
meta
->value.size();
179
values = &
meta
->value[0];
180
}
181
182
183
184
TObject *WhiteBoardSvc ::
185
doGetTObject (
const
std::string&
/*name*/
)
const
186
{
187
RCU_ASSERT0_NOIMP
(
"function WhiteBoardSvc::doGetTObject not overloaded"
);
188
return
0;
// compiler dummy
189
}
190
191
192
193
void
WhiteBoardSvc ::
194
doSetFloat (
const
std::string& name,
float
value)
195
{
197
198
std::unique_ptr<SH::MetaData<float> >
meta
(
new
SH::MetaData<float>
);
199
meta
->SetName (name.c_str());
200
meta
->value = value;
201
setTObject (
meta
.release(),
true
);
202
}
203
204
205
206
void
WhiteBoardSvc ::
207
doSetArray (
const
std::string& name, std::size_t
size
,
const
float
*values)
208
{
210
211
std::unique_ptr<SH::MetaVector<float> >
meta
(
new
SH::MetaVector<float>
);
212
meta
->SetName (name.c_str());
213
std::vector<float> (values, values+
size
).swap (
meta
->value);
214
setTObject (
meta
.release(),
true
);
215
}
216
217
218
219
void
WhiteBoardSvc ::
220
doSetTObject (TObject *
object
,
bool
swallow)
221
{
222
if
(swallow)
223
delete
object;
224
RCU_ASSERT0_NOIMP
(
"function WhiteBoardSvc::doSetTObject not overloaded"
);
225
}
226
}
Assert.h
RCU_INVARIANT
#define RCU_INVARIANT(x)
Definition
Assert.h:189
RCU_ASSERT
#define RCU_ASSERT(x)
Definition
Assert.h:210
RCU_ASSERT2_SOFT
#define RCU_ASSERT2_SOFT(x, y)
Definition
Assert.h:157
RCU_NEW_INVARIANT
#define RCU_NEW_INVARIANT(x)
Definition
Assert.h:221
RCU_ASSERT0_NOIMP
#define RCU_ASSERT0_NOIMP(y)
Definition
Assert.h:182
RCU_PROVIDE
#define RCU_PROVIDE(x)
Definition
Assert.h:203
RCU_REQUIRE_SOFT
#define RCU_REQUIRE_SOFT(x)
Definition
Assert.h:141
RCU_READ_INVARIANT
#define RCU_READ_INVARIANT(x)
Definition
Assert.h:217
IWorker.h
MetaData.h
MetaVector.h
size
size_t size() const
Number of registered mappings.
ClassImp
ClassImp(EL::WhiteBoardSvc) namespace EL
Definition
WhiteBoardSvc.cxx:24
WhiteBoardSvc.h
EL::WhiteBoardSvc
Definition
WhiteBoardSvc.h:32
SH::MetaData
A class implementing a templatized version of the meta-data.
Definition
MetaData.h:19
SH::MetaVector
This class defines a templatized version of the meta-data in vector form.
Definition
MetaVector.h:20
EL
This module defines the arguments passed from the BATCH driver to the BATCH worker.
Definition
AsgComponentFactories.h:16
EL::getWhiteBoardSvc
WhiteBoardSvc * getWhiteBoardSvc(IWorker *worker)
effects: get the whiteboard service for this worker guarantee: strong failures: formula service not c...
meta
-diff
Generated on
for ATLAS Offline Software by
1.17.0