Project
Loading...
Searching...
No Matches
tpc-factorize-sac.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>
19
20using namespace o2::framework;
21
22// we need to add workflow options before including Framework/runDataProcessing
23void customize(std::vector<ConfigParamSpec>& workflowOptions)
24{
25 const std::string cruDefault = "0-" + std::to_string(o2::tpc::CRU::MaxCRU - 1);
26
27 std::vector<ConfigParamSpec> options{
28 {"configFile", VariantType::String, "", {"configuration file for configurable parameters"}},
29 {"timeframes", VariantType::Int, 2000, {"Number of TFs which will be aggregated per aggregation interval."}},
30 {"nthreads-SAC-factorization", VariantType::Int, 1, {"Number of threads which will be used during the factorization of the SACs."}},
31 {"debug", VariantType::Bool, false, {"create debug files"}},
32 {"compression", VariantType::Int, 1, {"compression of DeltaSAC: 0 -> No, 1 -> Medium (data compression ratio 2), 2 -> High (data compression ratio ~6)"}},
33 {"input-lanes", VariantType::Int, 2, {"Number of parallel pipelines which were set in the TPCDistributeSACSpec device."}},
34 {"configKeyValues", VariantType::String, "", {"Semicolon separated key=value strings"}}};
35
36 std::swap(workflowOptions, options);
37}
38
40
42{
43 using namespace o2::tpc;
44
45 // set up configuration
46 o2::conf::ConfigurableParam::updateFromFile(config.options().get<std::string>("configFile"));
47 o2::conf::ConfigurableParam::updateFromString(config.options().get<std::string>("configKeyValues"));
48 o2::conf::ConfigurableParam::writeINI("o2tpcfactorizesac_configuration.ini");
49
50 const auto timeframes = static_cast<unsigned int>(config.options().get<int>("timeframes"));
51 const auto debug = config.options().get<bool>("debug");
52 const auto nthreadsFactorization = static_cast<unsigned long>(config.options().get<int>("nthreads-SAC-factorization"));
53 SACFactorization::setNThreads(nthreadsFactorization);
54 const auto nLanes = static_cast<unsigned int>(config.options().get<int>("input-lanes"));
55
56 const int compressionTmp = config.options().get<int>("compression");
58 switch (compressionTmp) {
59 case static_cast<int>(SACFactorization::SACDeltaCompression::NO):
60 case static_cast<int>(SACFactorization::SACDeltaCompression::MEDIUM):
61 case static_cast<int>(SACFactorization::SACDeltaCompression::HIGH):
62 compression = static_cast<SACFactorization::SACDeltaCompression>(compressionTmp);
63 break;
64 default:
65 LOGP(error, "wrong compression type set. Setting compression to medium compression");
66 compression = static_cast<SACFactorization::SACDeltaCompression>(SACFactorization::SACDeltaCompression::MEDIUM);
67 break;
68 }
69
70 WorkflowSpec workflow;
71 workflow.reserve(nLanes);
72 for (int ilane = 0; ilane < nLanes; ++ilane) {
73 workflow.emplace_back(getTPCFactorizeSACSpec(ilane, timeframes, compression, debug));
74 }
75 return workflow;
76}
TPC factorization of SACs.
TPC factorization of SACs.
std::ostringstream debug
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
static void setNThreads(const int nThreads)
Defining PrimaryVertex explicitly as messageable.
Definition TFIDInfo.h:20
std::vector< DataProcessorSpec > WorkflowSpec
Global TPC definitions and constants.
Definition SimTraits.h:167
DataProcessorSpec getTPCFactorizeSACSpec(const int lane, const unsigned int timeframes, const SACFactorization::SACFactorization::SACDeltaCompression compression, const bool debug)
IDCDeltaCompression
IDC Delta IDC Compression types.
std::string to_string(gsl::span< T, Size > span)
Definition common.h:52
WorkflowSpec defineDataProcessing(ConfigContext const &config)
This function hooks up the the workflow specifications into the DPL driver.
void customize(std::vector< ConfigParamSpec > &workflowOptions)