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