Project
Loading...
Searching...
No Matches
test_o2RootMessageWorkflow.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.
16#include <Monitoring/Monitoring.h>
17#include "Headers/DataHeader.h"
18// FIXME: this should not be needed as the framework should be able to
19// decode TClonesArray by itself.
21#include "Framework/Logger.h"
22#include <TClonesArray.h>
23#include <TH1F.h>
24#include <TString.h>
25#include <TObjString.h>
26#include <chrono>
27
28using namespace o2::framework;
32
33// This is how you can define your processing in a declarative way
35{
36 return WorkflowSpec{
37 {"producer",
38 {},
39 {OutputSpec{"TST", "HISTOS"},
40 OutputSpec{"TST", "STRING"}},
42 [](ProcessingContext& ctx) {
43 std::this_thread::sleep_for(std::chrono::seconds(1));
44 // Create an histogram
45 auto& singleHisto = ctx.outputs().make<TH1F>(Output{"TST", "HISTOS", 0}, "h1", "test", 100, -10., 10.);
46 auto& aString = ctx.outputs().make<TObjString>(Output{"TST", "STRING", 0}, "fao");
47 singleHisto.FillRandom("gaus", 1000);
48 Double_t stats[4];
49 singleHisto.GetStats(stats);
50 LOG(info) << "sumw" << stats[0] << "\n"
51 << "sumw2" << stats[1] << "\n"
52 << "sumwx" << stats[2] << "\n"
53 << "sumwx2" << stats[3] << "\n";
54 aString.SetString("foo");
55 }}},
56 {"consumer",
57 {
58 InputSpec{"histos", "TST", "HISTOS"},
59 InputSpec{"string", "TST", "STRING"},
60 },
61 {},
63 [](ProcessingContext& ctx) {
64 // FIXME: for the moment we need to do the deserialization ourselves.
65 // this should probably be encoded in the serialization field
66 // of the DataHeader and done automatically by the framework
67 auto h = ctx.inputs().get<TH1F*>("histos");
68 if (h.get() == nullptr) {
69 throw std::runtime_error("Missing output");
70 }
71 Double_t stats[4];
72 h->GetStats(stats);
73 LOG(info) << "sumw" << stats[0] << "\n"
74 << "sumw2" << stats[1] << "\n"
75 << "sumwx" << stats[2] << "\n"
76 << "sumwx2" << stats[3] << "\n";
77 auto s = ctx.inputs().get<TObjString*>("string");
78
79 LOG(info) << "String is " << s->GetString().Data();
80 }}}};
81}
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error s
Class for time synchronization of RawReader instances.
Defining ITS Vertex explicitly as messageable.
Definition Cartesian.h:288
std::vector< DataProcessorSpec > WorkflowSpec
Descriptor< gSizeDataDescriptionString > DataDescription
Definition DataHeader.h:554
Descriptor< gSizeDataOriginString > DataOrigin
Definition DataHeader.h:553
the main header struct
Definition DataHeader.h:623
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"
WorkflowSpec defineDataProcessing(ConfigContext const &)
This function hooks up the the workflow specifications into the DPL driver.