Project
Loading...
Searching...
No Matches
tof-compressor.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
16
21#include "Framework/Logger.h"
25
26using namespace o2::framework;
27
28// add workflow options, note that customization needs to be declared before
29// including Framework/runDataProcessing
30void customize(std::vector<ConfigParamSpec>& workflowOptions)
31{
32 auto config = ConfigParamSpec{"tof-compressor-config", VariantType::String, "x:TOF/RAWDATA", {"TOF compressor workflow configuration"}};
33 auto outputDesc = ConfigParamSpec{"tof-compressor-output-desc", VariantType::String, "CRAWDATA", {"Output specs description string"}};
34 auto rdhVersion = ConfigParamSpec{"tof-compressor-rdh-version", VariantType::Int, o2::raw::RDHUtils::getVersion<o2::header::RAWDataHeader>(), {"Raw Data Header version"}};
35 auto verbose = ConfigParamSpec{"tof-compressor-verbose", VariantType::Bool, false, {"Enable verbose compressor"}};
36 auto paranoid = ConfigParamSpec{"tof-compressor-paranoid", VariantType::Bool, false, {"Enable paranoid compressor"}};
37 auto ignoreStf = ConfigParamSpec{"ignore-dist-stf", VariantType::Bool, false, {"do not subscribe to FLP/DISTSUBTIMEFRAME/0 message (no lost TF recovery)"}};
38 auto payloadlim = ConfigParamSpec{"payload-limit", VariantType::Int64, -1ll, {"Payload limit in Byte (-1 -> no limits)"}};
39
40 workflowOptions.push_back(config);
41 workflowOptions.push_back(outputDesc);
42 workflowOptions.push_back(rdhVersion);
43 workflowOptions.push_back(verbose);
44 workflowOptions.push_back(paranoid);
45 workflowOptions.push_back(ignoreStf);
46 workflowOptions.push_back(payloadlim);
47 workflowOptions.push_back(ConfigParamSpec{"configKeyValues", VariantType::String, "", {"Semicolon separated key=value strings"}});
48}
49
50#include "Framework/runDataProcessing.h" // the main driver
51
54{
55 o2::conf::ConfigurableParam::updateFromString(cfgc.options().get<std::string>("configKeyValues"));
56 auto config = cfgc.options().get<std::string>("tof-compressor-config");
57 // auto outputDesc = cfgc.options().get<std::string>("output-desc");
58 auto rdhVersion = cfgc.options().get<int>("tof-compressor-rdh-version");
59 auto verbose = cfgc.options().get<bool>("tof-compressor-verbose");
60 auto paranoid = cfgc.options().get<bool>("tof-compressor-paranoid");
61 auto ignoreStf = cfgc.options().get<bool>("ignore-dist-stf");
62 auto payloadLim = cfgc.options().get<long>("payload-limit");
63
64 std::vector<OutputSpec> outputs;
65 outputs.emplace_back(OutputSpec(ConcreteDataTypeMatcher{"TOF", "CRAWDATA"}));
66
67 AlgorithmSpec algoSpec;
68 if (rdhVersion == o2::raw::RDHUtils::getVersion<o2::header::RAWDataHeader>()) {
69 if (!verbose && !paranoid) {
70 algoSpec = AlgorithmSpec{adaptFromTask<o2::tof::CompressorTask<o2::header::RAWDataHeader, false, false>>(payloadLim)};
71 }
72 if (!verbose && paranoid) {
73 algoSpec = AlgorithmSpec{adaptFromTask<o2::tof::CompressorTask<o2::header::RAWDataHeader, false, true>>(payloadLim)};
74 }
75 if (verbose && !paranoid) {
76 algoSpec = AlgorithmSpec{adaptFromTask<o2::tof::CompressorTask<o2::header::RAWDataHeader, true, false>>(payloadLim)};
77 }
78 if (verbose && paranoid) {
79 algoSpec = AlgorithmSpec{adaptFromTask<o2::tof::CompressorTask<o2::header::RAWDataHeader, true, true>>(payloadLim)};
80 }
81 }
82
83 WorkflowSpec workflow;
84
100 std::stringstream ssconfig(config);
101 std::string iconfig;
102 int idevice = 0;
103
104 while (getline(ssconfig, iconfig, ',')) {
105 std::vector<InputSpec> inputs = select(iconfig.c_str());
106 if (!ignoreStf) {
107 inputs.emplace_back("stdDist", "FLP", "DISTSUBTIMEFRAME", 0, Lifetime::Timeframe);
108 }
109 workflow.emplace_back(DataProcessorSpec{
110 std::string("tof-compressor-") + std::to_string(idevice),
111 // select(iconfig.c_str()),
112 inputs,
113 outputs,
114 algoSpec,
115 Options{
116 {"tof-compressor-output-buffer-size", VariantType::Int, 1048576, {"Encoder output buffer size (in bytes). Zero = automatic (careful)."}},
117 {"tof-compressor-conet-mode", VariantType::Bool, false, {"Decoder CONET flag"}},
118 {"tof-compressor-decoder-verbose", VariantType::Bool, false, {"Decoder verbose flag"}},
119 {"tof-compressor-encoder-verbose", VariantType::Bool, false, {"Encoder verbose flag"}},
120 {"tof-compressor-checker-verbose", VariantType::Bool, false, {"Checker verbose flag"}}}});
121 idevice++;
122 }
123
124 return workflow;
125}
TOF raw data compressor task.
Definition of the Names Generator class.
static void updateFromString(std::string const &)
ConfigParamRegistry & options() const
Defining PrimaryVertex explicitly as messageable.
Definition TFIDInfo.h:20
std::vector< DataProcessorSpec > WorkflowSpec
std::vector< InputSpec > select(char const *matcher="")
std::string to_string(gsl::span< T, Size > span)
Definition common.h:52
WorkflowSpec defineDataProcessing(ConfigContext const &cfgc)
This function hooks up the the workflow specifications into the DPL driver.
void customize(std::vector< ConfigParamSpec > &workflowOptions)