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
17
18using namespace o2::framework;
20
21// we need to add workflow options before including Framework/runDataProcessing
22void customize(std::vector<o2::framework::ConfigParamSpec>& workflowOptions)
23{
24 std::vector<o2::framework::ConfigParamSpec> options{
25 {"output-type", VariantType::String, "unbinnedResid,trackParams", {"Comma separated list of outputs (without spaces). Valid strings: unbinnedResid, binnedResid, trackParams"}},
26 {"enable-track-input", VariantType::Bool, false, {"Whether to expect track data from interpolation workflow"}},
27 {"enable-ctp", VariantType::Bool, false, {"Subscribe to lumi info from CTP"}},
28 {"disable-root-input", VariantType::Bool, false, {"disable root-files input readers"}},
29 {"configKeyValues", VariantType::String, "", {"Semicolon separated key=value strings ..."}}};
30 std::swap(workflowOptions, options);
31}
32
33// ------------------------------------------------------------------
34
36
38{
39 o2::conf::ConfigurableParam::updateFromString(configcontext.options().get<std::string>("configKeyValues"));
40 auto trkInput = configcontext.options().get<bool>("enable-track-input");
41 auto ctpInput = configcontext.options().get<bool>("enable-ctp");
42
43 bool writeUnbinnedResiduals = false;
44 bool writeBinnedResiduals = false;
45 bool writeTrackData = false;
46 auto outputType = configcontext.options().get<string>("output-type");
47 std::vector<std::string> outputTypes;
48 size_t pos = 0;
49 while ((pos = outputType.find(",")) != std::string::npos) {
50 outputTypes.push_back(outputType.substr(0, pos));
51 outputType.erase(0, pos + 1);
52 }
53 outputTypes.push_back(outputType);
54 for (const auto& out : outputTypes) {
55 if (out == "unbinnedResid") {
56 writeUnbinnedResiduals = true;
57 } else if (out == "binnedResid") {
58 writeBinnedResiduals = true;
59 } else if (out == "trackParams") {
60 if (!trkInput) {
61 LOG(error) << "Track output will be empty, because it is not configured as input";
62 }
63 writeTrackData = true;
64 } else {
65 LOG(error) << "Invalid output requested: " << out;
66 }
67 }
68
69 WorkflowSpec specs;
70 if (!configcontext.options().get<bool>("disable-root-input")) {
71 specs.emplace_back(o2::tpc::getUnbinnedTPCResidualsReaderSpec(trkInput));
72 }
73 specs.emplace_back(getTPCResidualAggregatorSpec(trkInput, ctpInput, writeUnbinnedResiduals, writeBinnedResiduals, writeTrackData));
74
75 // CTP input
76 if (ctpInput) {
77 auto maskClusters = GID::getSourcesMask("CTP");
78 auto maskNone = GID::getSourcesMask(GID::NONE);
79 o2::globaltracking::InputHelper::addInputSpecs(configcontext, specs, maskClusters, maskNone, maskNone, false);
80 }
81
82 return specs;
83}
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
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"
void customize(std::vector< o2::framework::ConfigParamSpec > &workflowOptions)
WorkflowSpec defineDataProcessing(ConfigContext const &configcontext)