Project
Loading...
Searching...
No Matches
reco-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
15#include "ErrorMergerSpec.h"
16#include "EventFinderSpec.h"
20#include "Framework/Logger.h"
21#include "Framework/Variant.h"
37
38using namespace o2::framework;
39
40void customize(std::vector<o2::framework::CallbacksPolicy>& policies)
41{
43}
44
45void customize(std::vector<o2::framework::CompletionPolicy>& policies)
46{
47 // ordered policies for the writers
48 policies.push_back(CompletionPolicyHelpers::consumeWhenAllOrdered(".*(?:MCH|mch).*[W,w]riter.*"));
49}
50
51void customize(std::vector<ConfigParamSpec>& workflowOptions)
52{
53 std::vector<ConfigParamSpec> options{
54 {"disable-root-input", o2::framework::VariantType::Bool, false, {"disable root-files input reader"}},
55 {"disable-root-output", o2::framework::VariantType::Bool, false, {"do not write output root files"}},
56 {"disable-mc", o2::framework::VariantType::Bool, false, {"disable MC propagation even if available"}},
57 {"enable-clusters-root-output", o2::framework::VariantType::Bool, false, {"write output root file containing all clusters"}},
58 {"disable-clustering", o2::framework::VariantType::Bool, false, {"disable clustering (and tracking) steps (for debug)"}},
59 {"disable-tracking", o2::framework::VariantType::Bool, false, {"disable tracking step (for debug)"}},
60 {"digits", VariantType::Bool, false, {"Write digits associated to tracks"}},
61 {"triggered", VariantType::Bool, false, {"use MID to trigger the MCH reconstruction"}},
62 {"configKeyValues", VariantType::String, "", {"Semicolon separated key=value strings"}}};
64 std::swap(workflowOptions, options);
65}
66
68
70{
71 WorkflowSpec specs;
72
73 auto disableRootOutput = configcontext.options().get<bool>("disable-root-output");
74 auto disableRootInput = configcontext.options().get<bool>("disable-root-input");
75 auto digits = configcontext.options().get<bool>("digits");
76 auto triggered = configcontext.options().get<bool>("triggered");
77 auto useMC = !configcontext.options().get<bool>("disable-mc");
78 auto disableClustering = configcontext.options().get<bool>("disable-clustering");
79 auto disableTracking = disableClustering || configcontext.options().get<bool>("disable-tracking");
80 auto disableAllClustersRootOutput = !configcontext.options().get<bool>("enable-clusters-root-output");
81
82 o2::conf::ConfigurableParam::updateFromString(configcontext.options().get<std::string>("configKeyValues"));
83
84 if (!disableRootInput) {
85 specs.emplace_back(o2::mch::getDigitReaderSpec(useMC, "mch-digit-reader"));
86 }
87
89 specs.emplace_back(o2::mch::getStatusMapCreatorSpec("mch-statusmap-creator"));
90 }
91
92 specs.emplace_back(o2::mch::getDigitFilteringSpec(useMC, "mch-digit-filtering",
93 "DIGITS", "F-DIGITS",
94 "DIGITROFS", "F-DIGITROFS",
95 "DIGITLABELS", "F-DIGITLABELS"));
96
97 if (triggered) {
98 specs.emplace_back(o2::mch::getEventFinderSpec(useMC, "mch-event-finder",
99 "F-DIGITS", "E-F-DIGITS",
100 "F-DIGITROFS", "E-F-DIGITROFS",
101 "F-DIGITLABELS", "E-F-DIGITLABELS"));
102 } else {
103 specs.emplace_back(o2::mch::getTimeClusterFinderSpec("mch-time-cluster-finder",
104 "F-DIGITS",
105 "F-DIGITROFS",
106 "TC-F-DIGITROFS"));
107 }
108
109 specs.emplace_back(o2::mch::getPreClusterFinderSpec("mch-precluster-finder",
110 triggered ? "E-F-DIGITS" : "F-DIGITS",
111 triggered ? "E-F-DIGITROFS" : "TC-F-DIGITROFS"));
112
113 if (!disableClustering) {
115 specs.emplace_back(o2::mch::getClusterFinderOriginalSpec("mch-cluster-finder"));
116 } else {
117 specs.emplace_back(o2::mch::getClusterFinderGEMSpec("mch-cluster-finder"));
118 }
119 specs.emplace_back(o2::mch::getClusterTransformerSpec("mch-cluster-transformer", false));
120 if (!disableRootOutput && !disableAllClustersRootOutput) {
121 specs.emplace_back(o2::mch::getClusterWriterSpec(false, "mch-global-cluster-writer", true, true));
122 }
123 if (!disableTracking) {
124 specs.emplace_back(o2::mch::getTrackFinderSpec("mch-track-finder", true, digits, false, false));
125 if (useMC) {
126 specs.emplace_back(o2::mch::getTrackMCLabelFinderSpec("mch-track-mc-label-finder",
127 triggered ? "E-F-DIGITROFS" : "TC-F-DIGITROFS",
128 triggered ? "E-F-DIGITLABELS" : "F-DIGITLABELS"));
129 }
130
131 if (!disableRootOutput) {
132 specs.emplace_back(o2::mch::getTrackWriterSpec(useMC, "mch-track-writer", "mchtracks.root", digits));
133 }
134 }
135 }
136
137 specs.emplace_back(o2::mch::getErrorMergerSpec("mch-error-merger", true, !disableClustering,
138 !(disableClustering || disableTracking)));
139 if (!disableRootOutput) {
140 specs.emplace_back(o2::mch::getErrorWriterSpec("mch-error-writer"));
141 }
142
143 // configure dpl timer to inject correct firstTForbit: start from the 1st orbit of TF containing 1st sampled orbit
144 o2::raw::HBFUtilsInitializer hbfIni(configcontext, specs);
145
146 // write the configuration used for the reco workflow
147 o2::conf::ConfigurableParam::writeINI("o2mchrecoflow_configuration.ini");
148
149 return specs;
150}
Definition of a data processor to run the GEM MLEM cluster finder.
Definition of a data processor to run the original MLEM cluster finder.
Configurable parameters for MCH clustering.
Definition of a data processor to merge the processing errors in one single output.
Definition of a data processor to group MCH digits based on MID information.
WorkflowSpec defineDataProcessing(ConfigContext const &configcontext)
void customize(std::vector< o2::framework::CallbacksPolicy > &policies)
Definition of a data processor to run the preclusterizer.
Definition of a data processor to run the time clusterizer.
Definition of a data processor to read clusters, reconstruct tracks and send them.
Definition of a data processor to match the reconstructed tracks with the simulated ones.
static void writeINI(std::string const &filename, std::string const &keyOnly="")
static void updateFromString(std::string const &)
ConfigParamRegistry & options() const
Defining PrimaryVertex explicitly as messageable.
Definition TFIDInfo.h:20
std::vector< DataProcessorSpec > WorkflowSpec
o2::framework::DataProcessorSpec getTrackMCLabelFinderSpec(const char *specName, const char *digitRofDataDescription, const char *digitLabelDataDescription)
o2::framework::DataProcessorSpec getClusterTransformerSpec(const char *specName="mch-cluster-transformer", bool disableCcdb=false)
o2::framework::DataProcessorSpec getPreClusterFinderSpec(const char *specName="PreClusterFinder", std::string_view inputDigitDataDescription="F-DIGITS", std::string_view inputDigitRofDataDescription="TC-F-DIGITROFS")
o2::framework::DataProcessorSpec getDigitFilteringSpec(bool useMC, std::string_view specName="mch-digit-filtering", std::string_view inputDigitDataDescription="DIGITS", std::string_view outputDigitDataDescription="F-DIGITS", std::string_view inputDigitRofDataDescription="DIGITROFS", std::string_view outputDigitRofDataDescription="F-DIGITROFS", std::string_view inputDigitLabelDataDescription="DIGITLABELS", std::string_view outputDigitLabelDataDescription="F-DIGITLABELS")
framework::DataProcessorSpec getDigitReaderSpec(bool useMC, std::string_view specName="mch-digit-reader", std::string_view outputDigitDataDescription="DIGITS", std::string_view outputDigitRofDataDescription="DIGITROFS", std::string_view outputDigitLabelDataDescription="DIGITLABELS")
framework::DataProcessorSpec getErrorWriterSpec(const char *specName="mch-error-writer")
o2::framework::DataProcessorSpec getClusterWriterSpec(bool useMC, const char *specName="mch-cluster-writer", bool global=true, bool digits=true)
o2::framework::DataProcessorSpec getClusterFinderGEMSpec(const char *specName)
DataProcessorSpec getEventFinderSpec(bool useMC, std::string_view specName, std::string_view inputDigitDataDescription, std::string_view outputDigitDataDescription, std::string_view inputDigitRofDataDescription, std::string_view outputDigitRofDataDescription, std::string_view inputDigitLabelDataDescription, std::string_view outputDigitLabelDataDescription)
o2::framework::DataProcessorSpec getTrackWriterSpec(bool useMC, const char *specName="mch-track-writer", const char *fileName="mchtracks.root", bool digits=false)
o2::framework::DataProcessorSpec getTimeClusterFinderSpec(const char *specName="mch-time-cluster-finder", std::string_view inputDigitDataDescription="F-DIGITS", std::string_view inputDigitRofDataDescription="F-DIGITROFS", std::string_view outputDigitRofDataDescription="TC-F-DIGITROFS", std::string_view inputIRFrameDataDescription="ITS/IRFRAMES")
DataProcessorSpec getErrorMergerSpec(const char *specName, bool preclustering, bool clustering, bool tracking)
o2::framework::DataProcessorSpec getStatusMapCreatorSpec(std::string_view specName="mch-statusmap-creator")
o2::framework::DataProcessorSpec getClusterFinderOriginalSpec(const char *specName="mch-cluster-finder-original")
o2::framework::DataProcessorSpec getTrackFinderSpec(const char *specName="mch-track-finder", bool computeTime=true, bool digits=false, bool disableCCDBMagField=false, bool original=false)
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))
std::vector< Digit > digits