forked from AliceO2Group/AliceO2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathits-reco-workflow.cxx
More file actions
111 lines (98 loc) · 5.79 KB
/
its-reco-workflow.cxx
File metadata and controls
111 lines (98 loc) · 5.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.
#include "ITSWorkflow/RecoWorkflow.h"
#include "CommonUtils/ConfigurableParam.h"
#include "ITStracking/Configuration.h"
#include "DetectorsRaw/HBFUtilsInitializer.h"
#include "Framework/CallbacksPolicy.h"
#include "Framework/ConfigContext.h"
#include "Framework/CompletionPolicyHelpers.h"
#include <vector>
using namespace o2::framework;
void customize(std::vector<o2::framework::CallbacksPolicy>& policies)
{
o2::raw::HBFUtilsInitializer::addNewTimeSliceCallback(policies);
}
void customize(std::vector<o2::framework::CompletionPolicy>& policies)
{
// ordered policies for the writers
policies.push_back(CompletionPolicyHelpers::consumeWhenAllOrdered(".*(?:ITS|its).*[W,w]riter.*"));
policies.push_back(CompletionPolicyHelpers::consumeWhenAllOrdered(".*irframe-writer.*"));
}
void customize(std::vector<o2::framework::ConfigParamSpec>& workflowOptions)
{
// option allowing to set parameters
std::vector<o2::framework::ConfigParamSpec> options{
{"digits-from-upstream", o2::framework::VariantType::Bool, false, {"digits will be provided from upstream, skip digits reader"}},
{"clusters-from-upstream", o2::framework::VariantType::Bool, false, {"clusters will be provided from upstream, skip clusterizer"}},
{"disable-root-output", o2::framework::VariantType::Bool, false, {"do not write output root files"}},
{"disable-mc", o2::framework::VariantType::Bool, false, {"disable MC propagation even if available"}},
{"trackerCA", o2::framework::VariantType::Bool, false, {"use trackerCA (deprecated)"}}, // keep this around to not break scripts
{"trackerCM", o2::framework::VariantType::Bool, false, {"use trackerCM (default: trackerCA)"}},
{"ccdb-meanvertex-seed", o2::framework::VariantType::Bool, false, {"use MeanVertex from CCDB if available to provide beam position seed (default: false)"}},
{"select-with-triggers", o2::framework::VariantType::String, "none", {"use triggers to prescale processed ROFs: phys, trd, none"}},
{"tracking-mode", o2::framework::VariantType::String, "sync", {"sync,async,cosmics,unset,off"}},
{"disable-tracking", o2::framework::VariantType::Bool, false, {"disable tracking step"}},
{"configKeyValues", VariantType::String, "", {"Semicolon separated key=value strings"}},
{"use-full-geometry", o2::framework::VariantType::Bool, false, {"use full geometry instead of the light-weight ITS part"}},
{"use-gpu-workflow", o2::framework::VariantType::Bool, false, {"use GPU workflow (default: false)"}},
{"gpu-device", o2::framework::VariantType::Int, 1, {"use gpu device: CPU=1,CUDA=2,HIP=3 (default: CPU)"}}};
o2::raw::HBFUtilsInitializer::addConfigOption(options);
std::swap(workflowOptions, options);
}
// ------------------------------------------------------------------
#include "Framework/runDataProcessing.h"
#include "Framework/Logger.h"
WorkflowSpec defineDataProcessing(ConfigContext const& configcontext)
{
// Update the (declared) parameters if changed from the command line
auto useMC = !configcontext.options().get<bool>("disable-mc");
auto beamPosOVerride = configcontext.options().get<bool>("ccdb-meanvertex-seed");
auto useCMtracker = configcontext.options().get<bool>("trackerCM");
auto trmode = configcontext.options().get<std::string>("tracking-mode");
auto selTrig = configcontext.options().get<std::string>("select-with-triggers");
auto useGpuWF = configcontext.options().get<bool>("use-gpu-workflow");
auto gpuDevice = static_cast<o2::gpu::GPUDataTypes::DeviceType>(configcontext.options().get<int>("gpu-device"));
auto extDigits = configcontext.options().get<bool>("digits-from-upstream");
auto extClusters = configcontext.options().get<bool>("clusters-from-upstream");
auto disableRootOutput = configcontext.options().get<bool>("disable-root-output");
auto useGeom = configcontext.options().get<bool>("use-full-geometry");
if (configcontext.options().get<bool>("disable-tracking")) {
trmode = "off";
}
o2::conf::ConfigurableParam::updateFromString(configcontext.options().get<std::string>("configKeyValues"));
int trType = 0;
if (!selTrig.empty() && selTrig != "none") {
if (selTrig == "phys") {
trType = 1;
} else if (selTrig == "trd") {
trType = 2;
} else {
LOG(fatal) << "Unknown trigger type requested for events prescaling: " << selTrig;
}
}
auto wf = o2::its::reco_workflow::getWorkflow(useMC,
useCMtracker,
o2::its::TrackingMode::fromString(trmode),
beamPosOVerride,
extDigits,
extClusters,
disableRootOutput,
useGeom,
trType,
useGpuWF,
gpuDevice);
// configure dpl timer to inject correct firstTForbit: start from the 1st orbit of TF containing 1st sampled orbit
o2::raw::HBFUtilsInitializer hbfIni(configcontext, wf);
// write the configuration used for the reco workflow
o2::conf::ConfigurableParam::writeINI("o2itsrecoflow_configuration.ini");
return std::move(wf);
}