Project
Loading...
Searching...
No Matches
tpc-cmv-to-vector.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 <vector>
13#include <string>
14#include <fmt/format.h>
15
22#include "TPCBase/CRU.h"
24
25using namespace o2::framework;
26using namespace o2::tpc;
27
28// customize the completion policy
29void customize(std::vector<o2::framework::CompletionPolicy>& policies)
30{
32 policies.push_back(CompletionPolicyHelpers::defineByName("tpc-cmv-to-vector", CompletionPolicy::CompletionOp::Consume));
33}
34
35// we need to add workflow options before including Framework/runDataProcessing
36void customize(std::vector<ConfigParamSpec>& workflowOptions)
37{
38 std::string crusDefault = "0-" + std::to_string(CRU::MaxCRU - 1);
39
40 std::vector<ConfigParamSpec> options{
41 {"input-spec", VariantType::String, "A:TPC/RAWDATA", {"selection string input specs"}},
42 {"configKeyValues", VariantType::String, "", {"Semicolon separated key=value strings (e.g.: 'TPCCalibPedestal.FirstTimeBin=10;...')"}},
43 {"configFile", VariantType::String, "", {"configuration file for configurable parameters"}},
44 {"crus", VariantType::String, crusDefault.c_str(), {"List of TPC crus, comma separated ranges, e.g. 0-3,7,9-15"}},
45 };
46
47 std::swap(workflowOptions, options);
48}
49
51
53{
54
55 using namespace o2::tpc;
56
57 // set up configuration
58 o2::conf::ConfigurableParam::updateFromFile(config.options().get<std::string>("configFile"));
59 o2::conf::ConfigurableParam::updateFromString(config.options().get<std::string>("configKeyValues"));
60 o2::conf::ConfigurableParam::writeINI("o2tpccmv_configuration.ini");
61
62 const std::string inputSpec = config.options().get<std::string>("input-spec");
63
64 const auto crus = o2::RangeTokenizer::tokenize<uint32_t>(config.options().get<std::string>("crus"));
65
66 WorkflowSpec workflow;
67
68 workflow.emplace_back(getCMVToVectorSpec(inputSpec, crus));
69
70 return workflow;
71}
Processor to convert CMVs to a vector in a CRU.
Helper function to tokenize sequences and ranges of integral numbers.
static void writeINI(std::string const &filename, std::string const &keyOnly="")
static void updateFromFile(std::string const &, std::string const &paramsList="", bool unchangedOnly=false)
static void updateFromString(std::string const &)
ConfigParamRegistry & options() const
@ MaxCRU
Definition CRU.h:31
Defining ITS Vertex explicitly as messageable.
Definition Cartesian.h:288
std::vector< DataProcessorSpec > WorkflowSpec
Global TPC definitions and constants.
Definition SimTraits.h:168
o2::framework::DataProcessorSpec getCMVToVectorSpec(const std::string inputSpec, std::vector< uint32_t > const &crus)
std::string to_string(gsl::span< T, Size > span)
Definition common.h:52
static CompletionPolicy defineByName(std::string const &name, CompletionPolicy::CompletionOp op)
WorkflowSpec defineDataProcessing(ConfigContext const &config)
This function hooks up the the workflow specifications into the DPL driver.
void customize(std::vector< o2::framework::CompletionPolicy > &policies)