Project
Loading...
Searching...
No Matches
event-writer-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
12#include <string>
13#include <vector>
14#include "Framework/Variant.h"
23
24using namespace o2::framework;
25using namespace o2::focal;
26
27// we need to add workflow options before including Framework/runDataProcessing
28void customize(std::vector<ConfigParamSpec>& workflowOptions)
29{
30 std::vector<ConfigParamSpec> options{{"event-writer-name", VariantType::String, "focal-event-writer", {"Workflow name"}},
31 {"subspec", VariantType::UInt32, 0U, {"Input subspecification"}},
32 {"no-subspec", VariantType::Bool, false, {"No subspecification (for output from raw STFs)"}},
33 {"configKeyValues", VariantType::String, "", {"Semicolon separated key=value strings"}}};
34 workflowOptions.insert(workflowOptions.end(), options.begin(), options.end());
35}
36
37void customize(std::vector<o2::framework::CompletionPolicy>& policies)
38{
39 // ordered policies for the writers
40 policies.push_back(CompletionPolicyHelpers::consumeWhenAllOrdered(".*(?:FOC|foc).*[W,w]riter.*"));
41}
42
44
46{
47 auto subspec = cfgc.options().get<uint32_t>("subspec");
48 auto workflowname = cfgc.options().get<std::string>("event-writer-name");
49 o2::conf::ConfigurableParam::updateFromString(cfgc.options().get<std::string>("configKeyValues"));
50
51 WorkflowSpec specs;
52 if (cfgc.options().get<bool>("no-subspec")) {
53 // No subspecification defined (i.e. output from the raw-tf-reader workflow): Use concrete data type matcher
54 specs.emplace_back(MakeRootTreeWriterSpec(workflowname.data(), "focalevents.root", "o2sim",
55 MakeRootTreeWriterSpec::BranchDefinition<std::vector<PadLayerEvent>>{InputSpec{"dataapd", o2::framework::ConcreteDataTypeMatcher{"FOC", "PADLAYERS"}}, "FOCALPadLayer", "pad-branch-name"},
56 MakeRootTreeWriterSpec::BranchDefinition<std::vector<PixelHit>>{InputSpec{"datapixelhit", o2::framework::ConcreteDataTypeMatcher{"FOC", "PIXELHITS"}}, "FOCALPixelHit", "pixel-hit-branch-name"},
57 MakeRootTreeWriterSpec::BranchDefinition<std::vector<PixelChipRecord>>{InputSpec{"datapixelchip", o2::framework::ConcreteDataTypeMatcher{"FOC", "PIXELCHIPS"}}, "FOCALPixelChip", "pixel-chip-branch-name"},
58 MakeRootTreeWriterSpec::BranchDefinition<std::vector<TriggerRecord>>{InputSpec{"datatrigger", o2::framework::ConcreteDataTypeMatcher{"FOC", "TRIGGERS"}}, "FOCALTrigger", "trigger-branch-name"})());
59 } else {
60 // Subspecification specified: Use full specification
61 specs.emplace_back(MakeRootTreeWriterSpec(workflowname.data(), "focalevents.root", "o2sim",
62 MakeRootTreeWriterSpec::BranchDefinition<std::vector<PadLayerEvent>>{InputSpec{"dataapd", "FOC", "PADLAYERS", subspec}, "FOCALPadLayer", "pad-branch-name"},
63 MakeRootTreeWriterSpec::BranchDefinition<std::vector<PixelHit>>{InputSpec{"datapixelhit", "FOC", "PIXELHITS", subspec}, "FOCALPixelHit", "pixel-hit-branch-name"},
64 MakeRootTreeWriterSpec::BranchDefinition<std::vector<PixelChipRecord>>{InputSpec{"datapixelchip", "FOC", "PIXELCHIPS", subspec}, "FOCALPixelChip", "pixel-chip-branch-name"},
65 MakeRootTreeWriterSpec::BranchDefinition<std::vector<TriggerRecord>>{InputSpec{"datatrigger", "FOC", "TRIGGERS", subspec}, "FOCALTrigger", "trigger-branch-name"})());
66 }
67 return specs;
68}
Configurable generator for RootTreeWriter processor spec.
static void updateFromString(std::string const &)
ConfigParamRegistry & options() const
Generate a processor spec for the RootTreeWriter utility.
WorkflowSpec defineDataProcessing(ConfigContext const &cfgc)
void customize(std::vector< ConfigParamSpec > &workflowOptions)
Defining PrimaryVertex explicitly as messageable.
Definition TFIDInfo.h:20
std::vector< DataProcessorSpec > WorkflowSpec
static CompletionPolicy consumeWhenAllOrdered(const char *name, CompletionPolicy::Matcher matcher)
as consumeWhenAll, but ensures that records are processed with incremental timeSlice (DataHeader::sta...