Project
Loading...
Searching...
No Matches
tof-calibinfo-reader.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
16
21#include <fairlogger/Logger.h>
26
27#include <string>
28#include <stdexcept>
29#include <unordered_map>
30
31void customize(std::vector<o2::framework::CallbacksPolicy>& policies)
32{
34}
35
36// add workflow options, note that customization needs to be declared before
37// including Framework/runDataProcessing
38void customize(std::vector<o2::framework::ConfigParamSpec>& workflowOptions)
39{
40 workflowOptions.push_back(ConfigParamSpec{"collection-infile", o2::framework::VariantType::String, "list-calibfile", {"Name of the collection input file"}});
41 workflowOptions.push_back(ConfigParamSpec{"ninstances", o2::framework::VariantType::Int, 1, {"Number of reader instances"}});
42 workflowOptions.push_back(ConfigParamSpec{"tpc-matches", o2::framework::VariantType::Bool, false, {"Made from TOF-TPC matches"}});
43 workflowOptions.push_back(ConfigParamSpec{"configKeyValues", o2::framework::VariantType::String, "", {"Semicolon separated key=value strings ..."}});
45}
46
47#include "Framework/runDataProcessing.h" // the main driver
48
49using namespace o2::framework;
50
66{
67 WorkflowSpec specs;
68
69 if (!cfgc.helpOnCommandLine()) {
70 o2::conf::ConfigurableParam::updateFromString(cfgc.options().get<std::string>("configKeyValues"));
71 }
72
73 int ninstances = cfgc.options().get<int>("ninstances");
74 auto listname = cfgc.options().get<std::string>("collection-infile");
75 auto toftpc = cfgc.options().get<bool>("tpc-matches");
76
77 char* stringTBP = new char[listname.size() + 1];
78 snprintf(stringTBP, listname.size() + 1, "%s", listname.c_str());
79
80 // the lane configuration defines the subspecification ids to be distributed among the lanes.
81 // auto tofSectors = o2::RangeTokenizer::tokenize<int>(cfgc.options().get<std::string>("tof-sectors"));
82 // std::vector<int> laneConfiguration = tofSectors;
83
84 for (int i = 0; i < ninstances; i++) {
85 specs.emplace_back(o2::tof::getCalibInfoReaderSpec(i, ninstances, stringTBP, toftpc));
86 }
87
88 LOG(info) << "Number of active devices = " << specs.size();
89 if (ninstances == 1) {
90 o2::raw::HBFUtilsInitializer hbfIni(cfgc, specs);
91 } else {
92 LOG(warning) << "Cannot use HBFUtilsInitializer with multiple instances";
93 }
94 return std::move(specs);
95}
int32_t i
Definition of the Names Generator class.
static void updateFromString(std::string const &)
ConfigParamRegistry & options() const
Defining PrimaryVertex explicitly as messageable.
Definition TFIDInfo.h:20
std::vector< DataProcessorSpec > WorkflowSpec
framework::DataProcessorSpec getCalibInfoReaderSpec(int instance, int ninstances, const char *filename, bool toftpc=false)
static constexpr char HBFUSrc[]
static void addNewTimeSliceCallback(std::vector< o2::framework::CallbacksPolicy > &policies)
static void addConfigOption(std::vector< o2::framework::ConfigParamSpec > &opts, const std::string &defOpt=std::string(o2::base::NameConf::DIGITIZATIONCONFIGFILE))
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"
WorkflowSpec defineDataProcessing(ConfigContext const &cfgc)
void customize(std::vector< o2::framework::CallbacksPolicy > &policies)