Project
Loading...
Searching...
No Matches
cell-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::emcal;
26
27// we need to add workflow options before including Framework/runDataProcessing
28void customize(std::vector<ConfigParamSpec>& workflowOptions)
29{
30 std::vector<ConfigParamSpec> options{{"cell-writer-name", VariantType::String, "emcal-cells-writer", {"Workflow name"}},
31 {"disable-mc", VariantType::Bool, false, {"Do not propagate MC labels"}},
32 {"subspec", VariantType::UInt32, 0U, {"Input subspecification"}},
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(".*(?:EMC|emc).*[W,w]riter.*"));
41}
42
44
46{
47 bool disableMC = cfgc.options().get<bool>("disable-mc");
48 auto subspec = cfgc.options().get<uint32_t>("subspec");
49 auto workflowname = cfgc.options().get<std::string>("cell-writer-name");
50 o2::conf::ConfigurableParam::updateFromString(cfgc.options().get<std::string>("configKeyValues"));
51
52 WorkflowSpec specs;
53 specs.emplace_back(MakeRootTreeWriterSpec(workflowname.data(), "emccells.root", "o2sim",
54 MakeRootTreeWriterSpec::BranchDefinition<std::vector<Cell>>{InputSpec{"data", "EMC", "CELLS", subspec}, "EMCALCell", "cell-branch-name"},
55 MakeRootTreeWriterSpec::BranchDefinition<std::vector<TriggerRecord>>{InputSpec{"trigger", "EMC", "CELLSTRGR", subspec}, "EMCALCellTRGR", "celltrigger-branch-name"},
56 MakeRootTreeWriterSpec::BranchDefinition<o2::dataformats::MCTruthContainer<MCLabel>>{InputSpec{"mc", "EMC", "CELLSMCTR", subspec}, "EMCALCellMCTruth", "cellmc-branch-name", disableMC ? 0 : 1})());
57 return specs;
58}
WorkflowSpec defineDataProcessing(ConfigContext const &cfgc)
void customize(std::vector< ConfigParamSpec > &workflowOptions)
Definition of a container to keep Monte Carlo truth external to simulation objects.
Configurable generator for RootTreeWriter processor spec.
static void updateFromString(std::string const &)
ConfigParamRegistry & options() const
Generate a processor spec for the RootTreeWriter utility.
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...