Project
Loading...
Searching...
No Matches
FileReaderWorkflow.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
13
21
25
26void customize(std::vector<o2::framework::CallbacksPolicy>& policies)
27{
29}
30
31// add workflow options, note that customization needs to be declared before
32// including Framework/runDataProcessing
33void customize(std::vector<o2::framework::ConfigParamSpec>& workflowOptions)
34{
35 using namespace o2::framework;
36
37 std::vector<ConfigParamSpec> options{
38 {"input-type", VariantType::String, "clusters", {"clusters, tracks"}},
39 {"disable-mc", VariantType::Bool, false, {"disable sending of MC information"}},
40 {"configKeyValues", VariantType::String, "", {"semicolon separated key=value strings"}}};
42 std::swap(workflowOptions, options);
43}
44
45#include "Framework/runDataProcessing.h" // the main driver
46
47using namespace o2::framework;
48
49enum struct InputType { Clusters,
50 Tracks
51};
52
53const std::unordered_map<std::string, InputType> InputMap{
54 {"clusters", InputType::Clusters},
55 {"tracks", InputType::Tracks}};
56
61{
62 WorkflowSpec specs;
63
64 auto inputType = cfgc.options().get<std::string>("input-type");
65 bool doMC = not cfgc.options().get<bool>("disable-mc");
66
67 std::vector<InputType> inputTypes;
68 try {
69 inputTypes = o2::RangeTokenizer::tokenize<InputType>(inputType, [](std::string const& token) { return InputMap.at(token); });
70 } catch (std::out_of_range&) {
71 throw std::invalid_argument(std::string("invalid input type: ") + inputType);
72 }
73 auto isEnabled = [&inputTypes](InputType type) {
74 return std::find(inputTypes.begin(), inputTypes.end(), type) != inputTypes.end();
75 };
76
77 if (isEnabled(InputType::Clusters)) {
78 specs.emplace_back(o2::tpc::getClusterReaderSpec(doMC));
79 if (!getenv("DPL_DISABLE_TPC_TRIGGER_READER") || atoi(getenv("DPL_DISABLE_TPC_TRIGGER_READER")) != 1) {
80 specs.emplace_back(o2::tpc::getTPCTriggerReaderSpec());
81 }
82 }
83
84 if (isEnabled(InputType::Tracks)) {
85
86 specs.push_back(o2::tpc::getTPCTrackReaderSpec(doMC));
87 }
88
89 if (isEnabled(InputType::Tracks) && isEnabled(InputType::Clusters)) { // create shared clusters and occupancy maps
90 specs.emplace_back(o2::tpc::getClusterSharingMapSpec());
91 }
92
93 o2::raw::HBFUtilsInitializer hbfIni(cfgc, specs);
94 return std::move(specs);
95}
Device to produce TPC clusters sharing map.
A const (ready only) version of MCTruthContainer.
WorkflowSpec defineDataProcessing(ConfigContext const &cfgc)
This function hooks up the the workflow specifications into the DPL driver.
const std::unordered_map< std::string, InputType > InputMap
void customize(std::vector< o2::framework::CallbacksPolicy > &policies)
A special IO container - splitting a given vector to enable ROOT IO.
Helper function to tokenize sequences and ranges of integral numbers.
ConfigParamRegistry & options() const
GLint GLint GLsizei GLint GLenum GLenum type
Definition glcorearb.h:275
Defining PrimaryVertex explicitly as messageable.
Definition TFIDInfo.h:20
std::vector< DataProcessorSpec > WorkflowSpec
framework::DataProcessorSpec getClusterReaderSpec(bool useMC, const std::vector< int > *tpcSectors=nullptr, const std::vector< int > *laneConfiguration=nullptr)
framework::DataProcessorSpec getTPCTrackReaderSpec(bool useMC=true)
o2::framework::DataProcessorSpec getClusterSharingMapSpec()
framework::DataProcessorSpec getTPCTriggerReaderSpec()
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))