Project
Loading...
Searching...
No Matches
tpc-interpolation-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
22
23using namespace o2::framework;
25
26// ------------------------------------------------------------------
27void customize(std::vector<o2::framework::CallbacksPolicy>& policies)
28{
30}
31
32// we need to add workflow options before including Framework/runDataProcessing
33void customize(std::vector<o2::framework::ConfigParamSpec>& workflowOptions)
34{
35 // option allowing to set parameters
36 std::vector<o2::framework::ConfigParamSpec> options{
37 {"disable-root-input", VariantType::Bool, false, {"disable root-files input readers"}},
38 {"disable-root-output", VariantType::Bool, false, {"disable root-files output writers"}},
39 {"disable-mc", VariantType::Bool, false, {"disable MC propagation even if available"}},
40 {"vtx-sources", VariantType::String, std::string{GID::ALL}, {"comma-separated list of sources used for the vertex finding"}},
41 {"tracking-sources", VariantType::String, std::string{GID::ALL}, {"comma-separated list of sources to use for track inter-/extrapolation"}},
42 {"tracking-sources-map-extraction", VariantType::String, std::string{GID::ALL}, {"can be subset of \"tracking-sources\""}},
43 {"send-track-data", VariantType::Bool, false, {"Send also the track information to the aggregator"}},
44 {"debug-output", VariantType::Bool, false, {"Dump extended tracking information for debugging"}},
45 {"configKeyValues", VariantType::String, "", {"Semicolon separated key=value strings ..."}}};
47 std::swap(workflowOptions, options);
48}
49
50// the matcher process requires the TPC sector completion to trigger and data on
51// all defined routes
52void customize(std::vector<o2::framework::CompletionPolicy>& policies)
53{
54 // the TPC sector completion policy checks when the set of TPC/CLUSTERNATIVE data is complete
55 // in addition we require to have input from all other routes
56 policies.push_back(o2::tpc::TPCSectorCompletionPolicy("tpc-track-interpolation",
58 InputSpec{"cluster", o2::framework::ConcreteDataTypeMatcher{"TPC", "CLUSTERNATIVE"}})());
59 // ordered policies for the writers
60 policies.push_back(CompletionPolicyHelpers::consumeWhenAllOrdered(".*tpc-residuals-writer.*"));
61}
62
63// ------------------------------------------------------------------
64
66
68{
69 WorkflowSpec specs;
70 GID::mask_t allowedSources = GID::getSourcesMask("ITS-TPC,ITS-TPC-TRD,ITS-TPC-TOF,ITS-TPC-TRD-TOF");
71 GID::mask_t srcVtx = allowedSources & GID::getSourcesMask(configcontext.options().get<std::string>("vtx-sources"));
72 GID::mask_t srcTracks = allowedSources & GID::getSourcesMask(configcontext.options().get<std::string>("tracking-sources"));
73 GID::mask_t srcTracksMap = allowedSources & GID::getSourcesMask(configcontext.options().get<std::string>("tracking-sources-map-extraction"));
74 if (srcTracks.count() > srcVtx.count()) {
75 LOGP(error, "More sources configured for inter-/extrapolation: {} than for vertexing: {}. Additional sources will be ignored", GID::getSourcesNames(srcTracks), GID::getSourcesNames(srcVtx));
76 srcTracks &= srcVtx;
77 }
78 srcTracksMap &= srcVtx;
79 if (((srcTracksMap | srcTracks) ^ srcTracks).any()) {
80 LOGP(fatal, "tracking-sources-map-extraction ({}) must be a subset of tracking-sources ({}).", GID::getSourcesNames(srcTracksMap), GID::getSourcesNames(srcTracks));
81 } else if (srcTracksMap != srcTracks) {
82 LOGP(info, "Will extract residual from different track types. For vDrift from {} and for distortion map from {}", GID::getSourcesNames(srcTracks), GID::getSourcesNames(srcTracksMap));
83 } else {
84 LOGP(info, "Only a single track source is defined for residuals extraction: {}", GID::getSourcesNames(srcTracks));
85 }
86 LOG(debug) << "Data sources for inter-/extrapolation: " << GID::getSourcesNames(srcTracks);
87 // check first if ITS-TPC tracks were specifically requested from command line
88 bool processITSTPConly = srcTracks[GID::ITSTPC];
89 srcTracks |= GID::getSourcesMask("ITS,TPC,ITS-TPC"); // now add them in any case
90 srcTracksMap |= GID::getSourcesMask("ITS,TPC,ITS-TPC");
91 srcVtx |= srcTracks;
92 GID::mask_t srcClusters = srcTracks;
93 if (srcTracks[GID::ITSTPCTRD] || srcTracks[GID::ITSTPCTRDTOF]) {
94 srcClusters |= GID::getSourcesMask("TRD");
95 }
96 if (srcTracks[GID::ITSTPCTOF] || srcTracks[GID::ITSTPCTRDTOF]) {
97 srcClusters |= GID::getSourcesMask("TOF");
98 }
99 // Update the (declared) parameters if changed from the command line
100 o2::conf::ConfigurableParam::updateFromString(configcontext.options().get<std::string>("configKeyValues"));
101 // write the configuration used for the workflow
102 o2::conf::ConfigurableParam::writeINI("o2tpcinterpolation-workflow_configuration.ini");
103 auto useMC = !configcontext.options().get<bool>("disable-mc");
104 useMC = false; // force disabling MC as long as it is not implemented
105 auto sendTrackData = configcontext.options().get<bool>("send-track-data");
106 auto debugOutput = configcontext.options().get<bool>("debug-output");
107
108 specs.emplace_back(o2::tpc::getTPCInterpolationSpec(srcClusters, srcVtx, srcTracks, srcTracksMap, useMC, processITSTPConly, sendTrackData, debugOutput));
109 if (!configcontext.options().get<bool>("disable-root-output")) {
110 specs.emplace_back(o2::tpc::getTPCResidualWriterSpec(sendTrackData, debugOutput));
111 }
112
113 o2::globaltracking::InputHelper::addInputSpecs(configcontext, specs, srcClusters, srcVtx, srcVtx, useMC);
114 o2::globaltracking::InputHelper::addInputSpecsPVertex(configcontext, specs, useMC); // P-vertex is always needed
115
116 // configure dpl timer to inject correct firstTForbit: start from the 1st orbit of TF containing 1st sampled orbit
117 o2::raw::HBFUtilsInitializer hbfIni(configcontext, specs);
118
119 return specs;
120}
Global index for barrel track: provides provenance (detectors combination), index in respective array...
DPL completion policy helper for TPC scetor data.
std::ostringstream debug
static void writeINI(std::string const &filename, std::string const &keyOnly="")
static void updateFromString(std::string const &)
static mask_t getSourcesMask(const std::string_view srcList)
static std::string getSourcesNames(mask_t srcm)
static constexpr std::string_view ALL
keywork for all 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)
static int addInputSpecsPVertex(const o2::framework::ConfigContext &configcontext, o2::framework::WorkflowSpec &specs, bool mc)
Defining PrimaryVertex explicitly as messageable.
Definition TFIDInfo.h:20
std::vector< DataProcessorSpec > WorkflowSpec
framework::DataProcessorSpec getTPCInterpolationSpec(o2::dataformats::GlobalTrackID::mask_t srcCls, o2::dataformats::GlobalTrackID::mask_t srcVtx, o2::dataformats::GlobalTrackID::mask_t srcTrk, o2::dataformats::GlobalTrackID::mask_t srcTrkMap, bool useMC, bool processITSTPConly, bool sendTrackData, bool debugOutput)
create a processor spec
framework::DataProcessorSpec getTPCResidualWriterSpec(bool writeTrackData, bool debugOutput)
create a processor spec
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"
WorkflowSpec defineDataProcessing(ConfigContext const &configcontext)
void customize(std::vector< o2::framework::CallbacksPolicy > &policies)