Project
Loading...
Searching...
No Matches
tpc-residual-aggregator.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
19
20using namespace o2::framework;
22
23void customize(std::vector<o2::framework::CallbacksPolicy>& policies)
24{
26}
27
28// we need to add workflow options before including Framework/runDataProcessing
29void customize(std::vector<o2::framework::ConfigParamSpec>& workflowOptions)
30{
31 std::vector<o2::framework::ConfigParamSpec> options{
32 {"output-type", VariantType::String, "unbinnedResid,trackParams", {"Comma separated list of outputs (without spaces). Valid strings: unbinnedResid, binnedResid, trackParams"}},
33 {"enable-track-input", VariantType::Bool, false, {"Whether to expect track data from interpolation workflow"}},
34 {"enable-ctp", VariantType::Bool, false, {"Subscribe to lumi info from CTP"}},
35 {"disable-root-input", VariantType::Bool, false, {"disable root-files input readers"}},
36 {"configKeyValues", VariantType::String, "", {"Semicolon separated key=value strings ..."}}};
38 std::swap(workflowOptions, options);
39}
40
41// ------------------------------------------------------------------
42
44
46{
47 o2::conf::ConfigurableParam::updateFromString(configcontext.options().get<std::string>("configKeyValues"));
48 auto trkInput = configcontext.options().get<bool>("enable-track-input");
49 auto ctpInput = configcontext.options().get<bool>("enable-ctp");
50
51 bool writeUnbinnedResiduals = false;
52 bool writeBinnedResiduals = false;
53 bool writeTrackData = false;
54 auto outputType = configcontext.options().get<std::string>("output-type");
55 std::vector<std::string> outputTypes;
56 size_t pos = 0;
57 while ((pos = outputType.find(",")) != std::string::npos) {
58 outputTypes.push_back(outputType.substr(0, pos));
59 outputType.erase(0, pos + 1);
60 }
61 outputTypes.push_back(outputType);
62 for (const auto& out : outputTypes) {
63 if (out == "unbinnedResid") {
64 writeUnbinnedResiduals = true;
65 } else if (out == "binnedResid") {
66 writeBinnedResiduals = true;
67 } else if (out == "trackParams") {
68 if (!trkInput) {
69 LOG(error) << "Track output will be empty, because it is not configured as input";
70 }
71 writeTrackData = true;
72 } else {
73 LOG(error) << "Invalid output requested: " << out;
74 }
75 }
76
77 WorkflowSpec specs;
78 if (!configcontext.options().get<bool>("disable-root-input")) {
79 specs.emplace_back(o2::tpc::getUnbinnedTPCResidualsReaderSpec(trkInput));
80 }
81 specs.emplace_back(getTPCResidualAggregatorSpec(trkInput, ctpInput, writeUnbinnedResiduals, writeBinnedResiduals, writeTrackData));
82
83 // CTP input
84 if (ctpInput) {
85 auto maskClusters = GID::getSourcesMask("CTP");
86 auto maskNone = GID::getSourcesMask(GID::NONE);
87 o2::globaltracking::InputHelper::addInputSpecs(configcontext, specs, maskClusters, maskNone, maskNone, false);
88 }
89
90 // configure dpl timer to inject correct firstTForbit: start from the 1st orbit of TF containing 1st sampled orbit
91 o2::raw::HBFUtilsInitializer hbfIni(configcontext, specs);
92
93 return specs;
94}
uint16_t pos
Definition RawData.h:3
Collects local TPC cluster residuals from EPNs.
DPL device for collecting and binning TPC cluster residuals.
static void updateFromString(std::string const &)
static mask_t getSourcesMask(const std::string_view srcList)
static constexpr std::string_view NONE
keywork for no sources
ConfigParamRegistry & options() const
static int addInputSpecs(const o2::framework::ConfigContext &configcontext, o2::framework::WorkflowSpec &specs, GID::mask_t maskClusters, GID::mask_t maskMatches, GID::mask_t maskTracks, bool useMC=true, GID::mask_t maskClustersMC=GID::getSourcesMask(GID::ALL), GID::mask_t maskTracksMC=GID::getSourcesMask(GID::ALL), bool subSpecStrict=false)
Defining PrimaryVertex explicitly as messageable.
Definition TFIDInfo.h:20
std::vector< DataProcessorSpec > WorkflowSpec
framework::DataProcessorSpec getUnbinnedTPCResidualsReaderSpec(bool trkInput)
read unbinned TPC residuals and reference tracks from a root file
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 &configcontext)
void customize(std::vector< o2::framework::CallbacksPolicy > &policies)