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
20
21// Include studies hereafter
24#include "ITSStudies/PIDStudy.h"
31
32using namespace o2::framework;
35
36void customize(std::vector<o2::framework::CallbacksPolicy>& policies)
37{
39}
40
41// we need to add workflow options before including Framework/runDataProcessing
42void customize(std::vector<ConfigParamSpec>& workflowOptions)
43{
44 // option allowing to set parameters
45 std::vector<o2::framework::ConfigParamSpec> options{
46 {"input-from-upstream", VariantType::Bool, false, {"read clusters from the clusterer"}},
47 {"track-sources", VariantType::String, std::string{"ITS,ITS-TPC-TRD-TOF,ITS-TPC-TOF,ITS-TPC,ITS-TPC-TRD,ZDC"}, {"comma-separated list of track sources to use"}},
48 {"cluster-sources", VariantType::String, std::string{"ITS"}, {"comma-separated list of cluster sources to use"}},
49 {"disable-root-input", VariantType::Bool, false, {"disable root-files input reader"}},
50 {"disable-mc", VariantType::Bool, false, {"disable MC propagation even if available"}},
51 {"cluster-size-study", VariantType::Bool, false, {"Perform the average cluster size study"}},
52 {"pid-study", VariantType::Bool, false, {"Perform the PID study"}},
53 {"track-study", VariantType::Bool, false, {"Perform the track study"}},
54 {"impact-parameter-study", VariantType::Bool, false, {"Perform the impact parameter study"}},
55 {"anomaly-study", VariantType::Bool, false, {"Perform the anomaly study"}},
56 {"its-beambkg-study", VariantType::Bool, false, {"Perform the ITS beam background study"}},
57 {"track-extension-study", VariantType::Bool, false, {"Perform the track extension study"}},
58 {"efficiency-study", VariantType::Bool, false, {"Perform the efficiency study"}},
59 {"configKeyValues", VariantType::String, "", {"Semicolon separated key=value strings ..."}}};
61 // o2::raw::HBFUtilsInitializer::addConfigOption(options, "o2_tfidinfo.root");
62 std::swap(workflowOptions, options);
63}
64
66
68{
69 WorkflowSpec specs;
70 GID::mask_t srcTrc, srcCls;
71
72 o2::conf::ConfigurableParam::updateFromString(configcontext.options().get<std::string>("configKeyValues"));
73 auto useMC = !configcontext.options().get<bool>("disable-mc");
74
75 std::shared_ptr<o2::steer::MCKinematicsReader> mcKinematicsReader;
76 if (useMC) {
77 mcKinematicsReader = std::make_shared<o2::steer::MCKinematicsReader>("collisioncontext.root");
78 }
79 bool anyStudy{false};
80 // Declare specs related to studies hereafter
81 if (configcontext.options().get<bool>("impact-parameter-study")) {
82 anyStudy = true;
83 srcTrc = GID::getSourcesMask(configcontext.options().get<std::string>("track-sources"));
84 srcCls = GID::getSourcesMask(configcontext.options().get<std::string>("cluster-sources"));
85 o2::globaltracking::InputHelper::addInputSpecs(configcontext, specs, srcCls, srcTrc, srcTrc, useMC, srcCls, srcTrc);
86 specs.emplace_back(o2::its::study::getImpactParameterStudy(srcTrc, srcCls, useMC));
87 }
88 if (configcontext.options().get<bool>("cluster-size-study")) {
89 anyStudy = true;
90 srcTrc = GID::getSourcesMask(configcontext.options().get<std::string>("track-sources"));
91 srcCls = GID::getSourcesMask(configcontext.options().get<std::string>("cluster-sources"));
92 o2::globaltracking::InputHelper::addInputSpecs(configcontext, specs, srcCls, srcTrc, srcTrc, useMC, srcCls, srcTrc);
93 specs.emplace_back(o2::its::study::getAvgClusSizeStudy(srcTrc, srcCls, useMC, mcKinematicsReader));
94 }
95 if (configcontext.options().get<bool>("pid-study")) {
96 anyStudy = true;
97 srcTrc = GID::getSourcesMask(configcontext.options().get<std::string>("track-sources"));
98 srcCls = GID::getSourcesMask(configcontext.options().get<std::string>("cluster-sources"));
99 o2::globaltracking::InputHelper::addInputSpecs(configcontext, specs, srcCls, srcTrc, srcTrc, useMC, srcCls, srcTrc);
100 specs.emplace_back(o2::its::study::getPIDStudy(srcTrc, srcCls, useMC, mcKinematicsReader));
101 }
102 if (configcontext.options().get<bool>("track-study")) {
103 anyStudy = true;
104 srcTrc = GID::getSourcesMask(configcontext.options().get<std::string>("track-sources"));
105 srcCls = GID::getSourcesMask(configcontext.options().get<std::string>("cluster-sources"));
106 if (!configcontext.options().get<bool>("input-from-upstream")) {
107 o2::globaltracking::InputHelper::addInputSpecs(configcontext, specs, srcCls, srcTrc, srcTrc, useMC, srcCls, srcTrc);
108 }
109 specs.emplace_back(o2::its::study::getTrackCheckStudy(GID::getSourcesMask("ITS"), GID::getSourcesMask("ITS"), useMC, mcKinematicsReader));
110 }
111 if (configcontext.options().get<bool>("anomaly-study")) {
112 anyStudy = true;
113 srcCls = GID::getSourcesMask(configcontext.options().get<std::string>("cluster-sources"));
114 if (!configcontext.options().get<bool>("input-from-upstream")) {
115 o2::globaltracking::InputHelper::addInputSpecs(configcontext, specs, srcCls, srcTrc, srcTrc, useMC, srcCls, srcTrc);
116 }
117 specs.emplace_back(o2::its::study::getAnomalyStudy(srcCls, useMC));
118 }
119 if (configcontext.options().get<bool>("its-beambkg-study")) {
120 anyStudy = true;
121
122 srcCls = GID::getSourcesMask(configcontext.options().get<std::string>("cluster-sources"));
123 srcTrc = GID::getSourcesMask(configcontext.options().get<std::string>("track-sources"));
124
125 if (!configcontext.options().get<bool>("input-from-upstream")) {
126 o2::globaltracking::InputHelper::addInputSpecs(configcontext, specs, srcCls, srcTrc, srcTrc, useMC, srcCls, srcTrc);
127 }
128 specs.emplace_back(o2::its::study::getITSBeamBackgroundStudy(srcTrc, srcCls, useMC));
129 }
130 if (configcontext.options().get<bool>("track-extension-study")) {
131 if (!useMC) {
132 LOGP(fatal, "Track Extension Study needs MC!");
133 }
134 anyStudy = true;
135 srcTrc = GID::getSourcesMask(configcontext.options().get<std::string>("track-sources"));
136 srcCls = GID::getSourcesMask("ITS");
137 o2::globaltracking::InputHelper::addInputSpecs(configcontext, specs, srcCls, srcTrc, srcTrc, true, srcCls, srcTrc);
138 specs.emplace_back(o2::its::study::getTrackExtensionStudy(srcTrc, srcCls, mcKinematicsReader));
139 }
140 if (configcontext.options().get<bool>("efficiency-study")) {
141 anyStudy = true;
142 srcTrc = GID::getSourcesMask(configcontext.options().get<std::string>("track-sources"));
143 srcCls = GID::getSourcesMask(configcontext.options().get<std::string>("cluster-sources"));
144 if (!configcontext.options().get<bool>("input-from-upstream")) {
145 o2::globaltracking::InputHelper::addInputSpecs(configcontext, specs, srcCls, srcTrc, srcTrc, useMC, srcCls, srcTrc);
146 }
147 specs.emplace_back(o2::its::study::getEfficiencyStudy(GID::getSourcesMask("ITS"), GID::getSourcesMask("ITS"), useMC, mcKinematicsReader));
148 }
149 if (!anyStudy) {
150 LOGP(info, "No study selected, dryrunning");
151 }
152
153 // o2::raw::HBFUtilsInitializer hbfIni(configcontext, specs);
154 // write the configuration used for the studies workflow
155 o2::conf::ConfigurableParam::writeINI("o2_its_standalone_configuration.ini");
156
157 return std::move(specs);
158}
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 ITS Vertex explicitly as messageable.
Definition Cartesian.h:288
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 getITSBeamBackgroundStudy(mask_t srcTracksMask, mask_t srcClustersMask, bool useMC)
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 addITSConfigOption(std::vector< o2::framework::ConfigParamSpec > &opts)
static void addNewTimeSliceCallback(std::vector< o2::framework::CallbacksPolicy > &policies)