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"
24
25using namespace o2::framework;
27
28// we need to add workflow options before including Framework/runDataProcessing
29void customize(std::vector<o2::framework::ConfigParamSpec>& workflowOptions)
30{
31 // option allowing to set parameters
32 std::vector<o2::framework::ConfigParamSpec> options;
33 options.push_back(ConfigParamSpec{"onlyDet", VariantType::String, std::string{DetID::NONE}, {"comma separated list of detectors to accept. Overrides skipDet"}});
34 options.push_back(ConfigParamSpec{"skipDet", VariantType::String, std::string{DetID::NONE}, {"comma separate list of detectors to skip"}});
35 options.push_back(ConfigParamSpec{"output-type", VariantType::String, "ctf", {"output types: ctf (per TF) or dict (create dictionaries) or both or none"}});
36 options.push_back(ConfigParamSpec{"ctf-writer-verbosity", VariantType::Int, 0, {"verbosity level (0: summary per detector, 1: summary per block"}});
37 options.push_back(ConfigParamSpec{"report-data-size-interval", VariantType::Int, 200, {"report sizes per detector for every N-th timeframe"}});
38 options.push_back(ConfigParamSpec{"configKeyValues", VariantType::String, "", {"Semicolon separated key=value strings"}});
40 std::swap(workflowOptions, options);
41}
42
43void customize(std::vector<o2::framework::CompletionPolicy>& policies)
44{
45 // ordered policies for the writers
46 policies.push_back(CompletionPolicyHelpers::consumeWhenAllOrdered(".*(?:CTF|ctf).*[W,w]riter.*"));
47}
48
49// ------------------------------------------------------------------
51
53{
54 DetID::mask_t dets = 0;
55 o2::conf::ConfigurableParam::updateFromString(configcontext.options().get<std::string>("configKeyValues"));
57 if (!configcontext.helpOnCommandLine()) {
58 dets.set(); // by default read all
59 auto mskOnly = DetID::getMask(configcontext.options().get<std::string>("onlyDet"));
60 auto mskSkip = DetID::getMask(configcontext.options().get<std::string>("skipDet"));
61 if (mskOnly.any()) {
62 dets &= mskOnly;
63 } else {
64 dets ^= mskSkip;
65 }
66 if (dets.none()) {
67 throw std::invalid_argument("Invalid workflow: no detectors found");
68 }
69 inp.detMask = dets;
70 inp.outType = configcontext.options().get<std::string>("output-type");
71 }
72 inp.verbosity = configcontext.options().get<int>("ctf-writer-verbosity");
73 inp.reportInterval = configcontext.options().get<int>("report-data-size-interval");
76
78 return std::move(specs);
79}
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:104
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(const o2::ctf::CTFWriterInp &inp)
create a processor spec
Defining ITS Vertex explicitly as messageable.
Definition Cartesian.h:288
std::vector< DataProcessorSpec > WorkflowSpec
o2::detectors::DetID::mask_t detMask
static CompletionPolicy consumeWhenAllOrdered(const char *name, CompletionPolicy::Matcher matcher)
as consumeWhenAll, but ensures that records are processed with incremental timeSlice (DataHeader::sta...
static bool isITSStaggeringEnabled(o2::framework::ConfigContext const &cfgc)
static bool isMFTStaggeringEnabled(o2::framework::ConfigContext const &cfgc)
static void addConfigOption(std::vector< o2::framework::ConfigParamSpec > &opts)