Project
Loading...
Searching...
No Matches
o2DummyCalibrationWorkflow.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
#include "
Framework/ConfigParamSpec.h
"
12
#include "
Framework/DataTakingContext.h
"
13
#include "
Framework/CompletionPolicyHelpers.h
"
14
#include "
Framework/DeviceSpec.h
"
15
#include "
Framework/ControlService.h
"
16
#include "
Framework/Configurable.h
"
17
#include "
Framework/RunningWorkflowInfo.h
"
18
#include "
Framework/CallbackService.h
"
19
#include "
Framework/EndOfStreamContext.h
"
20
#include <fairmq/Device.h>
21
22
#include <iostream>
23
#include <vector>
24
25
using namespace
o2::framework
;
26
27
#include "
Framework/runDataProcessing.h
"
28
29
// This is how you can define your processing in a declarative way
30
WorkflowSpec
defineDataProcessing
(
ConfigContext
const
& specs)
31
{
32
DataProcessorSpec
a
{
33
.
name
=
"counter"
,
34
.outputs = {
OutputSpec
{{
"counter"
},
"TST"
,
"A1"
}},
35
.algorithm =
AlgorithmSpec
{
adaptStateless
(
36
[](
DataAllocator
& outputs,
ProcessingContext
& pcx) {
37
static
int
counter
= 0;
38
auto
& aData = outputs.
make
<
int
>(
OutputRef
{
"counter"
});
39
aData =
counter
++;
40
if
(
counter
== 10) {
41
pcx.
services
().
get
<
ControlService
>().endOfStream();
42
}
43
})},
44
};
45
46
DataProcessorSpec
b
{
47
.
name
=
"aggregator"
,
48
.inputs = {
InputSpec
{
"x"
,
"TST"
,
"A1"
, Lifetime::Timeframe}},
49
.outputs = {
OutputSpec
{{
"average"
},
"TST"
,
"B1"
, Lifetime::Sporadic}},
50
.algorithm =
adaptStateful
([](
CallbackService
& callbacks) {
51
static
int
sum
= 0;
52
auto
eosCallback = [](
EndOfStreamContext
&ctx) {
53
auto
& aData = ctx.outputs().make<
int
>(
OutputRef
{
"average"
});
54
aData =
sum
;
55
ctx.services().get<
ControlService
>().endOfStream();
56
};
57
callbacks.
set
<CallbackService::Id::EndOfStream>(eosCallback);
58
return
adaptStateless
([](
Input<"x", int>
const
&
x
)
59
{
60
sum
+=
x
;
61
std::cout <<
"Sum: "
<<
sum
<< std::endl;
62
}); })};
63
64
DataProcessorSpec
c
{.
name
=
"publisher"
,
65
.inputs = {
InputSpec
{
"average"
,
"TST"
,
"B1"
, Lifetime::Sporadic}},
66
.algorithm =
adaptStateless
([](
Input<"average", int>
const
&
counter
) {
67
std::cout <<
"Counter to publish: "
<<
counter
<< std::endl;
68
})};
69
70
return
workflow::concat
(
WorkflowSpec
{
a
},
71
WorkflowSpec
{
b
},
72
WorkflowSpec
{
c
});
73
}
CallbackService.h
CompletionPolicyHelpers.h
ConfigParamSpec.h
Configurable.h
ControlService.h
DataTakingContext.h
DeviceSpec.h
EndOfStreamContext.h
c
uint32_t c
Definition
RawData.h:2
RunningWorkflowInfo.h
o2::framework::CallbackService
Definition
CallbackService.h:35
o2::framework::CallbackService::set
void set(U &&cb)
Definition
CallbackService.h:127
o2::framework::ConfigContext
Definition
ConfigContext.h:24
o2::framework::ControlService
Definition
ControlService.h:40
o2::framework::DataAllocator
Definition
DataAllocator.h:135
o2::framework::DataAllocator::make
decltype(auto) make(const Output &spec, Args... args)
Definition
DataAllocator.h:166
o2::framework::EndOfStreamContext
Definition
EndOfStreamContext.h:22
o2::framework::ProcessingContext
Definition
ProcessingContext.h:27
o2::framework::ProcessingContext::services
ServiceRegistryRef services()
The services registry associated with this processing context.
Definition
ProcessingContext.h:39
o2::framework::ServiceRegistryRef::get
T & get() const
Definition
ServiceRegistryRef.h:85
sum
float sum(float s, o2::dcs::DataPointValue v)
Definition
dcs-ccdb.cxx:39
x
GLint GLenum GLint x
Definition
glcorearb.h:403
b
GLboolean GLboolean GLboolean b
Definition
glcorearb.h:1233
a
GLboolean GLboolean GLboolean GLboolean a
Definition
glcorearb.h:1233
counter
GLuint counter
Definition
glcorearb.h:3987
o2::framework::workflow::concat
WorkflowSpec concat(T &&t, ARGS &&... args)
Definition
WorkflowSpec.h:129
o2::framework
Defining PrimaryVertex explicitly as messageable.
Definition
TFIDInfo.h:20
o2::framework::WorkflowSpec
std::vector< DataProcessorSpec > WorkflowSpec
Definition
HBFUtilsInitializer.h:39
o2::framework::adaptStateless
AlgorithmSpec::ProcessCallback adaptStateless(LAMBDA l)
Definition
AlgorithmSpec.h:229
o2::framework::adaptStateful
AlgorithmSpec::InitCallback adaptStateful(LAMBDA l)
Definition
AlgorithmSpec.h:236
defineDataProcessing
WorkflowSpec defineDataProcessing(ConfigContext const &specs)
This function hooks up the the workflow specifications into the DPL driver.
Definition
o2DummyCalibrationWorkflow.cxx:30
runDataProcessing.h
o2::framework::AlgorithmSpec
Definition
AlgorithmSpec.h:43
o2::framework::DataProcessorSpec
Definition
DataProcessorSpec.h:41
o2::framework::DataProcessorSpec::name
std::string name
Definition
DataProcessorSpec.h:42
o2::framework::InputSpec
Definition
InputSpec.h:31
o2::framework::Input
Definition
AlgorithmSpec.h:88
o2::framework::OutputRef
Definition
OutputRef.h:29
o2::framework::OutputSpec
Definition
OutputSpec.h:33
Framework
TestWorkflows
src
o2DummyCalibrationWorkflow.cxx
Generated on Tue Feb 25 2025 23:16:41 for Project by
1.9.8