Project
Loading...
Searching...
No Matches
O2DataModelHelpers.cxx
Go to the documentation of this file.
1
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3
// All rights not expressly granted are reserved.
4
//
5
// This software is distributed under the terms of the GNU General Public
6
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7
//
8
// In applying this license CERN does not waive the privileges and immunities
9
// granted to it by virtue of its status as an Intergovernmental Organization
10
// or submit itself to any jurisdiction.
11
12
#include "
Framework/O2DataModelHelpers.h
"
13
#include "
Framework/DataSpecUtils.h
"
14
15
namespace
o2::framework
16
{
17
void
O2DataModelHelpers::updateMissingSporadic
(fair::mq::Parts& parts, std::vector<OutputSpec>
const
& specs, std::vector<bool>& present)
18
{
19
// Mark as present anything which is not of Lifetime timeframe.
20
for
(
size_t
i
= 0;
i
< specs.size(); ++
i
) {
21
if
(specs[
i
].lifetime != Lifetime::Timeframe) {
22
present[
i
] =
true
;
23
}
24
}
25
26
auto
timeframeDataExists = [&present, &specs](
auto
const
& dh) ->
void
{
27
for
(
size_t
i
= 0;
i
< specs.size(); ++
i
) {
28
// We already found this, no need to check again.
29
if
(present[
i
]) {
30
continue
;
31
}
32
// The header is not there, we do not care.
33
if
(dh ==
nullptr
) {
34
continue
;
35
}
36
// The header matcher this output, we mark it as present.
37
if
(
DataSpecUtils::match
(specs[
i
],
ConcreteDataMatcher
{dh->dataOrigin, dh->dataDescription, dh->subSpecification})) {
38
present[
i
] =
true
;
39
}
40
}
41
};
42
O2DataModelHelpers::for_each_header
(parts, timeframeDataExists);
43
}
44
45
std::string
O2DataModelHelpers::describeMissingOutputs
(std::vector<OutputSpec>
const
& specs, std::vector<bool>
const
& present)
46
{
47
assert(specs.size() == present.size());
48
std::string error =
"This timeframe has a missing output of lifetime timeframe: "
;
49
bool
first
=
true
;
50
for
(
size_t
i
= 0;
i
< specs.size(); ++
i
) {
51
if
(present[
i
] ==
false
) {
52
if
(
first
) {
53
first
=
false
;
54
}
else
{
55
error +=
", "
;
56
}
57
error +=
DataSpecUtils::describe
(specs[
i
]);
58
}
59
}
60
error +=
". If this is expected, please change its lifetime to Sporadic / QA."
;
61
first
=
true
;
62
for
(
size_t
i
= 0;
i
< specs.size(); ++
i
) {
63
if
(present[
i
] ==
true
) {
64
if
(
first
) {
65
error +=
" Present outputs are: "
;
66
first
=
false
;
67
}
else
{
68
error +=
", "
;
69
}
70
error +=
DataSpecUtils::describe
(specs[
i
]);
71
}
72
}
73
if
(
first
) {
74
error +=
" No output was present."
;
75
}
else
{
76
error +=
"."
;
77
}
78
return
error;
79
}
80
}
// namespace o2::framework
DataSpecUtils.h
i
int32_t i
Definition
GPUCommonAlgorithm.h:443
O2DataModelHelpers.h
int
o2::framework
Defining PrimaryVertex explicitly as messageable.
Definition
TFIDInfo.h:20
o2::framework::ConcreteDataMatcher
Definition
ConcreteDataMatcher.h:54
o2::framework::DataSpecUtils::describe
static std::string describe(InputSpec const &spec)
Definition
DataSpecUtils.cxx:70
o2::framework::DataSpecUtils::match
static bool match(InputSpec const &spec, ConcreteDataMatcher const &target)
Definition
DataSpecUtils.cxx:232
o2::framework::O2DataModelHelpers::for_each_header
static void for_each_header(fair::mq::Parts &parts, F &&f)
Definition
O2DataModelHelpers.h:28
o2::framework::O2DataModelHelpers::updateMissingSporadic
static void updateMissingSporadic(fair::mq::Parts &parts, std::vector< OutputSpec > const &specs, std::vector< bool > &present)
Definition
O2DataModelHelpers.cxx:17
o2::framework::O2DataModelHelpers::describeMissingOutputs
static std::string describeMissingOutputs(std::vector< OutputSpec > const &specs, std::vector< bool > const &present)
Definition
O2DataModelHelpers.cxx:45
Framework
Core
src
O2DataModelHelpers.cxx
Generated on Tue Feb 25 2025 23:16:40 for Project by
1.9.8