Project
Loading...
Searching...
No Matches
tpc-idc-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
18//#include "Framework/DataProcessorSpec.h"
19//#include "Framework/DataSpecUtils.h"
21//#include "Framework/InputRecordWalker.h"
22//#include "Framework/Logger.h"
27#include "TPCBase/CRU.h"
29
30using namespace o2::framework;
31using namespace o2::tpc;
32
33// customize the completion policy
34void customize(std::vector<o2::framework::CompletionPolicy>& policies)
35{
37 policies.push_back(CompletionPolicyHelpers::defineByName("tpc-idc-to-vector", CompletionPolicy::CompletionOp::Consume));
38}
39
40// we need to add workflow options before including Framework/runDataProcessing
41void customize(std::vector<ConfigParamSpec>& workflowOptions)
42{
43 std::string crusDefault = "0-" + std::to_string(CRU::MaxCRU - 1);
44
45 std::vector<ConfigParamSpec> options{
46 {"input-spec", VariantType::String, "A:TPC/RAWDATA", {"selection string input specs"}},
47 {"configKeyValues", VariantType::String, "", {"Semicolon separated key=value strings (e.g.: 'TPCCalibPedestal.FirstTimeBin=10;...')"}},
48 {"configFile", VariantType::String, "", {"configuration file for configurable parameters"}},
49 {"crus", VariantType::String, crusDefault.c_str(), {"List of TPC crus, comma separated ranges, e.g. 0-3,7,9-15"}},
50 };
51
52 std::swap(workflowOptions, options);
53}
54
56
58{
59
60 using namespace o2::tpc;
61
62 // set up configuration
63 o2::conf::ConfigurableParam::updateFromFile(config.options().get<std::string>("configFile"));
64 o2::conf::ConfigurableParam::updateFromString(config.options().get<std::string>("configKeyValues"));
65 o2::conf::ConfigurableParam::writeINI("o2tpcidc_configuration.ini");
66
67 const std::string inputSpec = config.options().get<std::string>("input-spec");
68
69 const auto crus = o2::RangeTokenizer::tokenize<uint32_t>(config.options().get<std::string>("crus"));
70
71 WorkflowSpec workflow;
72
73 workflow.emplace_back(getIDCToVectorSpec(inputSpec, crus));
74
75 return workflow;
76}
Processor to convert IDCs to a vector for each pad 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 PrimaryVertex explicitly as messageable.
Definition TFIDInfo.h:20
std::vector< DataProcessorSpec > WorkflowSpec
Global TPC definitions and constants.
Definition SimTraits.h:167
o2::framework::DataProcessorSpec getIDCToVectorSpec(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)