Project
Loading...
Searching...
No Matches
barrel-alignment-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
13
31
37
38using namespace o2::framework;
41// ------------------------------------------------------------------
42
43void customize(std::vector<o2::framework::CallbacksPolicy>& policies)
44{
46}
47
48// we need to add workflow options before including Framework/runDataProcessing
49void customize(std::vector<o2::framework::ConfigParamSpec>& workflowOptions)
50{
51 // option allowing to set parameters
52 std::vector<o2::framework::ConfigParamSpec> options{
53 {"disable-root-input", o2::framework::VariantType::Bool, false, {"disable root-files input reader"}},
54 {"disable-root-output", o2::framework::VariantType::Bool, false, {"disable root-files output writer"}},
55 {"enable-mc", o2::framework::VariantType::Bool, false, {"enable MC-info checks"}},
56 {"track-sources", VariantType::String, std::string{GID::ALL}, {"comma-separated list of sources to use"}},
57 {"detectors", VariantType::String, std::string{"ITS,TPC,TRD,TOF"}, {"comma-separated list of detectors"}},
58 {"enable-tpc-tracks", VariantType::Bool, false, {"allow reading TPC tracks"}},
59 {"enable-tpc-clusters", VariantType::Bool, false, {"allow reading TPC clusters (will trigger TPC tracks reading)"}},
60 {"enable-cosmic", VariantType::Bool, false, {"enable cosmic tracks)"}},
61 {"postprocessing", VariantType::Int, 0, {"postprocessing bits: 1 - extract alignment objects, 2 - check constraints, 4 - print mpParams/Constraints, 8 - relabel pede results"}},
62 {"configKeyValues", VariantType::String, "", {"Semicolon separated key=value strings ..."}}};
66 std::swap(workflowOptions, options);
67}
68
69// the matcher process requires the TPC sector completion to trigger and data on all defined routes
70void customize(std::vector<o2::framework::CompletionPolicy>& policies)
71{
72 // the TPC sector completion policy checks when the set of TPC/CLUSTERNATIVE data is complete
73 // in addition we require to have input from all other routes
74 policies.push_back(o2::tpc::TPCSectorCompletionPolicy("barrel-alignment",
76 InputSpec{"cluster", o2::framework::ConcreteDataTypeMatcher{"TPC", "CLUSTERNATIVE"}})());
77}
78
79// ------------------------------------------------------------------
80
82
84{
85 WorkflowSpec specs;
86 GID::mask_t alowedSources = GID::getSourcesMask("ITS,TPC,TRD,ITS-TPC,TPC-TOF,TPC-TRD,ITS-TPC-TRD,TPC-TRD-TOF,ITS-TPC-TOF,ITS-TPC-TRD-TOF");
87 DetID::mask_t allowedDets = DetID::getMask("ITS,TPC,TRD,TOF");
88
89 // Update the (declared) parameters if changed from the command line
90 o2::conf::ConfigurableParam::updateFromString(configcontext.options().get<std::string>("configKeyValues"));
91 int postprocess = configcontext.options().get<int>("postprocessing");
92
93 auto disableRootOut = configcontext.options().get<bool>("disable-root-output");
94 bool loadTPCClusters = configcontext.options().get<bool>("enable-tpc-clusters");
95 bool loadTPCTracks = configcontext.options().get<bool>("enable-tpc-tracks");
96 bool enableCosmic = configcontext.options().get<bool>("enable-cosmic");
97 bool useMC = configcontext.options().get<bool>("enable-mc");
98
99 DetID::mask_t dets = allowedDets & DetID::getMask(configcontext.options().get<std::string>("detectors"));
100 DetID::mask_t skipDetClusters; // optionally skip automatically loaded clusters
101 GID::mask_t src = alowedSources & GID::getSourcesMask(configcontext.options().get<std::string>("track-sources"));
102 GID::mask_t srcCl{}, srcMP = src; // we may need to load more track types than requested to satisfy dependencies, but only those will be fed to millipede
103
104 if (dets[DetID::TPC]) {
105 loadTPCClusters = loadTPCTracks = true;
106 }
107 auto sclOpt = o2::tpc::CorrectionMapsLoader::parseGlobalOptions(configcontext.options());
108 if (!postprocess) { // this part is needed only if the data should be read
109 if (GID::includesDet(DetID::ITS, src)) {
110 src |= GID::getSourceMask(GID::ITS);
111 srcCl |= GID::getSourceMask(GID::ITS);
112 LOG(info) << "adding ITS request";
113 }
114
115 if (GID::includesDet(DetID::TPC, src)) {
116 if (loadTPCTracks || loadTPCClusters) {
117 src |= GID::getSourceMask(GID::TPC);
118 LOG(info) << "adding TPC request";
119 }
120 if (loadTPCClusters) {
121 srcCl |= GID::getSourceMask(GID::TPC);
122 } else {
123 skipDetClusters |= DetID::getMask(DetID::TPC);
124 LOG(info) << "Skipping TPC clusters";
125 }
126 }
127 if (GID::includesDet(DetID::TRD, src)) {
128 src |= GID::getSourceMask(GID::TRD);
129 srcCl |= GID::getSourceMask(GID::TRD);
130 if (GID::includesDet(DetID::ITS, src)) {
131 src |= GID::getSourceMask(GID::ITSTPC);
132 }
133 LOG(info) << "adding TRD request";
134 }
135 if (GID::includesDet(DetID::TOF, src)) {
136 src |= GID::getSourceMask(GID::TOF);
137 srcCl |= GID::getSourceMask(GID::TOF);
138 if (GID::includesDet(DetID::ITS, src)) {
139 src |= GID::getSourceMask(GID::ITSTPC);
140 }
141 if (GID::includesDet(DetID::TRD, src)) {
142 src |= GID::getSourceMask(GID::ITSTPCTRD);
143 }
144 LOG(info) << "adding TOF request";
145 }
146 if (sclOpt.requestCTPLumi) {
147 src = src | GID::getSourcesMask("CTP");
148 }
149 // write the configuration used for the workflow
150 o2::conf::ConfigurableParam::writeINI("o2_barrel_alignment_configuration.ini");
151 }
152
153 if (sclOpt.needTPCScalersWorkflow() && !configcontext.options().get<bool>("disable-root-input")) {
154 specs.emplace_back(o2::tpc::getTPCScalerSpec(sclOpt.lumiType == 2, sclOpt.enableMShapeCorrection));
155 }
156
157 specs.emplace_back(o2::align::getBarrelAlignmentSpec(srcMP, src, dets, skipDetClusters, enableCosmic, postprocess, useMC, sclOpt));
158 // RS FIXME: check which clusters are really needed
159 if (!postprocess) {
160 GID::mask_t dummy;
161 o2::globaltracking::InputHelper::addInputSpecs(configcontext, specs, srcCl, src, src, useMC, dummy); // clusters MC is not needed
163 if (enableCosmic) {
165 }
166 } else { // add dummy driver
167 specs.emplace_back(o2::globaltracking::getNoInpDummyOutSpec(0));
168 }
169
170 // configure dpl timer to inject correct firstTForbit: start from the 1st orbit of TF containing 1st sampled orbit
171 o2::raw::HBFUtilsInitializer hbfIni(configcontext, specs);
172 return std::move(specs);
173}
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.
WorkflowSpec defineDataProcessing(ConfigContext const &configcontext)
void customize(std::vector< o2::framework::CallbacksPolicy > &policies)
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 ITS
Definition DetID.h:63
static constexpr ID TRD
Definition DetID.h:65
static constexpr ID TPC
Definition DetID.h:64
static mask_t getMask(const std::string_view detList)
detector masks from any non-alpha-num delimiter-separated list (empty if NONE is supplied)
Definition DetID.cxx:42
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 addInputSpecsCosmics(const o2::framework::ConfigContext &configcontext, o2::framework::WorkflowSpec &specs, bool mc)
static int addInputSpecsPVertex(const o2::framework::ConfigContext &configcontext, o2::framework::WorkflowSpec &specs, bool mc)
static void addGlobalOptions(std::vector< o2::framework::ConfigParamSpec > &options)
static CorrectionMapsLoaderGloOpts parseGlobalOptions(const o2::framework::ConfigParamRegistry &opts)
GLenum src
Definition glcorearb.h:1767
framework::DataProcessorSpec getBarrelAlignmentSpec(o2::dataformats::GlobalTrackID::mask_t srcMP, o2::dataformats::GlobalTrackID::mask_t src, o2::detectors::DetID::mask_t dets, o2::detectors::DetID::mask_t skipDetClusters, bool enableCosmic, int postproc, bool useMC, const o2::tpc::CorrectionMapsLoaderGloOpts &sclOpts)
create a processor spec
Defining ITS Vertex explicitly as messageable.
Definition Cartesian.h:288
std::vector< DataProcessorSpec > WorkflowSpec
framework::DataProcessorSpec getNoInpDummyOutSpec(int nloop=-1)
create a processor spec
o2::framework::DataProcessorSpec getTPCScalerSpec(bool enableIDCs, bool enableMShape)
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))
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"