Project
Loading...
Searching...
No Matches
primary-vertexing-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
32
33using namespace o2::framework;
36// ------------------------------------------------------------------
37void customize(std::vector<o2::framework::CallbacksPolicy>& policies)
38{
40}
41
42void customize(std::vector<o2::framework::CompletionPolicy>& policies)
43{
44 // ordered policies for the writers
45 policies.push_back(CompletionPolicyHelpers::consumeWhenAllOrdered(".*primary-vertex-writer.*"));
46}
47
48// we need to add workflow options before including Framework/runDataProcessing
49void customize(std::vector<ConfigParamSpec>& workflowOptions)
50{
51 // option allowing to set parameters
52 std::vector<o2::framework::ConfigParamSpec> options{
53 {"disable-mc", o2::framework::VariantType::Bool, false, {"disable MC propagation"}},
54 {"disable-root-input", o2::framework::VariantType::Bool, false, {"disable root-files input reader"}},
55 {"disable-root-output", o2::framework::VariantType::Bool, false, {"disable root-files output writer"}},
56 {"vertexing-sources", VariantType::String, std::string{GID::ALL}, {"comma-separated list of sources to use in vertexing"}},
57 {"skip", VariantType::Bool, false, {"pass-through mode (skip vertexing)"}},
58 {"validate-with-ft0", o2::framework::VariantType::Bool, false, {"use FT0 time for vertex validation"}},
59 {"vertex-track-matching-sources", VariantType::String, std::string{GID::ALL}, {"comma-separated list of sources to use in vertex-track associations or \"none\" to disable matching"}},
60 {"use-full-geometry", o2::framework::VariantType::Bool, false, {"load full geometry"}},
61 {"configKeyValues", VariantType::String, "", {"Semicolon separated key=value strings ..."}},
62 {"combine-source-devices", o2::framework::VariantType::Bool, false, {"merge DPL source devices"}}};
64 std::swap(workflowOptions, options);
65}
66
67// ------------------------------------------------------------------
68
70
72{
73 WorkflowSpec specs;
74
75 GID::mask_t allowedSourcesPV = GID::getSourcesMask("ITS,ITS-TPC,ITS-TPC-TRD,ITS-TPC-TOF,ITS-TPC-TRD-TOF");
76 GID::mask_t allowedSourcesVT = GID::getSourcesMask("ITS,MFT,TPC,MCH,MCH-MID,MFT-MCH,ITS-TPC,TPC-TOF,TPC-TRD,ITS-TPC-TRD,TPC-TRD-TOF,ITS-TPC-TOF,ITS-TPC-TRD-TOF,EMC,PHS,CPV,FT0,FV0,FDD");
77
78 // Update the (declared) parameters if changed from the command line
79 o2::conf::ConfigurableParam::updateFromString(configcontext.options().get<std::string>("configKeyValues"));
80 // write the configuration used for the workflow
81 o2::conf::ConfigurableParam::writeINI("o2primary-vertexing-workflow_configuration.ini");
82
83 auto useMC = !configcontext.options().get<bool>("disable-mc");
84 auto disableRootOut = configcontext.options().get<bool>("disable-root-output");
85 auto validateWithFT0 = configcontext.options().get<bool>("validate-with-ft0");
86 auto skip = configcontext.options().get<bool>("skip");
87 auto useGeom = configcontext.options().get<bool>("use-full-geometry");
88
89 GID::mask_t srcPV = allowedSourcesPV & GID::getSourcesMask(configcontext.options().get<std::string>("vertexing-sources"));
90 GID::mask_t srcVT = allowedSourcesVT & GID::getSourcesMask(configcontext.options().get<std::string>("vertex-track-matching-sources"));
91 if (validateWithFT0) {
92 srcPV |= GID::getSourceMask(GID::FT0);
93 }
94 GID::mask_t srcComb = srcPV | srcVT;
95 GID::mask_t dummy, srcClus = GID::includesDet(DetID::TOF, srcComb) ? GID::getSourceMask(GID::TOF) : dummy;
96
97 specs.emplace_back(o2::vertexing::getPrimaryVertexingSpec(srcPV, skip, validateWithFT0, useMC, useGeom));
98 specs.emplace_back(o2::vertexing::getVertexTrackMatcherSpec(srcVT));
99
100 auto srcMtc = srcComb;
101
102 // only TOF clusters are needed if TOF is involved, no clusters MC needed
103 WorkflowSpec inputspecs;
104 o2::globaltracking::InputHelper::addInputSpecs(configcontext, inputspecs, srcClus, srcMtc, srcComb, useMC, dummy);
105
106 if (configcontext.options().get<bool>("combine-source-devices")) {
107 std::vector<DataProcessorSpec> unmerged;
108 specs.push_back(specCombiner("PV-Input-Reader", inputspecs, unmerged));
109 // Note: Switch in future to core framework function, once it can handle duplicate options
110 // auto combined = o2::framework::workflow::combine("PV-Input-Reader", inputspecs, true);
111 // for (auto& c : combined) {
112 // specs.push_back(c);
113 // }
114 if (unmerged.size() > 0) {
115 LOG(fatal) << "unexpected DPL merge error";
116 }
117 } else {
118 for (auto& s : inputspecs) {
119 specs.push_back(s);
120 }
121 }
122
123 if (!disableRootOut) {
124 specs.emplace_back(o2::vertexing::getPrimaryVertexWriterSpec(false, useMC));
125 }
126
127 // configure dpl timer to inject correct firstTForbit: start from the 1st orbit of TF containing 1st sampled orbit
128 if (srcPV.any() && !configcontext.options().get<bool>("disable-root-output")) {
129 o2::raw::HBFUtilsInitializer hbfIni(configcontext, specs);
130 }
131 return std::move(specs);
132}
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error s
Global index for barrel track: provides provenance (detectors combination), index in respective array...
Specs for vertex track association device.
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 constexpr std::string_view ALL
keywork for all sources
Static class with identifiers, bitmasks and names for ALICE detectors.
Definition DetID.h:60
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
o2::framework::DataProcessorSpec specCombiner(std::string const &name, std::vector< DataProcessorSpec > const &speccollection, std::vector< DataProcessorSpec > &remaining)
std::vector< DataProcessorSpec > WorkflowSpec
framework::DataProcessorSpec getPrimaryVertexWriterSpec(bool disableMatching, bool useMC)
create a processor spec
o2::framework::DataProcessorSpec getPrimaryVertexingSpec(o2::dataformats::GlobalTrackID::mask_t src, bool skip, bool validateWithFT0, bool useMC, bool useGeom)
create a processor spec
o2::framework::DataProcessorSpec getVertexTrackMatcherSpec(o2::dataformats::GlobalTrackID::mask_t src)
create a processor spec
WorkflowSpec defineDataProcessing(ConfigContext const &configcontext)
void customize(std::vector< o2::framework::CallbacksPolicy > &policies)
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"