Project
Loading...
Searching...
No Matches
o2SyncReconstructionDummy.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.
12
13#include <chrono>
14#include <thread>
15
16using namespace o2::framework;
17
18AlgorithmSpec simplePipe(std::string const& what)
19{
20 return AlgorithmSpec{[what](InitContext& ic) {
21 auto delay = std::chrono::seconds(ic.options().get<int>("delay"));
22 auto messageSize = ic.options().get<int>("size");
23
24 return [what, delay, messageSize](ProcessingContext& ctx) {
25 auto tStart = std::chrono::high_resolution_clock::now();
26 auto tEnd = std::chrono::high_resolution_clock::now();
27 auto& msg = ctx.outputs().make<char>(OutputRef{what}, messageSize);
28 while (std::chrono::duration_cast<std::chrono::seconds>(tEnd - tStart) < std::chrono::seconds(delay)) {
29 for (size_t i = 0; i < messageSize; ++i) {
30 msg[i] = 0;
31 }
32 tEnd = std::chrono::high_resolution_clock::now();
33 }
34 };
35 }};
36}
37
38// Helper to create two options, one for the delay between messages,
39// another one for the size of the message.
40std::vector<ConfigParamSpec> simplePipeOptions(int delay, int size)
41{
42 return {
43 ConfigParamSpec{"delay", VariantType::Int, delay, {"Delay between one iteration and the other"}},
44 ConfigParamSpec{"size", VariantType::Int, size, {"Size of the output message"}},
45 };
46}
47
48// This is how you can define your processing in a declarative way
50{
51 WorkflowSpec workflow{
52 DataProcessorSpec{"flp-dpl-source",
53 {},
54 {OutputSpec{{"tpc-cluster"}, "TPC", "CLUSTERS"},
55 OutputSpec{{"its-cluster"}, "ITS", "CLUSTERS"},
56 OutputSpec{{"trd-tracklet"}, "TRD", "TRACKLETS"},
57 OutputSpec{{"tof-cluster"}, "TOF", "CLUSTERS"},
58 OutputSpec{{"fit-data"}, "FIT", "DATA"},
59 OutputSpec{{"mch-cluster"}, "MCH", "CLUSTERS"},
60 OutputSpec{{"mid-cluster"}, "MID", "CLUSTERS"},
61 OutputSpec{{"emcal-cluster"}, "EMC", "CLUSTERS"},
62 OutputSpec{{"phos-cluster"}, "PHO", "CLUSTERS"},
63 OutputSpec{{"mft-cluster"}, "MFT", "CLUSTERS"},
64 OutputSpec{{"hmpid-cluster"}, "HMP", "CLUSTERS"}},
66 [](InitContext& setup) {
67 auto delay = setup.options().get<int>("epn-roundrobin-delay");
68 auto first = std::make_shared<bool>(true);
69 return [delay, first](ProcessingContext& ctx) {
70 if (*first == false) {
71 std::this_thread::sleep_for(std::chrono::seconds(delay));
72 }
73 *first = false;
74 ctx.outputs().make<int>(OutputRef{"tpc-cluster"}, 1);
75 ctx.outputs().make<int>(OutputRef{"its-cluster"}, 1);
76 ctx.outputs().make<int>(OutputRef{"trd-tracklet"}, 1);
77 ctx.outputs().make<int>(OutputRef{"tof-cluster"}, 1);
78 ctx.outputs().make<int>(OutputRef{"fit-data"}, 1);
79 ctx.outputs().make<int>(OutputRef{"mch-cluster"}, 1);
80 ctx.outputs().make<int>(OutputRef{"mid-cluster"}, 1);
81 ctx.outputs().make<int>(OutputRef{"emcal-cluster"}, 1);
82 ctx.outputs().make<int>(OutputRef{"phos-cluster"}, 1);
83 ctx.outputs().make<int>(OutputRef{"mft-cluster"}, 1);
84 ctx.outputs().make<int>(OutputRef{"hmpid-cluster"}, 1);
85 };
86 }},
87 {ConfigParamSpec{"epn-roundrobin-delay", VariantType::Int, 28, {"Fake delay for waiting from the network for a new timeframe"}}}},
88 DataProcessorSpec{"tpc-tracking",
89 {InputSpec{"clusters", "TPC", "CLUSTERS"}},
90 {OutputSpec{{"tracks"}, "TPC", "TRACKS"}},
91 simplePipe("tracks"),
92 simplePipeOptions(25, 1)},
93 DataProcessorSpec{"its-segment-matcher",
94 {InputSpec{"clusters", "ITS", "CLUSTERS"}},
95 {OutputSpec{{"segments"}, "ITS", "SEGMENTS"}},
96 simplePipe("segments"),
97 simplePipeOptions(8, 1)},
98 DataProcessorSpec{"its-triplet-matcher",
99 {InputSpec{"clusters", "ITS", "CLUSTERS"},
100 InputSpec{"segments", "ITS", "SEGMENTS"}},
101 {OutputSpec{{"triplets"}, "ITS", "TRIPLETS"}},
102 simplePipe("triplets"),
103 simplePipeOptions(7, 1)},
104 DataProcessorSpec{"its-tracks-fitter",
105 {InputSpec{"clusters", "ITS", "CLUSTERS"},
106 InputSpec{"triplets", "ITS", "TRIPLETS"}},
107 {OutputSpec{{"tracks"}, "ITS", "TRACKS"}},
108 simplePipe("tracks"),
109 simplePipeOptions(10, 1)},
110 DataProcessorSpec{"its-cluster-compression",
111 {InputSpec{"clusters", "ITS", "CLUSTERS"}},
112 {OutputSpec{{"compressed-clusters"}, "ITS", "CLUSTERS_C"}},
113 simplePipe("compressed-clusters"),
114 simplePipeOptions(25, 1)},
115 DataProcessorSpec{"trd-tracklets-compression",
116 {InputSpec{"tracklets", "TRD", "TRACKLETS"}},
117 {OutputSpec{{"compressed"}, "TRD", "TRACKLETS_C"}},
118 simplePipe("compressed"),
119 simplePipeOptions(5, 1)},
120 DataProcessorSpec{"tof-cluster-compression",
121 {InputSpec{"clusters", "TOF", "CLUSTERS"}},
122 {OutputSpec{{"compressed-clusters"}, "TOF", "CLUSTERS_C"}},
123 simplePipe("compressed-clusters"),
124 simplePipeOptions(1, 1)},
125 DataProcessorSpec{"fit-reconstruction",
126 {InputSpec{"fit-data", "FIT", "DATA"}},
127 {OutputSpec{{"interaction-times"}, "FIT", "I_TIMES"}},
128 simplePipe("interaction-times"),
129 simplePipeOptions(1, 1)},
130 DataProcessorSpec{"mch-cluster-compression",
131 {InputSpec{"clusters", "MCH", "CLUSTERS"}},
132 {OutputSpec{{"compressed-clusters"}, "MCH", "CLUSTERS_C"}},
133 simplePipe("compressed-clusters"),
134 simplePipeOptions(1, 1)},
135 DataProcessorSpec{"mid-cluster-compression",
136 {InputSpec{"clusters", "MID", "CLUSTERS"}},
137 {OutputSpec{{"compressed-clusters"}, "MID", "CLUSTERS_C"}},
138 simplePipe("compressed-clusters"),
139 simplePipeOptions(1, 1)},
140 DataProcessorSpec{"emc-cluster-compression",
141 {InputSpec{"clusters", "EMC", "CLUSTERS"}},
142 {OutputSpec{{"compressed-clusters"}, "EMC", "CLUSTERS_C"}},
143 simplePipe("compressed-clusters"),
144 simplePipeOptions(1, 1)},
145 DataProcessorSpec{"phos-cluster-compression",
146 {InputSpec{"clusters", "PHO", "CLUSTERS"}},
147 {OutputSpec{{"compressed-clusters"}, "PHO", "CLUSTERS_C"}},
148 simplePipe("compressed-clusters"),
149 simplePipeOptions(1, 1)},
150 DataProcessorSpec{"mft-cluster-compression",
151 {InputSpec{"clusters", "MFT", "CLUSTERS"}},
152 {OutputSpec{{"compressed-clusters"}, "MFT", "CLUSTERS_C"}},
153 simplePipe("compressed-clusters"),
154 simplePipeOptions(1, 1)},
155 DataProcessorSpec{"hmpid-cluster-compression",
156 {InputSpec{"clusters", "HMP", "CLUSTERS"}},
157 {OutputSpec{{"compressed-clusters"}, "HMP", "CLUSTERS_C"}},
158 simplePipe("compressed-clusters"),
159 simplePipeOptions(1, 1)},
161 "its-tpc-matching",
162 {InputSpec{"tpc-tracks", "TPC", "TRACKS"},
163 InputSpec{"its-tracks", "ITS", "TRACKS"},
164 InputSpec{"fit-interaction-times", "FIT", "I_TIMES"}},
165 {OutputSpec{{"tpc-its-matching"}, "MTC", "TPC_ITS"}},
166 simplePipe("tpc-its-matching"),
167 simplePipeOptions(3, 1)},
169 "its-tpc-trd-tof-matching",
170 {InputSpec{"tpc-tracks", "TPC", "TRACKS"},
171 InputSpec{"its-tracks", "ITS", "TRACKS"},
172 InputSpec{"tpc-its-matching", "MTC", "TPC_ITS"},
173 InputSpec{"fit-interaction-times", "FIT", "I_TIMES"}},
174 {OutputSpec{{"tpc-its-trd-tof-matching"}, "MTC", "ALL"}},
175 simplePipe("tpc-its-trd-tof-matching"),
176 simplePipeOptions(2, 1)},
178 "tpc-compression",
179 {InputSpec{"tpc-tracks", "TPC", "TRACKS"},
180 InputSpec{"tpc-clusters", "TPC", "CLUSTERS"}},
181 {OutputSpec{{"tpc-compressed"}, "TPC", "COMPRESSED"}},
182 simplePipe("tpc-compressed"),
183 simplePipeOptions(5, 1)},
185 "tpc-sp-calibration",
186 {InputSpec{"tpc-tracks", "TPC", "TRACKS"},
187 InputSpec{"its-tracks", "ITS", "TRACKS"},
188 InputSpec{"tpc-its-matching", "MTC", "TPC_ITS"},
189 InputSpec{"tpc-its-matching", "MTC", "ALL"}},
190 {OutputSpec{{"residuals"}, "SPC", "RESIDUALS"}},
191 simplePipe("residuals"),
192 simplePipeOptions(5, 1)},
194 "writer",
195 Inputs{
196 InputSpec{"compressed-its", "ITS", "CLUSTERS_C"},
197 InputSpec{"compressed-fit", "FIT", "I_TIMES"},
198 InputSpec{"compressed-trd", "TRD", "TRACKLETS_C"},
199 InputSpec{"compressed-tof", "TOF", "CLUSTERS_C"},
200 InputSpec{"compressed-mch", "MCH", "CLUSTERS_C"},
201 InputSpec{"compressed-mid", "MID", "CLUSTERS_C"},
202 InputSpec{"compressed-emc", "EMC", "CLUSTERS_C"},
203 InputSpec{"compressed-pho", "PHO", "CLUSTERS_C"},
204 InputSpec{"compressed-mft", "MFT", "CLUSTERS_C"},
205 InputSpec{"compressed-hmp", "HMP", "CLUSTERS_C"},
206 InputSpec{"compressed-res", "SPC", "RESIDUALS"},
207 InputSpec{"compressed-tpc", "TPC", "COMPRESSED"}},
208 {}}};
209 return workflow;
210}
int32_t i
GLsizeiptr size
Definition glcorearb.h:659
GLint first
Definition glcorearb.h:399
Defining PrimaryVertex explicitly as messageable.
Definition TFIDInfo.h:20
std::vector< DataProcessorSpec > WorkflowSpec
std::vector< InputSpec > Inputs
WorkflowSpec defineDataProcessing(ConfigContext const &specs)
This function hooks up the the workflow specifications into the DPL driver.
std::vector< ConfigParamSpec > simplePipeOptions(int delay, int size)
AlgorithmSpec simplePipe(std::string const &what)
uint64_t const void const *restrict const msg
Definition x9.h:153