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 {"enable-mc", VariantType::Bool, false, {"Whether to expect the MC truth of the track data from interpolation workflow (requires enable-track-input)"}},
36 {"disable-root-input", VariantType::Bool, false, {"disable root-files input readers"}},
37 {"configKeyValues", VariantType::String, "", {"Semicolon separated key=value strings ..."}}};
39 std::swap(workflowOptions, options);
40}
41
42// ------------------------------------------------------------------
43
45
47{
48 o2::conf::ConfigurableParam::updateFromString(configcontext.options().get<std::string>("configKeyValues"));
49 auto trkInput = configcontext.options().get<bool>("enable-track-input");
50 auto ctpInput = configcontext.options().get<bool>("enable-ctp");
51 auto mcInput = configcontext.options().get<bool>("enable-mc");
52 if (mcInput && !trkInput) {
53 LOG(error) << "MC truth input requires the track input (enable-track-input), will be ignored";
54 mcInput = false;
55 }
56
57 bool writeUnbinnedResiduals = false;
58 bool writeBinnedResiduals = false;
59 bool writeTrackData = false;
60 auto outputType = configcontext.options().get<std::string>("output-type");
61 std::vector<std::string> outputTypes;
62 size_t pos = 0;
63 while ((pos = outputType.find(",")) != std::string::npos) {
64 outputTypes.push_back(outputType.substr(0, pos));
65 outputType.erase(0, pos + 1);
66 }
67 outputTypes.push_back(outputType);
68 for (const auto& out : outputTypes) {
69 if (out == "unbinnedResid") {
70 writeUnbinnedResiduals = true;
71 } else if (out == "binnedResid") {
72 writeBinnedResiduals = true;
73 } else if (out == "trackParams") {
74 if (!trkInput) {
75 LOG(error) << "Track output will be empty, because it is not configured as input";
76 }
77 writeTrackData = true;
78 } else {
79 LOG(error) << "Invalid output requested: " << out;
80 }
81 }
82
83 WorkflowSpec specs;
84 if (!configcontext.options().get<bool>("disable-root-input")) {
85 specs.emplace_back(o2::tpc::getUnbinnedTPCResidualsReaderSpec(trkInput, mcInput));
86 }
87 specs.emplace_back(getTPCResidualAggregatorSpec(trkInput, ctpInput, writeUnbinnedResiduals, writeBinnedResiduals, writeTrackData, mcInput));
88
89 // CTP input
90 if (ctpInput) {
91 auto maskClusters = GID::getSourcesMask("CTP");
92 auto maskNone = GID::getSourcesMask(GID::NONE);
93 o2::globaltracking::InputHelper::addInputSpecs(configcontext, specs, maskClusters, maskNone, maskNone, false);
94 }
95
96 // configure dpl timer to inject correct firstTForbit: start from the 1st orbit of TF containing 1st sampled orbit
97 o2::raw::HBFUtilsInitializer hbfIni(configcontext, specs);
98
99 return specs;
100}
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 ITS Vertex explicitly as messageable.
Definition Cartesian.h:288
std::vector< DataProcessorSpec > WorkflowSpec
framework::DataProcessorSpec getUnbinnedTPCResidualsReaderSpec(bool trkInput, bool mcInput)
read unbinned TPC residuals and reference tracks (with mcInput also their MC truth) 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)