Project
Loading...
Searching...
No Matches
rawfile-reader-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
17#include "Framework/Logger.h"
18#include <string>
19#include <bitset>
20
21using namespace o2::framework;
22using namespace o2::raw;
23
24// we need to add workflow options before including Framework/runDataProcessing
25void customize(std::vector<o2::framework::ConfigParamSpec>& workflowOptions)
26{
27 // option allowing to set parameters
28 std::vector<o2::framework::ConfigParamSpec> options;
29 options.push_back(ConfigParamSpec{"input-conf", VariantType::String, "", {"configuration file with input (obligatory)"}});
30 options.push_back(ConfigParamSpec{"onlyDet", VariantType::String, "all", {"list of dectors"}});
31 options.push_back(ConfigParamSpec{"min-tf", VariantType::Int64, 0L, {"min TF ID to process"}});
32 options.push_back(ConfigParamSpec{"max-tf", VariantType::Int64, 0xffffffffL, {"max TF ID to process"}});
33 options.push_back(ConfigParamSpec{"loop", VariantType::Int, 1, {"loop N times (infinite for N<0)"}});
34 options.push_back(ConfigParamSpec{"delay", VariantType::Float, 0.f, {"delay in seconds between consecutive TFs sending"}});
35 options.push_back(ConfigParamSpec{"buffer-size", VariantType::Int64, 5 * 1024L, {"buffer size for files preprocessing"}});
36 options.push_back(ConfigParamSpec{"super-page-size", VariantType::Int64, 1024L * 1024L, {"super-page size for FMQ parts definition"}});
37 options.push_back(ConfigParamSpec{"part-per-sp", VariantType::Bool, false, {"FMQ parts per superpage instead of per HBF"}});
38 options.push_back(ConfigParamSpec{"raw-channel-config", VariantType::String, "", {"optional raw FMQ channel for non-DPL output"}});
39 options.push_back(ConfigParamSpec{"cache-data", VariantType::Bool, false, {"cache data at 1st reading, may require excessive memory!!!"}});
40 options.push_back(ConfigParamSpec{"detect-tf0", VariantType::Bool, false, {"autodetect HBFUtils start Orbit/BC from 1st TF seen"}});
41 options.push_back(ConfigParamSpec{"calculate-tf-start", VariantType::Bool, false, {"calculate TF start instead of using TType"}});
42 options.push_back(ConfigParamSpec{"drop-tf", VariantType::String, "none", {"Drop each TFid%(1)==(2) of detector, e.g. ITS,2,4;TPC,4[,0];..."}});
43 options.push_back(ConfigParamSpec{"configKeyValues", VariantType::String, "", {"semicolon separated key=value strings"}});
44 options.push_back(ConfigParamSpec{"send-diststf-0xccdb", VariantType::Bool, false, {"send explicit FLP/DISTSUBTIMEFRAME/0xccdb output"}});
45 options.push_back(ConfigParamSpec{"hbfutils-config", VariantType::String, std::string(o2::base::NameConf::DIGITIZATIONCONFIGFILE), {"configKeyValues ini file for HBFUtils (used if exists)"}});
46 options.push_back(ConfigParamSpec{"timeframes-shm-limit", VariantType::String, "0", {"Minimum amount of SHM required in order to publish data"}});
47 options.push_back(ConfigParamSpec{"metric-feedback-channel-format", VariantType::String, "name=metric-feedback,type=pull,method=connect,address=ipc://{}metric-feedback-{},transport=shmem,rateLogging=0", {"format for the metric-feedback channel for TF rate limiting"}});
48 // options for error-check suppression
49
50 for (int i = 0; i < RawFileReader::NErrorsDefined; i++) {
51 auto ei = RawFileReader::ErrTypes(i);
52 options.push_back(ConfigParamSpec{RawFileReader::nochk_opt(ei), VariantType::Bool, false, {RawFileReader::nochk_expl(ei)}});
53 }
54 std::swap(workflowOptions, options);
55}
56
57// ------------------------------------------------------------------
58
60
62{
63 ReaderInp rinp;
64 rinp.inifile = configcontext.options().get<std::string>("input-conf");
65 rinp.loop = configcontext.options().get<int>("loop");
66 rinp.onlyDet = configcontext.options().get<std::string>("onlyDet");
67 rinp.maxTF = uint32_t(configcontext.options().get<int64_t>("max-tf"));
68 rinp.minTF = uint32_t(configcontext.options().get<int64_t>("min-tf"));
69 rinp.bufferSize = uint64_t(configcontext.options().get<int64_t>("buffer-size"));
70 rinp.spSize = uint64_t(configcontext.options().get<int64_t>("super-page-size"));
71 rinp.partPerSP = configcontext.options().get<bool>("part-per-sp");
72 rinp.cache = configcontext.options().get<bool>("cache-data");
73 rinp.autodetectTF0 = configcontext.options().get<bool>("detect-tf0");
74 rinp.preferCalcTF = configcontext.options().get<bool>("calculate-tf-start");
75 rinp.rawChannelConfig = configcontext.options().get<std::string>("raw-channel-config");
76 rinp.delay_us = uint32_t(1e6 * configcontext.options().get<float>("delay")); // delay in microseconds
77 rinp.dropTF = configcontext.options().get<std::string>("drop-tf");
78 rinp.sup0xccdb = !configcontext.options().get<bool>("send-diststf-0xccdb");
79 rinp.errMap = 0;
80 for (int i = RawFileReader::NErrorsDefined; i--;) {
81 auto ei = RawFileReader::ErrTypes(i);
83 if (configcontext.options().get<bool>(RawFileReader::nochk_opt(ei).c_str()) ? !defOpt : defOpt) { // cmdl option inverts default!
84 rinp.errMap |= 0x1 << i;
85 }
86 }
87 rinp.minSHM = std::stoul(configcontext.options().get<std::string>("timeframes-shm-limit"));
88 int rateLimitingIPCID = std::stoi(configcontext.options().get<std::string>("timeframes-rate-limit-ipcid"));
89 std::string chanFmt = configcontext.options().get<std::string>("metric-feedback-channel-format");
90 if (rateLimitingIPCID > -1 && !chanFmt.empty()) {
91 rinp.metricChannel = fmt::format(fmt::runtime(chanFmt), o2::framework::ChannelSpecHelpers::defaultIPCFolder(), rateLimitingIPCID);
92 }
93 o2::conf::ConfigurableParam::updateFromString(configcontext.options().get<std::string>("configKeyValues"));
94 auto hbfini = configcontext.options().get<std::string>("hbfutils-config");
95 if (!hbfini.empty() && o2::conf::ConfigurableParam::configFileExists(hbfini)) {
96 o2::conf::ConfigurableParam::updateFromFile(hbfini, "HBFUtils", true); // update only those values which were not touched yet (provenance == kCODE)
97 }
98 return std::move(o2::raw::getRawFileReaderWorkflow(rinp));
99}
int32_t i
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error First event to Number of events to Number of iterations to Number of iterations to Number of initial iterations excluded from const char Directory with events to Events directory is and not inside events Show standalone event Run event generator maximum time bin of continuous for triggered for automatic continuous for automatic continuous triggered uint64_t
Definition of the Names Generator class.
Reader for (multiple) raw data files.
static constexpr std::string_view DIGITIZATIONCONFIGFILE
Definition NameConf.h:89
static bool configFileExists(std::string const &filepath)
static void updateFromFile(std::string const &, std::string const &paramsList="", bool unchangedOnly=false)
static void updateFromString(std::string const &)
ConfigParamRegistry & options() const
static std::string nochk_expl(ErrTypes e)
static constexpr bool ErrCheckDefaults[]
static std::string nochk_opt(ErrTypes e)
Defining ITS Vertex explicitly as messageable.
Definition Cartesian.h:288
std::vector< DataProcessorSpec > WorkflowSpec
framework::WorkflowSpec getRawFileReaderWorkflow(ReaderInp &rinp)
void customize(std::vector< o2::framework::ConfigParamSpec > &workflowOptions)
WorkflowSpec defineDataProcessing(ConfigContext const &configcontext)
std::string rawChannelConfig
std::string inifile
std::string onlyDet
std::string metricChannel