-
Notifications
You must be signed in to change notification settings - Fork 494
Expand file tree
/
Copy pathsecondary-vertexing-workflow.cxx
More file actions
139 lines (126 loc) · 7.03 KB
/
secondary-vertexing-workflow.cxx
File metadata and controls
139 lines (126 loc) · 7.03 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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
// 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 "GlobalTrackingWorkflow/SecondaryVertexingSpec.h"
#include "GlobalTrackingWorkflow/SecondaryVertexWriterSpec.h"
#include "GlobalTrackingWorkflow/StrangenessTrackingWriterSpec.h"
#include "GlobalTrackingWorkflowReaders/TrackTPCITSReaderSpec.h"
#include "GlobalTrackingWorkflowReaders/PrimaryVertexReaderSpec.h"
#include "GlobalTrackingWorkflowHelpers/InputHelper.h"
#include "ITSWorkflow/TrackReaderSpec.h"
#include "TPCReaderWorkflow/TrackReaderSpec.h"
#include "TPCWorkflow/TPCScalerSpec.h"
#include "TOFWorkflowIO/TOFMatchedReaderSpec.h"
#include "TOFWorkflowIO/ClusterReaderSpec.h"
#include "ReconstructionDataFormats/GlobalTrackID.h"
#include "DetectorsCommonDataFormats/DetID.h"
#include "CommonUtils/ConfigurableParam.h"
#include "DetectorsRaw/HBFUtilsInitializer.h"
#include "Framework/CallbacksPolicy.h"
#include "Framework/CompletionPolicy.h"
#include "Framework/ConfigParamSpec.h"
#include "Framework/CompletionPolicyHelpers.h"
#include "DetectorsBase/DPLWorkflowUtils.h"
#include "TPCCalibration/CorrectionMapsLoader.h"
using namespace o2::framework;
using GID = o2::dataformats::GlobalTrackID;
using DetID = o2::detectors::DetID;
// ------------------------------------------------------------------
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(".*secondary-vertex-writer.*"));
}
// we need to add workflow options before including Framework/runDataProcessing
void customize(std::vector<ConfigParamSpec>& workflowOptions)
{
// option allowing to set parameters
std::vector<o2::framework::ConfigParamSpec> options{
{"disable-root-input", o2::framework::VariantType::Bool, false, {"disable root-files input reader"}},
{"disable-root-output", o2::framework::VariantType::Bool, false, {"disable root-files output writer"}},
{"disable-mc", o2::framework::VariantType::Bool, false, {"disable MC (relevant for strangeness tracker only))"}},
{"vertexing-sources", VariantType::String, std::string{GID::ALL}, {"comma-separated list of sources to use in vertexing"}},
{"disable-cascade-finder", o2::framework::VariantType::Bool, false, {"do not run cascade finder"}},
{"disable-3body-finder", o2::framework::VariantType::Bool, false, {"do not run 3 body finder"}},
{"disable-strangeness-tracker", o2::framework::VariantType::Bool, false, {"do not run strangeness tracker"}},
{"disable-ccdb-params", o2::framework::VariantType::Bool, false, {"do not load the svertexer parameters from the ccdb"}},
{"use-full-geometry", o2::framework::VariantType::Bool, false, {"use full geometry instead of the light-weight ITS part"}},
{"configKeyValues", VariantType::String, "", {"Semicolon separated key=value strings ..."}},
{"combine-source-devices", o2::framework::VariantType::Bool, false, {"merge DPL source devices"}}};
o2::tpc::CorrectionMapsLoader::addGlobalOptions(options);
o2::raw::HBFUtilsInitializer::addConfigOption(options);
std::swap(workflowOptions, options);
}
// ------------------------------------------------------------------
#include "Framework/runDataProcessing.h"
WorkflowSpec defineDataProcessing(ConfigContext const& configcontext)
{
GID::mask_t allowedSources = GID::getSourcesMask("ITS,TPC,ITS-TPC,TPC-TOF,TPC-TRD,ITS-TPC-TRD,ITS-TPC-TOF,TPC-TRD-TOF,ITS-TPC-TRD-TOF");
// Update the (declared) parameters if changed from the command line
o2::conf::ConfigurableParam::updateFromString(configcontext.options().get<std::string>("configKeyValues"));
// write the configuration used for the workflow
o2::conf::ConfigurableParam::writeINI("o2secondary-vertexing-workflow_configuration.ini");
bool useMC = !configcontext.options().get<bool>("disable-mc");
auto disableRootOut = configcontext.options().get<bool>("disable-root-output");
auto enableCCDBParams = !configcontext.options().get<bool>("disable-ccdb-params");
auto enableCasc = !configcontext.options().get<bool>("disable-cascade-finder");
auto enable3body = !configcontext.options().get<bool>("disable-3body-finder");
auto enableStrTr = !configcontext.options().get<bool>("disable-strangeness-tracker");
auto useGeom = configcontext.options().get<bool>("use-full-geometry");
auto sclOpt = o2::tpc::CorrectionMapsLoader::parseGlobalOptions(configcontext.options());
GID::mask_t src = allowedSources & GID::getSourcesMask(configcontext.options().get<std::string>("vertexing-sources"));
GID::mask_t dummy, srcClus = GID::includesDet(DetID::TOF, src) ? GID::getSourceMask(GID::TOF) : dummy; // eventually, TPC clusters will be needed for refit
if (enableStrTr) {
srcClus |= GID::getSourceMask(GID::ITS);
}
if (src[GID::TPC]) {
srcClus |= GID::getSourceMask(GID::TPC);
if (sclOpt.requestCTPLumi) {
src = src | GID::getSourcesMask("CTP");
}
}
WorkflowSpec specs;
if (sclOpt.needTPCScalersWorkflow() && !configcontext.options().get<bool>("disable-root-input")) {
specs.emplace_back(o2::tpc::getTPCScalerSpec(sclOpt.lumiType == 2, sclOpt.enableMShapeCorrection));
}
specs.emplace_back(o2::vertexing::getSecondaryVertexingSpec(src, enableCasc, enable3body, enableStrTr, enableCCDBParams, useMC, useGeom, sclOpt));
// only TOF clusters are needed if TOF is involved, no clusters MC needed
WorkflowSpec inputspecs;
o2::globaltracking::InputHelper::addInputSpecs(configcontext, inputspecs, srcClus, src, src, useMC, srcClus);
o2::globaltracking::InputHelper::addInputSpecsPVertex(configcontext, inputspecs, useMC); // P-vertex is always needed
if (configcontext.options().get<bool>("combine-source-devices")) {
std::vector<DataProcessorSpec> unmerged;
specs.push_back(specCombiner("SV-Input-Reader", inputspecs, unmerged));
if (unmerged.size() > 0) {
// LOG(fatal) << "unexpected DPL merge error";
for (auto& s : unmerged) {
specs.push_back(s);
LOG(info) << " adding unmerged spec " << s.name;
}
}
} else {
for (auto& s : inputspecs) {
specs.push_back(s);
}
}
if (!disableRootOut) {
specs.emplace_back(o2::vertexing::getSecondaryVertexWriterSpec());
if (enableStrTr) {
specs.emplace_back(o2::strangeness_tracking::getStrangenessTrackingWriterSpec(useMC));
}
}
// configure dpl timer to inject correct firstTForbit: start from the 1st orbit of TF containing 1st sampled orbit
o2::raw::HBFUtilsInitializer hbfIni(configcontext, specs);
return std::move(specs);
}