Project
Loading...
Searching...
No Matches
standalone-postprocessing-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
19
20// Include studies hereafter
23#include "ITSStudies/PIDStudy.h"
29
30using namespace o2::framework;
33
34void customize(std::vector<o2::framework::CallbacksPolicy>& policies)
35{
37}
38
39// we need to add workflow options before including Framework/runDataProcessing
40void customize(std::vector<ConfigParamSpec>& workflowOptions)
41{
42 // option allowing to set parameters
43 std::vector<o2::framework::ConfigParamSpec> options{
44 {"input-from-upstream", VariantType::Bool, false, {"read clusters from the clusterer"}},
45 {"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"}},
46 {"cluster-sources", VariantType::String, std::string{"ITS"}, {"comma-separated list of cluster sources to use"}},
47 {"disable-root-input", VariantType::Bool, false, {"disable root-files input reader"}},
48 {"disable-mc", VariantType::Bool, false, {"disable MC propagation even if available"}},
49 {"cluster-size-study", VariantType::Bool, false, {"Perform the average cluster size study"}},
50 {"pid-study", VariantType::Bool, false, {"Perform the PID study"}},
51 {"track-study", VariantType::Bool, false, {"Perform the track study"}},
52 {"impact-parameter-study", VariantType::Bool, false, {"Perform the impact parameter study"}},
53 {"anomaly-study", VariantType::Bool, false, {"Perform the anomaly study"}},
54 {"track-extension-study", VariantType::Bool, false, {"Perform the track extension study"}},
55 {"efficiency-study", VariantType::Bool, false, {"Perform the efficiency study"}},
56 {"configKeyValues", VariantType::String, "", {"Semicolon separated key=value strings ..."}}};
57 // o2::raw::HBFUtilsInitializer::addConfigOption(options, "o2_tfidinfo.root");
58 std::swap(workflowOptions, options);
59}
60
62
64{
65 WorkflowSpec specs;
66 GID::mask_t srcTrc, srcCls;
67
68 o2::conf::ConfigurableParam::updateFromString(configcontext.options().get<std::string>("configKeyValues"));
69 auto useMC = !configcontext.options().get<bool>("disable-mc");
70
71 std::shared_ptr<o2::steer::MCKinematicsReader> mcKinematicsReader;
72 if (useMC) {
73 mcKinematicsReader = std::make_shared<o2::steer::MCKinematicsReader>("collisioncontext.root");
74 }
75 bool anyStudy{false};
76 // Declare specs related to studies hereafter
77 if (configcontext.options().get<bool>("impact-parameter-study")) {
78 anyStudy = true;
79 srcTrc = GID::getSourcesMask(configcontext.options().get<std::string>("track-sources"));
80 srcCls = GID::getSourcesMask(configcontext.options().get<std::string>("cluster-sources"));
81 o2::globaltracking::InputHelper::addInputSpecs(configcontext, specs, srcCls, srcTrc, srcTrc, useMC, srcCls, srcTrc);
82 specs.emplace_back(o2::its::study::getImpactParameterStudy(srcTrc, srcCls, useMC));
83 }
84 if (configcontext.options().get<bool>("cluster-size-study")) {
85 anyStudy = true;
86 srcTrc = GID::getSourcesMask(configcontext.options().get<std::string>("track-sources"));
87 srcCls = GID::getSourcesMask(configcontext.options().get<std::string>("cluster-sources"));
88 o2::globaltracking::InputHelper::addInputSpecs(configcontext, specs, srcCls, srcTrc, srcTrc, useMC, srcCls, srcTrc);
89 specs.emplace_back(o2::its::study::getAvgClusSizeStudy(srcTrc, srcCls, useMC, mcKinematicsReader));
90 }
91 if (configcontext.options().get<bool>("pid-study")) {
92 anyStudy = true;
93 srcTrc = GID::getSourcesMask(configcontext.options().get<std::string>("track-sources"));
94 srcCls = GID::getSourcesMask(configcontext.options().get<std::string>("cluster-sources"));
95 o2::globaltracking::InputHelper::addInputSpecs(configcontext, specs, srcCls, srcTrc, srcTrc, useMC, srcCls, srcTrc);
96 specs.emplace_back(o2::its::study::getPIDStudy(srcTrc, srcCls, useMC, mcKinematicsReader));
97 }
98 if (configcontext.options().get<bool>("track-study")) {
99 anyStudy = true;
100 srcTrc = GID::getSourcesMask(configcontext.options().get<std::string>("track-sources"));
101 srcCls = GID::getSourcesMask(configcontext.options().get<std::string>("cluster-sources"));
102 if (!configcontext.options().get<bool>("input-from-upstream")) {
103 o2::globaltracking::InputHelper::addInputSpecs(configcontext, specs, srcCls, srcTrc, srcTrc, useMC, srcCls, srcTrc);
104 }
105 specs.emplace_back(o2::its::study::getTrackCheckStudy(GID::getSourcesMask("ITS"), GID::getSourcesMask("ITS"), useMC, mcKinematicsReader));
106 }
107 if (configcontext.options().get<bool>("anomaly-study")) {
108 anyStudy = true;
109 srcCls = GID::getSourcesMask(configcontext.options().get<std::string>("cluster-sources"));
110 if (!configcontext.options().get<bool>("input-from-upstream")) {
111 o2::globaltracking::InputHelper::addInputSpecs(configcontext, specs, srcCls, srcTrc, srcTrc, useMC, srcCls, srcTrc);
112 }
113 specs.emplace_back(o2::its::study::getAnomalyStudy(srcCls, useMC));
114 }
115 if (configcontext.options().get<bool>("track-extension-study")) {
116 if (!useMC) {
117 LOGP(fatal, "Track Extension Study needs MC!");
118 }
119 anyStudy = true;
120 srcTrc = GID::getSourcesMask(configcontext.options().get<std::string>("track-sources"));
121 srcCls = GID::getSourcesMask("ITS");
122 o2::globaltracking::InputHelper::addInputSpecs(configcontext, specs, srcCls, srcTrc, srcTrc, true, srcCls, srcTrc);
123 specs.emplace_back(o2::its::study::getTrackExtensionStudy(srcTrc, srcCls, mcKinematicsReader));
124 }
125 if (configcontext.options().get<bool>("efficiency-study")) {
126 anyStudy = true;
127 srcTrc = GID::getSourcesMask(configcontext.options().get<std::string>("track-sources"));
128 srcCls = GID::getSourcesMask(configcontext.options().get<std::string>("cluster-sources"));
129 if (!configcontext.options().get<bool>("input-from-upstream")) {
130 o2::globaltracking::InputHelper::addInputSpecs(configcontext, specs, srcCls, srcTrc, srcTrc, useMC, srcCls, srcTrc);
131 }
132 specs.emplace_back(o2::its::study::getEfficiencyStudy(GID::getSourcesMask("ITS"), GID::getSourcesMask("ITS"), useMC, mcKinematicsReader));
133 }
134 if (!anyStudy) {
135 LOGP(info, "No study selected, dryrunning");
136 }
137
138 o2::raw::HBFUtilsInitializer hbfIni(configcontext, specs);
139 // write the configuration used for the studies workflow
140 o2::conf::ConfigurableParam::writeINI("o2_its_standalone_configuration.ini");
141
142 return std::move(specs);
143}
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 class with identifiers, bitmasks and names for ALICE detectors.
Definition DetID.h:58
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)
Defining PrimaryVertex explicitly as messageable.
Definition TFIDInfo.h:20
std::vector< DataProcessorSpec > WorkflowSpec
o2::framework::DataProcessorSpec getPIDStudy(mask_t srcTracksMask, mask_t srcClustersMask, bool useMC, std::shared_ptr< o2::steer::MCKinematicsReader > kineReader)
Definition PIDStudy.cxx:327
o2::framework::DataProcessorSpec getTrackCheckStudy(mask_t srcTracksMask, mask_t srcClustersMask, bool useMC, std::shared_ptr< o2::steer::MCKinematicsReader > kineReader)
o2::framework::DataProcessorSpec getTrackExtensionStudy(mask_t srcTracksMask, mask_t srcClustersMask, std::shared_ptr< o2::steer::MCKinematicsReader > kineReader)
o2::framework::DataProcessorSpec getAnomalyStudy(mask_t srcClustersMask, bool useMC)
o2::framework::DataProcessorSpec getEfficiencyStudy(mask_t srcTracksMask, mask_t srcClustersMask, bool useMC, std::shared_ptr< o2::steer::MCKinematicsReader > kineReader)
o2::framework::DataProcessorSpec getAvgClusSizeStudy(mask_t srcTracksMask, mask_t srcClustersMask, bool useMC, std::shared_ptr< o2::steer::MCKinematicsReader > kineReader)
o2::framework::DataProcessorSpec getImpactParameterStudy(mask_t srcTracksMask, mask_t srcClusMask, bool useMC=false)
WorkflowSpec defineDataProcessing(ConfigContext const &configcontext)
void customize(std::vector< o2::framework::CallbacksPolicy > &policies)
static void addNewTimeSliceCallback(std::vector< o2::framework::CallbacksPolicy > &policies)