Project
Loading...
Searching...
No Matches
o2TwoTimers.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.
22#include <fairmq/Device.h>
23
24#include <iostream>
25#include <chrono>
26#include <thread>
27#include <vector>
28
29using namespace o2::framework;
31
32// This is how you can define your processing in a declarative way
34{
35 DataProcessorSpec timer1{
36 .name = "timer1",
37 .inputs = {InputSpec{"x", "TIM", "A1", Lifetime::Timer}},
38 .outputs = {OutputSpec{{"output"}, "TST", "A1"}},
39 .algorithm = AlgorithmSpec{adaptStateless(
40 [](DataAllocator& outputs, RawDeviceService& device, DataTakingContext& context, ProcessingContext& pcx) {
41 auto& aData = outputs.make<int>(OutputRef{"output"}, 1);
42 LOG(info) << "timer1: " << aData[0];
43 })},
44 .options = {
45 ConfigParamSpec{"some-device-param", VariantType::Int, 1, {"Some device parameter"}},
46 }};
47 DataProcessorSpec timer2{
48 .name = "timer2",
49 .inputs = {InputSpec{"x", "TIM", "A1", Lifetime::Timer}},
50 .outputs = {OutputSpec{{"output"}, "TST", "A2"}},
51 .algorithm = AlgorithmSpec{adaptStateless(
52 [](DataAllocator& outputs, RawDeviceService& device, DataTakingContext& context, ProcessingContext& pcx) {
53 auto& aData = outputs.make<int>(OutputRef{"output"}, 1);
54 LOG(info) << "timer2: " << aData[0];
55 })},
56 .options = {
57 ConfigParamSpec{"some-device-param", VariantType::Int, 1, {"Some device parameter"}},
58 }};
59
60 return workflow::concat(WorkflowSpec{timer1, timer2});
61}
decltype(auto) make(const Output &spec, Args... args)
WorkflowSpec concat(T &&t, ARGS &&... args)
Defining PrimaryVertex explicitly as messageable.
Definition TFIDInfo.h:20
std::vector< DataProcessorSpec > WorkflowSpec
AlgorithmSpec::ProcessCallback adaptStateless(LAMBDA l)
WorkflowSpec defineDataProcessing(ConfigContext const &specs)
This function hooks up the the workflow specifications into the DPL driver.
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"