forked from AliceO2Group/AliceO2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtpcits-match-workflow.cxx
More file actions
112 lines (98 loc) · 6.1 KB
/
tpcits-match-workflow.cxx
File metadata and controls
112 lines (98 loc) · 6.1 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
// 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 "TPCWorkflow/ClusterSharingMapSpec.h"
#include "TPCWorkflow/TPCScalerSpec.h"
#include "GlobalTrackingWorkflow/TPCITSMatchingSpec.h"
#include "GlobalTrackingWorkflow/TrackWriterTPCITSSpec.h"
#include "GlobalTrackingWorkflowHelpers/InputHelper.h"
#include "ReconstructionDataFormats/GlobalTrackID.h"
#include "DetectorsCommonDataFormats/DetID.h"
#include "CommonUtils/ConfigurableParam.h"
#include "Framework/CompletionPolicy.h"
#include "TPCReaderWorkflow/TPCSectorCompletionPolicy.h"
#include "DetectorsRaw/HBFUtilsInitializer.h"
#include "Framework/CallbacksPolicy.h"
#include "Framework/ConfigContext.h"
#include "Framework/CompletionPolicyHelpers.h"
#include "TPCCalibration/CorrectionMapsLoader.h"
#include "DataFormatsITSMFT/DPLAlpideParamInitializer.h"
using namespace o2::framework;
using GID = o2::dataformats::GlobalTrackID;
void customize(std::vector<o2::framework::CallbacksPolicy>& policies)
{
o2::raw::HBFUtilsInitializer::addNewTimeSliceCallback(policies);
}
void customize(std::vector<o2::framework::ConfigParamSpec>& workflowOptions)
{
// option allowing to set parameters
std::vector<o2::framework::ConfigParamSpec> options{
{"use-ft0", o2::framework::VariantType::Bool, false, {"use FT0 in matching"}},
{"disable-mc", o2::framework::VariantType::Bool, false, {"disable MC propagation even if available"}},
{"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"}},
{"track-sources", VariantType::String, "TPC", {"comma-separated list of sources to use: TPC,TPC-TOF,TPC-TRD,TPC-TRD-TOF"}},
{"produce-calibration-data", o2::framework::VariantType::Bool, false, {"produce output for TPC vdrift calibration"}},
{"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 ..."}}};
o2::itsmft::DPLAlpideParamInitializer::addITSConfigOption(options);
o2::tpc::CorrectionMapsLoader::addGlobalOptions(options);
o2::raw::HBFUtilsInitializer::addConfigOption(options);
std::swap(workflowOptions, options);
}
// the matcher process requires the TPC sector completion to trigger and data on
// all defined routes
void customize(std::vector<o2::framework::CompletionPolicy>& policies)
{
// the TPC sector completion policy checks when the set of TPC/CLUSTERNATIVE data is complete
// in addition we require to have input from all other routes
policies.push_back(o2::tpc::TPCSectorCompletionPolicy("itstpc-track-matcher",
o2::tpc::TPCSectorCompletionPolicy::Config::RequireAll,
o2::framework::InputSpec{"cluster", o2::framework::ConcreteDataTypeMatcher{"TPC", "CLUSTERNATIVE"}})());
policies.push_back(CompletionPolicyHelpers::consumeWhenAllOrdered(".*itstpc-track-writer.*"));
}
// ------------------------------------------------------------------
#include "Framework/runDataProcessing.h"
WorkflowSpec defineDataProcessing(o2::framework::ConfigContext const& configcontext)
{
// 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("o2matchtpcits-workflow_configuration.ini");
GID::mask_t alowedSources = GID::getSourcesMask("ITS,TPC,TPC-TOF");
GID::mask_t src = alowedSources & GID::getSourcesMask(configcontext.options().get<std::string>("track-sources"));
bool needStrictTRDTOF = (src & GID::getSourcesMask("TPC-TRD,TPC-TOF,TPC-TRD-TOF")).any();
auto doStag = o2::itsmft::DPLAlpideParamInitializer::isITSStaggeringEnabled(configcontext); // RS at the moment is not passed to the matching w-flow
auto sclOpt = o2::tpc::CorrectionMapsLoader::parseGlobalOptions(configcontext.options());
auto useGeom = configcontext.options().get<bool>("use-full-geometry");
auto useFT0 = configcontext.options().get<bool>("use-ft0");
if (useFT0) {
src |= GID::getSourceMask(GID::FT0);
}
auto useMC = !configcontext.options().get<bool>("disable-mc");
auto calib = configcontext.options().get<bool>("produce-calibration-data");
auto srcL = src | GID::getSourcesMask("ITS,TPC"); // ITS is needed always, TPC must be loaded even if bare TPC tracks are not used in matching
if (sclOpt.requestCTPLumi) {
srcL = srcL | GID::getSourcesMask("CTP");
}
o2::framework::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::globaltracking::getTPCITSMatchingSpec(srcL, useFT0, calib, !GID::includesSource(GID::TPC, src), useGeom, useMC, sclOpt));
if (!configcontext.options().get<bool>("disable-root-output")) {
specs.emplace_back(o2::globaltracking::getTrackWriterTPCITSSpec(useMC));
}
// the only clusters MC which is need with useMC is ITS (for afterburner), for the rest we use tracks MC labels
o2::globaltracking::InputHelper::addInputSpecs(configcontext, specs, srcL, srcL, srcL, useMC, GID::getSourceMask(GID::ITS), GID::getSourcesMask(GID::ALL), needStrictTRDTOF);
// 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);
}