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 {"skip-ext-det-residuals", VariantType::Bool, false, {"Do not produce residuals for external detectors"}},
46 {"configKeyValues", VariantType::String, "", {"Semicolon separated key=value strings ..."}}};
48 std::swap(workflowOptions, options);
49}
50
51// the matcher process requires the TPC sector completion to trigger and data on
52// all defined routes
53void customize(std::vector<o2::framework::CompletionPolicy>& policies)
54{
55 // the TPC sector completion policy checks when the set of TPC/CLUSTERNATIVE data is complete
56 // in addition we require to have input from all other routes
57 policies.push_back(o2::tpc::TPCSectorCompletionPolicy("tpc-track-interpolation",
59 InputSpec{"cluster", o2::framework::ConcreteDataTypeMatcher{"TPC", "CLUSTERNATIVE"}})());
60 // ordered policies for the writers
61 policies.push_back(CompletionPolicyHelpers::consumeWhenAllOrdered(".*tpc-residuals-writer.*"));
62}
63
64// ------------------------------------------------------------------
65
67
69{
70 WorkflowSpec specs;
71 GID::mask_t allowedSources = GID::getSourcesMask("ITS-TPC,ITS-TPC-TRD,ITS-TPC-TOF,ITS-TPC-TRD-TOF");
72 GID::mask_t srcVtx = allowedSources & GID::getSourcesMask(configcontext.options().get<std::string>("vtx-sources"));
73 GID::mask_t srcTracks = allowedSources & GID::getSourcesMask(configcontext.options().get<std::string>("tracking-sources"));
74 GID::mask_t srcTracksMap = allowedSources & GID::getSourcesMask(configcontext.options().get<std::string>("tracking-sources-map-extraction"));
75 if (srcTracks.count() > srcVtx.count()) {
76 LOGP(error, "More sources configured for inter-/extrapolation: {} than for vertexing: {}. Additional sources will be ignored", GID::getSourcesNames(srcTracks), GID::getSourcesNames(srcVtx));
77 srcTracks &= srcVtx;
78 }
79 srcTracksMap &= srcVtx;
80 if (((srcTracksMap | srcTracks) ^ srcTracks).any()) {
81 LOGP(fatal, "tracking-sources-map-extraction ({}) must be a subset of tracking-sources ({}).", GID::getSourcesNames(srcTracksMap), GID::getSourcesNames(srcTracks));
82 } else if (srcTracksMap != srcTracks) {
83 LOGP(info, "Will extract residual from different track types. For vDrift from {} and for distortion map from {}", GID::getSourcesNames(srcTracks), GID::getSourcesNames(srcTracksMap));
84 } else {
85 LOGP(info, "Only a single track source is defined for residuals extraction: {}", GID::getSourcesNames(srcTracks));
86 }
87 LOG(debug) << "Data sources for inter-/extrapolation: " << GID::getSourcesNames(srcTracks);
88 // check first if ITS-TPC tracks were specifically requested from command line
89 bool processITSTPConly = srcTracks[GID::ITSTPC];
90 srcTracks |= GID::getSourcesMask("ITS,TPC,ITS-TPC"); // now add them in any case
91 srcTracksMap |= GID::getSourcesMask("ITS,TPC,ITS-TPC");
92 srcVtx |= srcTracks;
93 GID::mask_t srcClusters = srcTracks;
94 if (srcTracks[GID::ITSTPCTRD] || srcTracks[GID::ITSTPCTRDTOF]) {
95 srcClusters |= GID::getSourcesMask("TRD");
96 }
97 if (srcTracks[GID::ITSTPCTOF] || srcTracks[GID::ITSTPCTRDTOF]) {
98 srcClusters |= GID::getSourcesMask("TOF");
99 }
100 // Update the (declared) parameters if changed from the command line
101 o2::conf::ConfigurableParam::updateFromString(configcontext.options().get<std::string>("configKeyValues"));
102 // write the configuration used for the workflow
103 o2::conf::ConfigurableParam::writeINI("o2tpcinterpolation-workflow_configuration.ini");
104 auto useMC = !configcontext.options().get<bool>("disable-mc");
105 useMC = false; // force disabling MC as long as it is not implemented
106 auto sendTrackData = configcontext.options().get<bool>("send-track-data");
107 auto debugOutput = configcontext.options().get<bool>("debug-output");
108 auto extDetResid = !configcontext.options().get<bool>("skip-ext-det-residuals");
109
110 specs.emplace_back(o2::tpc::getTPCInterpolationSpec(srcClusters, srcVtx, srcTracks, srcTracksMap, useMC, processITSTPConly, sendTrackData, debugOutput, extDetResid));
111 if (!configcontext.options().get<bool>("disable-root-output")) {
112 specs.emplace_back(o2::tpc::getTPCResidualWriterSpec(sendTrackData, debugOutput));
113 }
114
115 o2::globaltracking::InputHelper::addInputSpecs(configcontext, specs, srcClusters, srcVtx, srcVtx, useMC);
116 o2::globaltracking::InputHelper::addInputSpecsPVertex(configcontext, specs, useMC); // P-vertex is always needed
117
118 // configure dpl timer to inject correct firstTForbit: start from the 1st orbit of TF containing 1st sampled orbit
119 o2::raw::HBFUtilsInitializer hbfIni(configcontext, specs);
120
121 return specs;
122}
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, 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 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)