Project
Loading...
Searching...
No Matches
ctf-writer-workflow.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
12#include <string>
13#include <vector>
14#include "Framework/Logger.h"
18#include "Framework/InputSpec.h"
23
24using namespace o2::framework;
26
27// we need to add workflow options before including Framework/runDataProcessing
28void customize(std::vector<o2::framework::ConfigParamSpec>& workflowOptions)
29{
30 // option allowing to set parameters
31 std::vector<o2::framework::ConfigParamSpec> options;
32 options.push_back(ConfigParamSpec{"onlyDet", VariantType::String, std::string{DetID::NONE}, {"comma separated list of detectors to accept. Overrides skipDet"}});
33 options.push_back(ConfigParamSpec{"skipDet", VariantType::String, std::string{DetID::NONE}, {"comma separate list of detectors to skip"}});
34 options.push_back(ConfigParamSpec{"output-type", VariantType::String, "ctf", {"output types: ctf (per TF) or dict (create dictionaries) or both or none"}});
35 options.push_back(ConfigParamSpec{"ctf-writer-verbosity", VariantType::Int, 0, {"verbosity level (0: summary per detector, 1: summary per block"}});
36 options.push_back(ConfigParamSpec{"report-data-size-interval", VariantType::Int, 200, {"report sizes per detector for every N-th timeframe"}});
37 options.push_back(ConfigParamSpec{"configKeyValues", VariantType::String, "", {"Semicolon separated key=value strings"}});
38 std::swap(workflowOptions, options);
39}
40
41void customize(std::vector<o2::framework::CompletionPolicy>& policies)
42{
43 // ordered policies for the writers
44 policies.push_back(CompletionPolicyHelpers::consumeWhenAllOrdered(".*(?:CTF|ctf).*[W,w]riter.*"));
45}
46
47// ------------------------------------------------------------------
49
51{
52 DetID::mask_t dets = 0;
53 o2::conf::ConfigurableParam::updateFromString(configcontext.options().get<std::string>("configKeyValues"));
54 std::string outType{}; // RS FIXME once global/local options clash is solved, --output-type will become device option
55 if (!configcontext.helpOnCommandLine()) {
56 dets.set(); // by default read all
57 auto mskOnly = DetID::getMask(configcontext.options().get<std::string>("onlyDet"));
58 auto mskSkip = DetID::getMask(configcontext.options().get<std::string>("skipDet"));
59 if (mskOnly.any()) {
60 dets &= mskOnly;
61 } else {
62 dets ^= mskSkip;
63 }
64 if (dets.none()) {
65 throw std::invalid_argument("Invalid workflow: no detectors found");
66 }
67 outType = configcontext.options().get<std::string>("output-type");
68 }
69 WorkflowSpec specs{o2::ctf::getCTFWriterSpec(dets, outType,
70 configcontext.options().get<int>("ctf-writer-verbosity"),
71 configcontext.options().get<int>("report-data-size-interval"))};
72 return std::move(specs);
73}
Definition of the Names Generator class.
static void updateFromString(std::string const &)
Static class with identifiers, bitmasks and names for ALICE detectors.
Definition DetID.h:58
static constexpr std::string_view NONE
keywork for no-detector
Definition DetID.h:103
static mask_t getMask(const std::string_view detList)
detector masks from any non-alpha-num delimiter-separated list (empty if NONE is supplied)
Definition DetID.cxx:42
ConfigParamRegistry & options() const
void customize(std::vector< o2::framework::ConfigParamSpec > &workflowOptions)
WorkflowSpec defineDataProcessing(ConfigContext const &configcontext)
framework::DataProcessorSpec getCTFWriterSpec(o2::detectors::DetID::mask_t dets, const std::string &outType, int verbosity, int reportInterval)
create a processor spec
Defining PrimaryVertex explicitly as messageable.
Definition TFIDInfo.h:20
std::vector< DataProcessorSpec > WorkflowSpec
static CompletionPolicy consumeWhenAllOrdered(const char *name, CompletionPolicy::Matcher matcher)
as consumeWhenAll, but ensures that records are processed with incremental timeSlice (DataHeader::sta...