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
16
17#include <array>
18#include <string>
19#include <vector>
20#include "Framework/Variant.h"
36
37using namespace o2::framework;
38
39void customize(std::vector<o2::framework::CompletionPolicy>& policies)
40{
41 // ordered policies for the writers
42 policies.push_back(CompletionPolicyHelpers::consumeWhenAllOrdered(".*(?:MID|mid).*[W,w]riter.*"));
43}
44
45// we need to add workflow options before including Framework/runDataProcessing
46void customize(std::vector<ConfigParamSpec>& workflowOptions)
47{
48 std::vector<ConfigParamSpec>
49 options{
50 {"disable-mc", VariantType::Bool, false, {"Do not propagate MC labels"}},
51 {"disable-tracking", VariantType::Bool, false, {"Only run clustering"}},
52 {"disable-root-output", VariantType::Bool, false, {"Do not write output to file"}},
53 {"change-local-to-BC", VariantType::Int, 0, {"Change the delay between the MID local clock and the BC"}},
54 {"disable-filtering", VariantType::Bool, false, {"Do not remove bad channels"}},
55 {"enable-filter-BC", VariantType::Bool, false, {"Filter BCs"}},
56 {"configKeyValues", VariantType::String, "", {"Semicolon separated key=value strings"}}};
57
58 workflowOptions.insert(workflowOptions.end(), options.begin(), options.end());
59}
60
62
64{
65 bool disableMC = cfgc.options().get<bool>("disable-mc");
66 bool disableTracking = cfgc.options().get<bool>("disable-tracking");
67 bool disableFile = cfgc.options().get<bool>("disable-root-output");
68 auto disableFiltering = cfgc.options().get<bool>("disable-filtering");
69 auto localToBC = cfgc.options().get<int>("change-local-to-BC");
70 auto filterBC = cfgc.options().get<bool>("enable-filter-BC");
71 o2::conf::ConfigurableParam::updateFromString(cfgc.options().get<std::string>("configKeyValues"));
72
73 WorkflowSpec specs;
74 std::string baseDataDesc = "DATA";
75 std::string baseROFDesc = "DATAROF";
76 std::string baseLabelsDesc = "DATALABELS";
77 std::string dataDesc = baseDataDesc;
78 std::string rofDesc = baseROFDesc;
79 std::string labelsDesc = baseLabelsDesc;
80 if (!disableFiltering) {
81 std::string prefix = "F";
82 std::string outDataDesc = prefix + baseDataDesc;
83 specs.emplace_back(o2::mid::getFilteringSpec(!disableMC, dataDesc, outDataDesc));
84 dataDesc = outDataDesc;
85 rofDesc = prefix + baseROFDesc;
86 labelsDesc = prefix + baseLabelsDesc;
87 }
88 if (localToBC != 0) {
89 specs.emplace_back(o2::mid::getTimingSpec(localToBC, rofDesc));
90 std::string prefix = "T";
91 rofDesc = prefix + baseROFDesc;
92 }
93 if (filterBC) {
94 specs.emplace_back(o2::mid::getFilteringBCSpec(!disableMC, dataDesc));
95 std::string prefix = "B";
96 dataDesc = prefix + baseDataDesc;
97 rofDesc = prefix + baseROFDesc;
98 labelsDesc = prefix + baseLabelsDesc;
99 }
100 specs.emplace_back(o2::mid::getClusterizerSpec(!disableMC, dataDesc, rofDesc, labelsDesc));
101 if (!disableTracking) {
102 specs.emplace_back(o2::mid::getTrackerSpec(!disableMC, !disableFiltering));
103 }
104 if (!disableFile) {
105 if (disableTracking) {
106 specs.emplace_back(MakeRootTreeWriterSpec("MIDRecoWriter",
107 "mid-reco.root",
108 "midreco",
109 MakeRootTreeWriterSpec::BranchDefinition<std::vector<o2::mid::Cluster>>{InputSpec{"mid_clusters", o2::header::gDataOriginMID, "CLUSTERS"}, "MIDCluster"},
111 MakeRootTreeWriterSpec::BranchDefinition<o2::dataformats::MCTruthContainer<o2::mid::MCClusterLabel>>{InputSpec{"mid_clusters_labels", o2::header::gDataOriginMID, "CLUSTERSLABELS"}, "MIDClusterLabels", disableMC ? 0 : 1})());
112
113 } else {
114 specs.emplace_back(MakeRootTreeWriterSpec("MIDRecoWriter",
115 "mid-reco.root",
116 "midreco",
117 MakeRootTreeWriterSpec::BranchDefinition<std::vector<o2::mid::Track>>{InputSpec{"mid_tracks", o2::header::gDataOriginMID, "TRACKS"}, "MIDTrack"},
121 MakeRootTreeWriterSpec::BranchDefinition<std::vector<o2::MCCompLabel>>{InputSpec{"mid_track_labels", o2::header::gDataOriginMID, "TRACKLABELS"}, "MIDTrackLabels", disableMC ? 0 : 1},
122 MakeRootTreeWriterSpec::BranchDefinition<o2::dataformats::MCTruthContainer<o2::mid::MCClusterLabel>>{InputSpec{"mid_trclus_labels", o2::header::gDataOriginMID, "TRCLUSLABELS"}, "MIDTrackClusterLabels", disableMC ? 0 : 1})());
123 }
124 }
125
126 return specs;
127}
Reconstructed MID cluster.
Reconstructed MID track.
MID filtering spec.
Label for MID clusters.
Definition of a container to keep Monte Carlo truth external to simulation objects.
WorkflowSpec defineDataProcessing(ConfigContext const &cfgc)
void customize(std::vector< o2::framework::CompletionPolicy > &policies)
Data processor specs for MID clustering device.
MID filtering spec.
Data processor spec for MID tracker device.
Definition of the MID event record.
Configurable generator for RootTreeWriter processor spec.
Device to synchronize MID clock with collision BC.
static void updateFromString(std::string const &)
ConfigParamRegistry & options() const
Generate a processor spec for the RootTreeWriter utility.
constexpr o2::header::DataOrigin gDataOriginMID
Definition DataHeader.h:573
Defining PrimaryVertex explicitly as messageable.
Definition TFIDInfo.h:20
std::vector< DataProcessorSpec > WorkflowSpec
framework::DataProcessorSpec getTrackerSpec(bool isMC, bool checkMasked)
framework::DataProcessorSpec getClusterizerSpec(bool isMC, std::string_view inDataDesc, std::string_view inRofDesc, std::string_view inLabelsDesc)
framework::DataProcessorSpec getTimingSpec(int localToBC, std::string_view inRofDesc)
framework::DataProcessorSpec getFilteringSpec(bool useMC=true, std::string_view inDesc="DATA", std::string_view outDesc="FDATA")
framework::DataProcessorSpec getFilteringBCSpec(bool useMC=true, std::string_view inDesc="FDATA")
static CompletionPolicy consumeWhenAllOrdered(const char *name, CompletionPolicy::Matcher matcher)
as consumeWhenAll, but ensures that records are processed with incremental timeSlice (DataHeader::sta...