Project
Loading...
Searching...
No Matches
tracks-matcher-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 <string>
18#include <vector>
28#include "TrackMatcherSpec.h"
29#include "TrackWriterSpec.h"
30
31using namespace o2::framework;
32
33// ------------------------------------------------------------------
34void customize(std::vector<o2::framework::CallbacksPolicy>& policies)
35{
37}
38
39void customize(std::vector<CompletionPolicy>& policies)
40{
41 // ordered policies for the writers
42 policies.push_back(CompletionPolicyHelpers::consumeWhenAllOrdered(".*(?:MUON|muon).*[W,w]riter.*"));
43}
44
45// we need to add workflow options before including Framework/runDataProcessing
46void customize(std::vector<ConfigParamSpec>& workflowOptions)
47{
48 // option allowing to set parameters
49 workflowOptions.emplace_back("disable-root-input", VariantType::Bool, false,
50 ConfigParamSpec::HelpString{"disable root-files input reader"});
51 workflowOptions.emplace_back("disable-root-output", VariantType::Bool, false,
52 ConfigParamSpec::HelpString{"do not write output root file"});
53 workflowOptions.emplace_back("disable-mc", VariantType::Bool, false,
54 ConfigParamSpec::HelpString{"disable MC propagation even if available"});
55 workflowOptions.emplace_back("configKeyValues", VariantType::String, "",
56 ConfigParamSpec::HelpString{"Semicolon separated key=value strings"});
58}
59
61
63{
64 WorkflowSpec specs{};
65
66 auto disableRootOutput = configcontext.options().get<bool>("disable-root-output");
67 auto disableRootInput = configcontext.options().get<bool>("disable-root-input");
68 auto useMC = !configcontext.options().get<bool>("disable-mc");
69
70 o2::conf::ConfigurableParam::updateFromString(configcontext.options().get<std::string>("configKeyValues"));
71
72 if (!disableRootInput) {
73 specs.emplace_back(o2::mch::getTrackReaderSpec(useMC, "mch-track-reader"));
74 specs.emplace_back(o2::mid::getTrackReaderSpec(useMC, "mid-track-reader"));
75 }
76
77 specs.emplace_back(o2::muon::getTrackMatcherSpec(useMC, "muon-track-matcher"));
78
79 if (!disableRootOutput) {
80 specs.emplace_back(o2::muon::getTrackWriterSpec(useMC, "muon-track-writer", "muontracks.root"));
81 }
82
83 // configure dpl timer to inject correct firstTForbit: start from the 1st orbit of TF containing 1st sampled orbit
84 o2::raw::HBFUtilsInitializer hbfIni(configcontext, specs);
85
86 // write the configuration used for the workflow
87 o2::conf::ConfigurableParam::writeINI("o2matchmchmid-workflow_configuration.ini");
88
89 return specs;
90}
Definition of a data processor to match MCH and MID tracks.
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 getTrackReaderSpec(bool useMC, const char *specName="mch-tracks-reader", bool digits=false, uint32_t subspec=0)
o2::framework::DataProcessorSpec getTrackReaderSpec(bool useMC, const char *specName="mid-tracks-reader")
DataProcessorSpec getTrackWriterSpec(bool useMC, const char *specName, const char *fileName)
DataProcessorSpec getTrackMatcherSpec(bool useMC, const char *name)
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))
WorkflowSpec defineDataProcessing(const ConfigContext &configcontext)
void customize(std::vector< o2::framework::CallbacksPolicy > &policies)