Project
Loading...
Searching...
No Matches
cosmics-match-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
35
36using namespace o2::framework;
39// ------------------------------------------------------------------
40void customize(std::vector<o2::framework::CallbacksPolicy>& policies)
41{
43}
44
45// we need to add workflow options before including Framework/runDataProcessing
46void customize(std::vector<o2::framework::ConfigParamSpec>& workflowOptions)
47{
48 // option allowing to set parameters
49 std::vector<o2::framework::ConfigParamSpec> options{
50 {"disable-mc", o2::framework::VariantType::Bool, false, {"disable MC propagation even if available"}},
51 {"disable-root-input", o2::framework::VariantType::Bool, false, {"disable root-files input reader"}},
52 {"disable-root-output", o2::framework::VariantType::Bool, false, {"disable root-files output writer"}},
53 {"track-sources", VariantType::String, std::string{GID::ALL}, {"comma-separated list of sources to use"}},
54 {"configKeyValues", VariantType::String, "", {"Semicolon separated key=value strings ..."}}};
57 std::swap(workflowOptions, options);
58}
59
60// RS FIXME Is this needed ?
61// the matcher process requires the TPC sector completion to trigger and data on
62// all defined routes
63void customize(std::vector<o2::framework::CompletionPolicy>& policies)
64{
65 // the TPC sector completion policy checks when the set of TPC/CLUSTERNATIVE data is complete
66 // in addition we require to have input from all other routes
67 policies.push_back(o2::tpc::TPCSectorCompletionPolicy("cosmics-matcher",
69 InputSpec{"cluster", o2::framework::ConcreteDataTypeMatcher{"TPC", "CLUSTERNATIVE"}})());
70 policies.push_back(CompletionPolicyHelpers::consumeWhenAllOrdered(".*cosm.*[W,w]riter.*"));
71}
72
73// ------------------------------------------------------------------
74
76
78{
79 WorkflowSpec specs;
80 GID::mask_t alowedSources = GID::getSourcesMask("ITS,TPC,ITS-TPC,TPC-TRD,TPC-TOF,TPC-TRD-TOF,ITS-TPC-TOF,ITS-TPC-TRD-TOF");
81
82 // Update the (declared) parameters if changed from the command line
83 o2::conf::ConfigurableParam::updateFromString(configcontext.options().get<std::string>("configKeyValues"));
84 // write the configuration used for the workflow
85 o2::conf::ConfigurableParam::writeINI("o2match-cosmics-workflow_configuration.ini");
87 auto useMC = !configcontext.options().get<bool>("disable-mc");
88 auto disableRootOut = configcontext.options().get<bool>("disable-root-output");
89
90 GID::mask_t src = alowedSources & GID::getSourcesMask(configcontext.options().get<std::string>("track-sources"));
91 if (GID::includesDet(DetID::TPC, src)) {
92 src |= GID::getSourceMask(GID::TPC);
93 }
94 if (GID::includesDet(DetID::TRD, src)) {
95 src |= GID::getSourceMask(GID::TRD);
96 }
97 if (GID::includesDet(DetID::TOF, src)) {
98 src |= GID::getSourceMask(GID::TOF);
99 }
100 if (sclOpt.requestCTPLumi) {
101 src = src | GID::getSourcesMask("CTP");
102 }
103 GID::mask_t srcCl = src;
104 GID::mask_t dummy;
105 if (sclOpt.needTPCScalersWorkflow() && !configcontext.options().get<bool>("disable-root-input")) {
106 specs.emplace_back(o2::tpc::getTPCScalerSpec(sclOpt.lumiType == 2, sclOpt.enableMShapeCorrection));
107 }
108 specs.emplace_back(o2::globaltracking::getCosmicsMatchingSpec(src, useMC, sclOpt));
109
110 o2::globaltracking::InputHelper::addInputSpecs(configcontext, specs, src, src, src, useMC, dummy); // clusters MC is not needed
111
112 if (!disableRootOut) {
113 specs.emplace_back(o2::globaltracking::getTrackCosmicsWriterSpec(useMC));
114 }
115
116 // configure dpl timer to inject correct firstTForbit: start from the 1st orbit of TF containing 1st sampled orbit
117 o2::raw::HBFUtilsInitializer hbfIni(configcontext, specs);
118
119 return std::move(specs);
120}
Device to produce TPC clusters sharing map.
Helper class to access load maps from CCDB.
Global index for barrel track: provides provenance (detectors combination), index in respective array...
Helper function to tokenize sequences and ranges of integral numbers.
DPL completion policy helper for TPC scetor data.
static void writeINI(std::string const &filename, std::string const &keyOnly="")
static void updateFromString(std::string const &)
static mask_t getSourcesMask(const std::string_view srcList)
static constexpr std::string_view ALL
keywork for all sources
Static class with identifiers, bitmasks and names for ALICE detectors.
Definition DetID.h:58
static constexpr ID TRD
Definition DetID.h:65
static constexpr ID TPC
Definition DetID.h:64
static constexpr ID TOF
Definition DetID.h:66
ConfigParamRegistry & options() const
static int addInputSpecs(const o2::framework::ConfigContext &configcontext, o2::framework::WorkflowSpec &specs, GID::mask_t maskClusters, GID::mask_t maskMatches, GID::mask_t maskTracks, bool useMC=true, GID::mask_t maskClustersMC=GID::getSourcesMask(GID::ALL), GID::mask_t maskTracksMC=GID::getSourcesMask(GID::ALL), bool subSpecStrict=false)
static void addGlobalOptions(std::vector< o2::framework::ConfigParamSpec > &options)
static CorrectionMapsLoaderGloOpts parseGlobalOptions(const o2::framework::ConfigParamRegistry &opts)
WorkflowSpec defineDataProcessing(ConfigContext const &configcontext)
void customize(std::vector< o2::framework::CallbacksPolicy > &policies)
GLenum src
Definition glcorearb.h:1767
Defining PrimaryVertex explicitly as messageable.
Definition TFIDInfo.h:20
std::vector< DataProcessorSpec > WorkflowSpec
framework::DataProcessorSpec getTrackCosmicsWriterSpec(bool useMC)
framework::DataProcessorSpec getCosmicsMatchingSpec(o2::dataformats::GlobalTrackID::mask_t src, bool useMC, const o2::tpc::CorrectionMapsLoaderGloOpts &sclOpts)
create a processor spec
o2::framework::DataProcessorSpec getTPCScalerSpec(bool enableIDCs, bool enableMShape)
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))