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
36
37using namespace o2::framework;
40// ------------------------------------------------------------------
41void customize(std::vector<o2::framework::CallbacksPolicy>& policies)
42{
44}
45
46// we need to add workflow options before including Framework/runDataProcessing
47void customize(std::vector<o2::framework::ConfigParamSpec>& workflowOptions)
48{
49 // option allowing to set parameters
50 std::vector<o2::framework::ConfigParamSpec> options{
51 {"disable-mc", o2::framework::VariantType::Bool, false, {"disable MC propagation even if available"}},
52 {"disable-root-input", o2::framework::VariantType::Bool, false, {"disable root-files input reader"}},
53 {"disable-root-output", o2::framework::VariantType::Bool, false, {"disable root-files output writer"}},
54 {"use-pv-info", o2::framework::VariantType::Bool, false, {"request primary vertex for relevant cuts in the collision/cosmics interleaved data"}},
55 {"track-sources", VariantType::String, std::string{GID::ALL}, {"comma-separated list of sources to use"}},
56 {"configKeyValues", VariantType::String, "", {"Semicolon separated key=value strings ..."}}};
60 std::swap(workflowOptions, options);
61}
62
63// RS FIXME Is this needed ?
64// the matcher process requires the TPC sector completion to trigger and data on
65// all defined routes
66void customize(std::vector<o2::framework::CompletionPolicy>& policies)
67{
68 // the TPC sector completion policy checks when the set of TPC/CLUSTERNATIVE data is complete
69 // in addition we require to have input from all other routes
70 policies.push_back(o2::tpc::TPCSectorCompletionPolicy("cosmics-matcher",
72 InputSpec{"cluster", o2::framework::ConcreteDataTypeMatcher{"TPC", "CLUSTERNATIVE"}})());
73 policies.push_back(CompletionPolicyHelpers::consumeWhenAllOrdered(".*cosm.*[W,w]riter.*"));
74}
75
76// ------------------------------------------------------------------
77
79
81{
82 WorkflowSpec specs;
83 GID::mask_t alowedSources = GID::getSourcesMask("ITS,TPC,ITS-TPC,TPC-TRD,TPC-TOF,TPC-TRD-TOF,ITS-TPC-TOF,ITS-TPC-TRD-TOF");
84
85 // Update the (declared) parameters if changed from the command line
86 o2::conf::ConfigurableParam::updateFromString(configcontext.options().get<std::string>("configKeyValues"));
87 // write the configuration used for the workflow
88 o2::conf::ConfigurableParam::writeINI("o2match-cosmics-workflow_configuration.ini");
90 auto useMC = !configcontext.options().get<bool>("disable-mc");
91 auto disableRootOut = configcontext.options().get<bool>("disable-root-output");
92
93 GID::mask_t src = alowedSources & GID::getSourcesMask(configcontext.options().get<std::string>("track-sources"));
94 if (GID::includesDet(DetID::TPC, src)) {
95 src |= GID::getSourceMask(GID::TPC);
96 }
97 if (GID::includesDet(DetID::TRD, src)) {
98 src |= GID::getSourceMask(GID::TRD);
99 }
100 if (GID::includesDet(DetID::TOF, src)) {
101 src |= GID::getSourceMask(GID::TOF);
102 }
103 if (sclOpt.requestCTPLumi) {
104 src = src | GID::getSourcesMask("CTP");
105 }
106
107 GID::mask_t srcCl = src;
108 GID::mask_t dummy;
109 if (!configcontext.options().get<bool>("disable-root-input")) {
110 specs.emplace_back(o2::tpc::getTPCScalerSpec(sclOpt.lumiType == o2::tpc::LumiScaleType::TPCScaler, sclOpt.enableMShapeCorrection, sclOpt));
111 }
112 bool usePV = configcontext.options().get<bool>("use-pv-info");
113 specs.emplace_back(o2::globaltracking::getCosmicsMatchingSpec(src, usePV, useMC));
114
115 o2::globaltracking::InputHelper::addInputSpecs(configcontext, specs, src, src, src, useMC, dummy); // clusters MC is not needed
116 if (usePV) {
117 o2::globaltracking::InputHelper::addInputSpecsPVertex(configcontext, specs, useMC); // P-vertex is always needed
118 }
119
120 if (!disableRootOut) {
121 specs.emplace_back(o2::globaltracking::getTrackCosmicsWriterSpec(useMC));
122 }
123
124 // configure dpl timer to inject correct firstTForbit: start from the 1st orbit of TF containing 1st sampled orbit
125 o2::raw::HBFUtilsInitializer hbfIni(configcontext, specs);
126
127 return std::move(specs);
128}
Device to produce TPC clusters sharing map.
Helper class to parse options for correction maps.
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 int addInputSpecsPVertex(const o2::framework::ConfigContext &configcontext, o2::framework::WorkflowSpec &specs, bool mc)
static void addGlobalOptions(std::vector< o2::framework::ConfigParamSpec > &options)
static CorrectionMapsGloOpts 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 ITS Vertex explicitly as messageable.
Definition Cartesian.h:288
std::vector< DataProcessorSpec > WorkflowSpec
framework::DataProcessorSpec getTrackCosmicsWriterSpec(bool useMC)
framework::DataProcessorSpec getCosmicsMatchingSpec(o2::dataformats::GlobalTrackID::mask_t src, bool usePV, bool useMC)
create a processor spec
@ TPCScaler
use TPC scaler for scaling
o2::framework::DataProcessorSpec getTPCScalerSpec(bool enableIDCs, bool enableMShape, const o2::tpc::CorrectionMapsGloOpts &sclOpts)
static CompletionPolicy consumeWhenAllOrdered(const char *name, CompletionPolicy::Matcher matcher)
as consumeWhenAll, but ensures that records are processed with incremental timeSlice (DataHeader::sta...
static void addITSConfigOption(std::vector< o2::framework::ConfigParamSpec > &opts)
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))