Project
Loading...
Searching...
No Matches
hmp-matcher-workflow.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
18
21
23
31// #include "TOFBase/Utils.h"
33#include "TSystem.h"
35
37
38using namespace o2::framework;
41// ------------------------------------------------------------------
42void customize(std::vector<o2::framework::CallbacksPolicy>& policies)
43{
45}
46
47void customize(std::vector<o2::framework::CompletionPolicy>& policies)
48{
49 // ordered policies for the writers
50 policies.push_back(CompletionPolicyHelpers::consumeWhenAllOrdered(".*(?:HMP|hmp).*[W,w]riter.*"));
51}
52
53// we need to add workflow options before including Framework/runDataProcessing
54void customize(std::vector<o2::framework::ConfigParamSpec>& workflowOptions)
55{
56 // option allowing to set parameters
57 std::vector<o2::framework::ConfigParamSpec> options{
58 {"disable-mc", o2::framework::VariantType::Bool, false, {"disable MC propagation even if available"}},
59 {"disable-root-input", o2::framework::VariantType::Bool, false, {"disable root-files input reader"}},
60 {"disable-root-output", o2::framework::VariantType::Bool, false, {"disable root-files output writer"}},
61 {"track-sources", VariantType::String, std::string{GID::ALL}, {"comma-separated list of sources to use: allowed ITS-TPC,TPC-TRD,TPC-TOF,TPC-TRD-TOF,ITS-TPC-TRD,ITS-TPC-TRD-TOF (all)"}},
62 {"trd-extra-tolerance", o2::framework::VariantType::Float, 0.0f, {"Extra time tolerance for TRD tracks in microsec"}},
63 {"tof-extra-tolerance", o2::framework::VariantType::Float, 0.0f, {"Extra time tolerance for TRD tracks in microsec"}},
64 {"combine-devices", o2::framework::VariantType::Bool, false, {"merge DPL source/writer devices"}},
65 {"configKeyValues", VariantType::String, "", {"Semicolon separated key=value strings ..."}}};
67 std::swap(workflowOptions, options);
68}
69// ------------------------------------------------------------------
70
72
74{
75 WorkflowSpec specs;
76
77 // Update the (declared) parameters if changed from the command line
78 o2::conf::ConfigurableParam::updateFromString(configcontext.options().get<std::string>("configKeyValues"));
79 // write the configuration used for the workflow
80
81 auto useMC = !configcontext.options().get<bool>("disable-mc");
82 auto extratolerancetrd = configcontext.options().get<float>("trd-extra-tolerance");
83 auto extratolerancetof = configcontext.options().get<float>("tof-extra-tolerance");
84 auto disableRootIn = configcontext.options().get<bool>("disable-root-input");
85 auto disableRootOut = configcontext.options().get<bool>("disable-root-output");
86
87 bool writematching = 0;
88 bool writecalib = 0;
89
90 LOG(debug) << "HMP MATCHER WORKFLOW configuration";
91 LOG(debug) << "HMP disable-mc = " << configcontext.options().get<std::string>("disable-mc");
92 LOG(debug) << "HMP disable-root-input = " << disableRootIn;
93 LOG(debug) << "HMP disable-root-output = " << disableRootOut;
94
95 GID::mask_t alowedSources = GID::getSourcesMask("ITS-TPC,TPC-TRD,TPC-TOF,ITS-TPC-TRD,ITS-TPC-TOF,TPC-TRD-TOF,ITS-TPC-TRD-TOF");
96
97 GID::mask_t src = alowedSources & GID::getSourcesMask(configcontext.options().get<std::string>("track-sources"));
98
99 GID::mask_t mcmaskcl;
101 GID::mask_t clustermask = GID::getSourcesMask("HMP");
102
103 if (useMC) {
104 mcmaskcl |= GID::getSourceMask(GID::HMP);
105 }
106
107 WorkflowSpec inputspecs;
108 o2::globaltracking::InputHelper::addInputSpecs(configcontext, inputspecs, clustermask, src, src, useMC, mcmaskcl, GID::getSourcesMask(GID::ALL));
109 if (configcontext.options().get<bool>("combine-devices")) {
110 std::vector<DataProcessorSpec> unmerged;
111 specs.push_back(specCombiner("HMP-readers", inputspecs, unmerged));
112 if (unmerged.size() > 0) {
113 LOG(fatal) << "Unexpected DPL device merge problem";
114 }
115 } else {
116 for (auto& s : inputspecs) {
117 specs.push_back(s);
118 }
119 }
120
121 specs.emplace_back(o2::globaltracking::getHMPMatcherSpec(src, useMC, extratolerancetrd, extratolerancetof));
122
123 if (!disableRootOut) {
124 std::vector<DataProcessorSpec> writers;
125 writers.emplace_back(o2::hmpid::getHMPMatchedWriterSpec(useMC, "o2match_hmp.root")); //, false, (int)o2::globaltracking::MatchHMP::trackType::CONSTR, false));
126
127 if (configcontext.options().get<bool>("combine-devices")) {
128 std::vector<DataProcessorSpec> unmerged;
129 specs.push_back(specCombiner("HMP-writers", writers, unmerged));
130 if (unmerged.size() > 0) {
131 LOG(fatal) << "Unexpected DPL device merge problem";
132 }
133 } else {
134 for (auto& s : writers) {
135 specs.push_back(s);
136 }
137 }
138 }
139
140 // configure dpl timer to inject correct firstTFOrbit: start from the 1st orbit of TF containing 1st sampled orbit
141 o2::raw::HBFUtilsInitializer hbfIni(configcontext, specs);
142
143 return std::move(specs);
144}
Global index for barrel track: provides provenance (detectors combination), index in respective array...
// ef ; change to hmp
Helper function to tokenize sequences and ranges of integral numbers.
DPL completion policy helper for TPC scetor data.
std::ostringstream debug
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
static constexpr std::string_view ALL
keywork for all sources
Static class with identifiers, bitmasks and names for ALICE detectors.
Definition DetID.h:58
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)
GLenum src
Definition glcorearb.h:1767
WorkflowSpec defineDataProcessing(ConfigContext const &configcontext)
void customize(std::vector< o2::framework::CallbacksPolicy > &policies)
Defining PrimaryVertex explicitly as messageable.
Definition TFIDInfo.h:20
o2::framework::DataProcessorSpec specCombiner(std::string const &name, std::vector< DataProcessorSpec > const &speccollection, std::vector< DataProcessorSpec > &remaining)
std::vector< DataProcessorSpec > WorkflowSpec
framework::DataProcessorSpec getHMPMatcherSpec(o2::dataformats::GlobalTrackID::mask_t src, bool useMC, float extratolerancetrd, float extratolerancetof)
create a processor spec
o2::framework::DataProcessorSpec getHMPMatchedWriterSpec(bool useMC, const char *outdef="o2match_hmpid.root")
static CompletionPolicy consumeWhenAllOrdered(const char *name, CompletionPolicy::Matcher matcher)
as consumeWhenAll, but ensures that records are processed with incremental timeSlice (DataHeader::sta...
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"