forked from AliceO2Group/AliceO2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstandalone-postprocessing-workflow.cxx
More file actions
145 lines (134 loc) · 7.59 KB
/
Copy pathstandalone-postprocessing-workflow.cxx
File metadata and controls
145 lines (134 loc) · 7.59 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
140
141
142
143
144
145
// 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 "Framework/CallbacksPolicy.h"
#include "CommonUtils/ConfigurableParam.h"
#include "Framework/CompletionPolicy.h"
#include "Framework/ConfigParamSpec.h"
#include "Framework/CompletionPolicyHelpers.h"
#include "GlobalTrackingWorkflowHelpers/InputHelper.h"
#include "DetectorsRaw/HBFUtilsInitializer.h"
#include "DataFormatsITSMFT/DPLAlpideParamInitializer.h"
// Include studies hereafter
#include "ITSStudies/ImpactParameter.h"
#include "ITSStudies/AvgClusSize.h"
#include "ITSStudies/PIDStudy.h"
#include "ITSStudies/AnomalyStudy.h"
#include "ITSStudies/Efficiency.h"
#include "ITSStudies/TrackCheck.h"
#include "ITSStudies/TrackExtension.h"
#include "Steer/MCKinematicsReader.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);
}
// 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{
{"input-from-upstream", VariantType::Bool, false, {"read clusters from the clusterer"}},
{"track-sources", VariantType::String, std::string{"ITS,ITS-TPC-TRD-TOF,ITS-TPC-TOF,ITS-TPC,ITS-TPC-TRD"}, {"comma-separated list of track sources to use"}},
{"cluster-sources", VariantType::String, std::string{"ITS"}, {"comma-separated list of cluster sources to use"}},
{"disable-root-input", VariantType::Bool, false, {"disable root-files input reader"}},
{"disable-mc", VariantType::Bool, false, {"disable MC propagation even if available"}},
{"cluster-size-study", VariantType::Bool, false, {"Perform the average cluster size study"}},
{"pid-study", VariantType::Bool, false, {"Perform the PID study"}},
{"track-study", VariantType::Bool, false, {"Perform the track study"}},
{"impact-parameter-study", VariantType::Bool, false, {"Perform the impact parameter study"}},
{"anomaly-study", VariantType::Bool, false, {"Perform the anomaly study"}},
{"track-extension-study", VariantType::Bool, false, {"Perform the track extension study"}},
{"efficiency-study", VariantType::Bool, false, {"Perform the efficiency study"}},
{"configKeyValues", VariantType::String, "", {"Semicolon separated key=value strings ..."}}};
o2::itsmft::DPLAlpideParamInitializer::addITSConfigOption(options);
// o2::raw::HBFUtilsInitializer::addConfigOption(options, "o2_tfidinfo.root");
std::swap(workflowOptions, options);
}
#include <Framework/runDataProcessing.h>
WorkflowSpec defineDataProcessing(ConfigContext const& configcontext)
{
WorkflowSpec specs;
GID::mask_t srcTrc, srcCls;
o2::conf::ConfigurableParam::updateFromString(configcontext.options().get<std::string>("configKeyValues"));
auto useMC = !configcontext.options().get<bool>("disable-mc");
std::shared_ptr<o2::steer::MCKinematicsReader> mcKinematicsReader;
if (useMC) {
mcKinematicsReader = std::make_shared<o2::steer::MCKinematicsReader>("collisioncontext.root");
}
bool anyStudy{false};
// Declare specs related to studies hereafter
if (configcontext.options().get<bool>("impact-parameter-study")) {
anyStudy = true;
srcTrc = GID::getSourcesMask(configcontext.options().get<std::string>("track-sources"));
srcCls = GID::getSourcesMask(configcontext.options().get<std::string>("cluster-sources"));
o2::globaltracking::InputHelper::addInputSpecs(configcontext, specs, srcCls, srcTrc, srcTrc, useMC, srcCls, srcTrc);
specs.emplace_back(o2::its::study::getImpactParameterStudy(srcTrc, srcCls, useMC));
}
if (configcontext.options().get<bool>("cluster-size-study")) {
anyStudy = true;
srcTrc = GID::getSourcesMask(configcontext.options().get<std::string>("track-sources"));
srcCls = GID::getSourcesMask(configcontext.options().get<std::string>("cluster-sources"));
o2::globaltracking::InputHelper::addInputSpecs(configcontext, specs, srcCls, srcTrc, srcTrc, useMC, srcCls, srcTrc);
specs.emplace_back(o2::its::study::getAvgClusSizeStudy(srcTrc, srcCls, useMC, mcKinematicsReader));
}
if (configcontext.options().get<bool>("pid-study")) {
anyStudy = true;
srcTrc = GID::getSourcesMask(configcontext.options().get<std::string>("track-sources"));
srcCls = GID::getSourcesMask(configcontext.options().get<std::string>("cluster-sources"));
o2::globaltracking::InputHelper::addInputSpecs(configcontext, specs, srcCls, srcTrc, srcTrc, useMC, srcCls, srcTrc);
specs.emplace_back(o2::its::study::getPIDStudy(srcTrc, srcCls, useMC, mcKinematicsReader));
}
if (configcontext.options().get<bool>("track-study")) {
anyStudy = true;
srcTrc = GID::getSourcesMask(configcontext.options().get<std::string>("track-sources"));
srcCls = GID::getSourcesMask(configcontext.options().get<std::string>("cluster-sources"));
if (!configcontext.options().get<bool>("input-from-upstream")) {
o2::globaltracking::InputHelper::addInputSpecs(configcontext, specs, srcCls, srcTrc, srcTrc, useMC, srcCls, srcTrc);
}
specs.emplace_back(o2::its::study::getTrackCheckStudy(GID::getSourcesMask("ITS"), GID::getSourcesMask("ITS"), useMC, mcKinematicsReader));
}
if (configcontext.options().get<bool>("anomaly-study")) {
anyStudy = true;
srcCls = GID::getSourcesMask(configcontext.options().get<std::string>("cluster-sources"));
if (!configcontext.options().get<bool>("input-from-upstream")) {
o2::globaltracking::InputHelper::addInputSpecs(configcontext, specs, srcCls, srcTrc, srcTrc, useMC, srcCls, srcTrc);
}
specs.emplace_back(o2::its::study::getAnomalyStudy(srcCls, useMC));
}
if (configcontext.options().get<bool>("track-extension-study")) {
if (!useMC) {
LOGP(fatal, "Track Extension Study needs MC!");
}
anyStudy = true;
srcTrc = GID::getSourcesMask(configcontext.options().get<std::string>("track-sources"));
srcCls = GID::getSourcesMask("ITS");
o2::globaltracking::InputHelper::addInputSpecs(configcontext, specs, srcCls, srcTrc, srcTrc, true, srcCls, srcTrc);
specs.emplace_back(o2::its::study::getTrackExtensionStudy(srcTrc, srcCls, mcKinematicsReader));
}
if (configcontext.options().get<bool>("efficiency-study")) {
anyStudy = true;
srcTrc = GID::getSourcesMask(configcontext.options().get<std::string>("track-sources"));
srcCls = GID::getSourcesMask(configcontext.options().get<std::string>("cluster-sources"));
if (!configcontext.options().get<bool>("input-from-upstream")) {
o2::globaltracking::InputHelper::addInputSpecs(configcontext, specs, srcCls, srcTrc, srcTrc, useMC, srcCls, srcTrc);
}
specs.emplace_back(o2::its::study::getEfficiencyStudy(GID::getSourcesMask("ITS"), GID::getSourcesMask("ITS"), useMC, mcKinematicsReader));
}
if (!anyStudy) {
LOGP(info, "No study selected, dryrunning");
}
// o2::raw::HBFUtilsInitializer hbfIni(configcontext, specs);
// write the configuration used for the studies workflow
o2::conf::ConfigurableParam::writeINI("o2_its_standalone_configuration.ini");
return std::move(specs);
}