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