From 05c7607f11fc282e65141b6d057aef8b1bc2c5af Mon Sep 17 00:00:00 2001 From: ppillot Date: Tue, 7 Feb 2023 12:00:07 +0100 Subject: [PATCH] add MCH errors merger, reader and writer --- Detectors/MUON/MCH/Base/CMakeLists.txt | 1 + .../MUON/MCH/Base/include/MCHBase/Error.h | 4 + Detectors/MUON/MCH/Base/src/MCHBaseLinkDef.h | 3 + Detectors/MUON/MCH/Workflow/CMakeLists.txt | 21 ++++ Detectors/MUON/MCH/Workflow/README.md | 35 ++++++ .../include/MCHWorkflow/ErrorReaderSpec.h | 22 ++++ .../include/MCHWorkflow/ErrorWriterSpec.h | 22 ++++ .../MUON/MCH/Workflow/src/ErrorMergerSpec.cxx | 106 ++++++++++++++++++ .../MUON/MCH/Workflow/src/ErrorMergerSpec.h | 32 ++++++ .../MUON/MCH/Workflow/src/ErrorReaderSpec.cxx | 71 ++++++++++++ .../MUON/MCH/Workflow/src/ErrorWriterSpec.cxx | 34 ++++++ .../Workflow/src/errors-merger-workflow.cxx | 44 ++++++++ .../Workflow/src/errors-reader-workflow.cxx | 38 +++++++ .../Workflow/src/errors-writer-workflow.cxx | 29 +++++ .../MUON/MCH/Workflow/src/reco-workflow.cxx | 8 ++ 15 files changed, 470 insertions(+) create mode 100644 Detectors/MUON/MCH/Workflow/include/MCHWorkflow/ErrorReaderSpec.h create mode 100644 Detectors/MUON/MCH/Workflow/include/MCHWorkflow/ErrorWriterSpec.h create mode 100644 Detectors/MUON/MCH/Workflow/src/ErrorMergerSpec.cxx create mode 100644 Detectors/MUON/MCH/Workflow/src/ErrorMergerSpec.h create mode 100644 Detectors/MUON/MCH/Workflow/src/ErrorReaderSpec.cxx create mode 100644 Detectors/MUON/MCH/Workflow/src/ErrorWriterSpec.cxx create mode 100644 Detectors/MUON/MCH/Workflow/src/errors-merger-workflow.cxx create mode 100644 Detectors/MUON/MCH/Workflow/src/errors-reader-workflow.cxx create mode 100644 Detectors/MUON/MCH/Workflow/src/errors-writer-workflow.cxx diff --git a/Detectors/MUON/MCH/Base/CMakeLists.txt b/Detectors/MUON/MCH/Base/CMakeLists.txt index 95ef4bf67390a..d1e2ff5b1da58 100644 --- a/Detectors/MUON/MCH/Base/CMakeLists.txt +++ b/Detectors/MUON/MCH/Base/CMakeLists.txt @@ -24,6 +24,7 @@ o2_add_library(MCHBase o2_target_root_dictionary(MCHBase HEADERS include/MCHBase/DecoderError.h + include/MCHBase/Error.h include/MCHBase/HeartBeatPacket.h include/MCHBase/PreCluster.h include/MCHBase/ResponseParam.h diff --git a/Detectors/MUON/MCH/Base/include/MCHBase/Error.h b/Detectors/MUON/MCH/Base/include/MCHBase/Error.h index da58b4e971a00..e1aa4f4803fda 100644 --- a/Detectors/MUON/MCH/Base/include/MCHBase/Error.h +++ b/Detectors/MUON/MCH/Base/include/MCHBase/Error.h @@ -22,6 +22,8 @@ #include #include +#include + namespace o2::mch { @@ -90,6 +92,8 @@ struct Error { std::string getTypeDescription() const; /** returns the error message corresponding to this error */ std::string asString() const; + + ClassDefNV(Error, 1) }; } // namespace o2::mch diff --git a/Detectors/MUON/MCH/Base/src/MCHBaseLinkDef.h b/Detectors/MUON/MCH/Base/src/MCHBaseLinkDef.h index a718716a33272..ed2a39ef43468 100644 --- a/Detectors/MUON/MCH/Base/src/MCHBaseLinkDef.h +++ b/Detectors/MUON/MCH/Base/src/MCHBaseLinkDef.h @@ -27,4 +27,7 @@ #pragma link C++ class o2::mch::PreCluster + ; #pragma link C++ class std::vector < o2::mch::PreCluster> + ; +#pragma link C++ class o2::mch::Error + ; +#pragma link C++ class std::vector < o2::mch::Error> + ; + #endif diff --git a/Detectors/MUON/MCH/Workflow/CMakeLists.txt b/Detectors/MUON/MCH/Workflow/CMakeLists.txt index b5ec0f2e39fc4..dfcf1164abdd9 100644 --- a/Detectors/MUON/MCH/Workflow/CMakeLists.txt +++ b/Detectors/MUON/MCH/Workflow/CMakeLists.txt @@ -18,6 +18,8 @@ o2_add_library(MCHWorkflow src/ClusterReaderSpec.cxx src/ClusterWriterSpec.cxx src/DataDecoderSpec.cxx + src/ErrorReaderSpec.cxx + src/ErrorWriterSpec.cxx src/PreClusterReaderSpec.cxx src/PreClusterWriterSpec.cxx src/TrackReaderSpec.cxx @@ -183,6 +185,24 @@ o2_add_executable( COMPONENT_NAME mch PUBLIC_LINK_LIBRARIES O2::Framework O2::DataFormatsMCH O2::MCHBase) +o2_add_executable( + errors-merger-workflow + SOURCES src/ErrorMergerSpec.cxx src/errors-merger-workflow.cxx + COMPONENT_NAME mch + PUBLIC_LINK_LIBRARIES O2::Framework O2::MCHBase) + +o2_add_executable( + errors-writer-workflow + SOURCES src/errors-writer-workflow.cxx + COMPONENT_NAME mch + PUBLIC_LINK_LIBRARIES O2::MCHWorkflow) + +o2_add_executable( + errors-reader-workflow + SOURCES src/errors-reader-workflow.cxx + COMPONENT_NAME mch + PUBLIC_LINK_LIBRARIES O2::MCHWorkflow) + o2_add_executable( entropy-encoder-workflow SOURCES src/entropy-encoder-workflow.cxx @@ -193,6 +213,7 @@ o2_add_executable( reco-workflow SOURCES src/DigitReaderSpec.cxx + src/ErrorMergerSpec.cxx src/EventFinderSpec.cxx src/TrackMCLabelFinderSpec.cxx src/reco-workflow.cxx diff --git a/Detectors/MUON/MCH/Workflow/README.md b/Detectors/MUON/MCH/Workflow/README.md index e69e4b19fea13..90f53b707c682 100644 --- a/Detectors/MUON/MCH/Workflow/README.md +++ b/Detectors/MUON/MCH/Workflow/README.md @@ -18,6 +18,7 @@ * [Tracking](#tracking) * [Track extrapolation to vertex](#track-extrapolation-to-vertex) * [Track fitter](#track-fitter) +* [Error merger](#error-merger) * [Samplers](#samplers) * [Digit sampler](#digit-sampler) * [Precluster reader](#precluster-reader) @@ -25,6 +26,7 @@ * [Cluster reader](#cluster-reader) * [Track sampler](#track-sampler) * [Track reader](#track-reader) + * [Error reader](#error-reader) * [Vertex sampler](#vertex-sampler) * [Sinks](#sinks) * [Precluster sink](#precluster-sink) @@ -33,6 +35,7 @@ * [Cluster writer](#cluster-writer) * [Track sink](#track-sink) * [Track writer](#track-writer) + * [Error writer](#error-writer) @@ -207,6 +210,20 @@ Options `--l3Current xxx` and `--dipoleCurrent yyy` allow to specify the current Refit the tracks to their associated clusters. [more...](/Detectors/MUON/MCH/Tracking/README.md) +## Error merger + +```shell +o2-mch-errors-merger-workflow +``` + +Take as input the list of all MCH preclustering, clustering and tracking errors ([Error](../Base/include/MCHBase/Error.h)) in the current time frame, with the data description "PRECLUSTERERRORS", "CLUSTERERRORS" and "TRACKERRORS", respectively. Send the merged list of all MCH processing errors ([Error](../Base/include/MCHBase/Error.h)) in the time frame, with the data description "ERRORS". + +Options `--disable-preclustering-errors` allows to skip the preclustering errors. + +Options `--disable-clustering-errors` allows to skip the clustering errors. + +Options `--disable-tracking-errors` allows to skip the tracking errors. + ## Samplers ### Digit sampler @@ -305,6 +322,16 @@ Option `--digits` allows to also read the associated digits ([Digit](/DataFormat Option `--enable-mc` allows to also read the track MC labels and send them with the data description "TRACKLABELS". +## Error reader + +```shell +o2-mch-errors-reader-workflow --infile mcherrors.root +``` + +Send the list of all MCH processing errors ([Error](../Base/include/MCHBase/Error.h)) in the current time frame, with the data description "ERRORS". + +Option `--input-dir` allows to set the name of the directory containing the input file (default = current directory). + ### Vertex sampler ```shell @@ -411,3 +438,11 @@ Does the same kind of work as the [track sink](#track-sink) but the output is in Option `--digits` allows to also write the associated digits ([Digit](/DataFormats/Detectors/MUON/MCH/include/DataFormatsMCH/Digit.h)) from the input message with the data description "TRACKDIGITS". Option `--enable-mc` allows to also write the track MC labels from the input message with the data description "TRACKLABELS". + +## Error writer + +```shell +o2-mch-errors-writer-workflow +``` + +Take as input the list of all MCH processing errors ([Error](../Base/include/MCHBase/Error.h)) in the current time frame, with the data description "ERRORS", and write it in the root file "mcherrors.root". diff --git a/Detectors/MUON/MCH/Workflow/include/MCHWorkflow/ErrorReaderSpec.h b/Detectors/MUON/MCH/Workflow/include/MCHWorkflow/ErrorReaderSpec.h new file mode 100644 index 0000000000000..9a157aed1d709 --- /dev/null +++ b/Detectors/MUON/MCH/Workflow/include/MCHWorkflow/ErrorReaderSpec.h @@ -0,0 +1,22 @@ +// 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. + +#ifndef O2_MCH_WORKFLOW_ERROR_READER_SPEC_H +#define O2_MCH_WORKFLOW_ERROR_READER_SPEC_H + +#include "Framework/DataProcessorSpec.h" + +namespace o2::mch +{ +framework::DataProcessorSpec getErrorReaderSpec(const char* specName = "mch-error-reader"); +} + +#endif diff --git a/Detectors/MUON/MCH/Workflow/include/MCHWorkflow/ErrorWriterSpec.h b/Detectors/MUON/MCH/Workflow/include/MCHWorkflow/ErrorWriterSpec.h new file mode 100644 index 0000000000000..39df975b5f004 --- /dev/null +++ b/Detectors/MUON/MCH/Workflow/include/MCHWorkflow/ErrorWriterSpec.h @@ -0,0 +1,22 @@ +// 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. + +#ifndef O2_MCH_WORKFLOW_ERROR_WRITER_SPEC_H +#define O2_MCH_WORKFLOW_ERROR_WRITER_SPEC_H + +#include "Framework/DataProcessorSpec.h" + +namespace o2::mch +{ +framework::DataProcessorSpec getErrorWriterSpec(const char* specName = "mch-error-writer"); +} + +#endif diff --git a/Detectors/MUON/MCH/Workflow/src/ErrorMergerSpec.cxx b/Detectors/MUON/MCH/Workflow/src/ErrorMergerSpec.cxx new file mode 100644 index 0000000000000..9568d5b5b8ea3 --- /dev/null +++ b/Detectors/MUON/MCH/Workflow/src/ErrorMergerSpec.cxx @@ -0,0 +1,106 @@ +// 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. + +/// \file ErrorMergerSpec.cxx +/// \brief Implementation of a data processor to merge the processing errors in one single output +/// +/// \author Philippe Pillot, Subatech + +#include "ErrorMergerSpec.h" + +#include + +#include + +#include "Framework/ConfigParamSpec.h" +#include "Framework/InitContext.h" +#include "Framework/InputSpec.h" +#include "Framework/Lifetime.h" +#include "Framework/OutputRef.h" +#include "Framework/OutputSpec.h" +#include "Framework/ProcessingContext.h" +#include "Framework/Task.h" + +#include "MCHBase/Error.h" + +namespace o2 +{ +namespace mch +{ + +using namespace o2::framework; + +class ErrorMergerTask +{ + public: + //_________________________________________________________________________________________________ + /// constructor + ErrorMergerTask(bool preclustering, bool clustering, bool tracking) + : mPreclustering{preclustering}, + mClustering{clustering}, + mTracking{tracking} {} + + //_________________________________________________________________________________________________ + /// prepare the error merger + void init(InitContext& ic) {} + + //_________________________________________________________________________________________________ + /// run the error merger + void run(ProcessingContext& pc) + { + auto& errors = pc.outputs().make>(OutputRef{"errors"}); + + if (mPreclustering) { + auto preclusteringErrors = pc.inputs().get>("preclustererrors"); + errors.insert(errors.end(), preclusteringErrors.begin(), preclusteringErrors.end()); + } + + if (mClustering) { + auto clusteringErrors = pc.inputs().get>("clustererrors"); + errors.insert(errors.end(), clusteringErrors.begin(), clusteringErrors.end()); + } + + if (mTracking) { + auto trackingErrors = pc.inputs().get>("trackerrors"); + errors.insert(errors.end(), trackingErrors.begin(), trackingErrors.end()); + } + } + + private: + bool mPreclustering = true; ///< add preclustering errors + bool mClustering = true; ///< add clustering errors + bool mTracking = true; ///< add tracking errors +}; + +//_________________________________________________________________________________________________ +DataProcessorSpec getErrorMergerSpec(const char* specName, bool preclustering, bool clustering, bool tracking) +{ + std::vector inputSpecs{}; + if (preclustering) { + inputSpecs.emplace_back(InputSpec{"preclustererrors", "MCH", "PRECLUSTERERRORS", 0, Lifetime::Timeframe}); + } + if (clustering) { + inputSpecs.emplace_back(InputSpec{"clustererrors", "MCH", "CLUSTERERRORS", 0, Lifetime::Timeframe}); + } + if (tracking) { + inputSpecs.emplace_back(InputSpec{"trackerrors", "MCH", "TRACKERRORS", 0, Lifetime::Timeframe}); + } + + return DataProcessorSpec{ + specName, + inputSpecs, + Outputs{OutputSpec{{"errors"}, "MCH", "ERRORS", 0, Lifetime::Timeframe}}, + adaptFromTask(preclustering, clustering, tracking), + Options{}}; +} + +} // namespace mch +} // namespace o2 diff --git a/Detectors/MUON/MCH/Workflow/src/ErrorMergerSpec.h b/Detectors/MUON/MCH/Workflow/src/ErrorMergerSpec.h new file mode 100644 index 0000000000000..87a86139ccaf0 --- /dev/null +++ b/Detectors/MUON/MCH/Workflow/src/ErrorMergerSpec.h @@ -0,0 +1,32 @@ +// 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. + +/// \file ErrorMergerSpec.h +/// \brief Definition of a data processor to merge the processing errors in one single output +/// +/// \author Philippe Pillot, Subatech + +#ifndef O2_MCH_ERRORMERGERSPEC_H_ +#define O2_MCH_ERRORMERGERSPEC_H_ + +#include "Framework/DataProcessorSpec.h" + +namespace o2::mch +{ + +framework::DataProcessorSpec getErrorMergerSpec(const char* specName = "mch-error-merger", + bool preclustering = true, + bool clustering = true, + bool tracking = true); + +} // namespace o2::mch + +#endif // O2_MCH_ERRORMERGERSPEC_H_ diff --git a/Detectors/MUON/MCH/Workflow/src/ErrorReaderSpec.cxx b/Detectors/MUON/MCH/Workflow/src/ErrorReaderSpec.cxx new file mode 100644 index 0000000000000..d067860c50966 --- /dev/null +++ b/Detectors/MUON/MCH/Workflow/src/ErrorReaderSpec.cxx @@ -0,0 +1,71 @@ +// 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 "MCHWorkflow/ErrorReaderSpec.h" + +#include +#include +#include + +#include "Framework/ConfigParamRegistry.h" +#include "Framework/ConfigParamSpec.h" +#include "Framework/ControlService.h" +#include "Framework/InitContext.h" +#include "Framework/Lifetime.h" +#include "Framework/OutputSpec.h" +#include "Framework/ProcessingContext.h" +#include "Framework/Task.h" + +#include "DPLUtils/RootTreeReader.h" +#include "CommonUtils/StringUtils.h" +#include "MCHBase/Error.h" + +using namespace o2::framework; + +namespace o2::mch +{ + +struct ErrorReader { + std::unique_ptr mTreeReader; + + void init(InitContext& ic) + { + auto fileName = o2::utils::Str::concat_string(o2::utils::Str::rectifyDirectory(ic.options().get("input-dir")), ic.options().get("infile")); + mTreeReader = std::make_unique( + "o2sim", + fileName.c_str(), + -1, + RootTreeReader::PublishingMode::Single, + RootTreeReader::BranchDefinition>{Output{"MCH", "ERRORS", 0}, "errors"}); + } + + void run(ProcessingContext& pc) + { + if (mTreeReader->next()) { + (*mTreeReader)(pc); + } else { + pc.services().get().endOfStream(); + } + } +}; + +DataProcessorSpec getErrorReaderSpec(const char* specName) +{ + return DataProcessorSpec{ + specName, + Inputs{}, + Outputs{OutputSpec{{"errors"}, "MCH", "ERRORS", 0, Lifetime::Timeframe}}, + adaptFromTask(), + Options{{"infile", VariantType::String, "mcherrors.root", {"name of the input error file"}}, + {"input-dir", VariantType::String, "none", {"Input directory"}}}}; +} + +} // namespace o2::mch diff --git a/Detectors/MUON/MCH/Workflow/src/ErrorWriterSpec.cxx b/Detectors/MUON/MCH/Workflow/src/ErrorWriterSpec.cxx new file mode 100644 index 0000000000000..ab670de8e3ffe --- /dev/null +++ b/Detectors/MUON/MCH/Workflow/src/ErrorWriterSpec.cxx @@ -0,0 +1,34 @@ +// 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 "MCHWorkflow/ErrorWriterSpec.h" + +#include +#include "DPLUtils/MakeRootTreeWriterSpec.h" +#include "MCHBase/Error.h" + +using namespace o2::framework; + +namespace o2::mch +{ + +template +using BranchDefinition = MakeRootTreeWriterSpec::BranchDefinition; + +DataProcessorSpec getErrorWriterSpec(const char* specName) +{ + return MakeRootTreeWriterSpec(specName, + "mcherrors.root", + MakeRootTreeWriterSpec::TreeAttributes{"o2sim", "Tree MCH Errors"}, + BranchDefinition>{InputSpec{"errors", "MCH", "ERRORS"}, "errors"})(); +} + +} // namespace o2::mch diff --git a/Detectors/MUON/MCH/Workflow/src/errors-merger-workflow.cxx b/Detectors/MUON/MCH/Workflow/src/errors-merger-workflow.cxx new file mode 100644 index 0000000000000..c2773c2b269f8 --- /dev/null +++ b/Detectors/MUON/MCH/Workflow/src/errors-merger-workflow.cxx @@ -0,0 +1,44 @@ +// 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. + +/// \file errors-merger-workflow.cxx +/// \brief merge the processing errors in one single output +/// +/// \author Philippe Pillot, Subatech + +#include +#include +#include "Framework/ConfigParamSpec.h" +#include "Framework/ConfigContext.h" +#include "Framework/WorkflowSpec.h" +#include "ErrorMergerSpec.h" + +using namespace o2::framework; + +void customize(std::vector& workflowOptions) +{ + workflowOptions.emplace_back("disable-preclustering-errors", VariantType::Bool, false, + ConfigParamSpec::HelpString{"Do not consider preclustering errors"}); + workflowOptions.emplace_back("disable-clustering-errors", VariantType::Bool, false, + ConfigParamSpec::HelpString{"Do not consider clustering errors"}); + workflowOptions.emplace_back("disable-tracking-errors", VariantType::Bool, false, + ConfigParamSpec::HelpString{"Do not consider tracking errors"}); +} + +#include "Framework/runDataProcessing.h" + +WorkflowSpec defineDataProcessing(const ConfigContext& config) +{ + bool preclustering = !config.options().get("disable-preclustering-errors"); + bool clustering = !config.options().get("disable-clustering-errors"); + bool tracking = !config.options().get("disable-tracking-errors"); + return WorkflowSpec{o2::mch::getErrorMergerSpec("mch-error-merger", preclustering, clustering, tracking)}; +} diff --git a/Detectors/MUON/MCH/Workflow/src/errors-reader-workflow.cxx b/Detectors/MUON/MCH/Workflow/src/errors-reader-workflow.cxx new file mode 100644 index 0000000000000..f33056cad0ef5 --- /dev/null +++ b/Detectors/MUON/MCH/Workflow/src/errors-reader-workflow.cxx @@ -0,0 +1,38 @@ +// 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 +#include "DetectorsRaw/HBFUtilsInitializer.h" +#include "Framework/CallbacksPolicy.h" +#include "Framework/ConfigParamSpec.h" +#include "MCHWorkflow/ErrorReaderSpec.h" + +using namespace o2::framework; + +void customize(std::vector& policies) +{ + o2::raw::HBFUtilsInitializer::addNewTimeSliceCallback(policies); +} + +// we need to add workflow options before including Framework/runDataProcessing +void customize(std::vector& workflowOptions) +{ + o2::raw::HBFUtilsInitializer::addConfigOption(workflowOptions); +} + +#include "Framework/runDataProcessing.h" + +WorkflowSpec defineDataProcessing(const ConfigContext& config) +{ + WorkflowSpec wf{o2::mch::getErrorReaderSpec("mch-error-reader")}; + o2::raw::HBFUtilsInitializer hbfIni(config, wf); + return wf; +} diff --git a/Detectors/MUON/MCH/Workflow/src/errors-writer-workflow.cxx b/Detectors/MUON/MCH/Workflow/src/errors-writer-workflow.cxx new file mode 100644 index 0000000000000..75f44489c4c02 --- /dev/null +++ b/Detectors/MUON/MCH/Workflow/src/errors-writer-workflow.cxx @@ -0,0 +1,29 @@ +// 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 +#include "Framework/CompletionPolicyHelpers.h" +#include "MCHWorkflow/ErrorWriterSpec.h" + +using namespace o2::framework; + +void customize(std::vector& policies) +{ + // ordered policies for the writers + policies.push_back(CompletionPolicyHelpers::consumeWhenAllOrdered(".*(?:MCH|mch).*[W,w]riter.*")); +} + +#include "Framework/runDataProcessing.h" + +WorkflowSpec defineDataProcessing(const ConfigContext&) +{ + return WorkflowSpec{o2::mch::getErrorWriterSpec("mch-error-writer")}; +} diff --git a/Detectors/MUON/MCH/Workflow/src/reco-workflow.cxx b/Detectors/MUON/MCH/Workflow/src/reco-workflow.cxx index 7db47b5a38344..ae1e63f8f9621 100644 --- a/Detectors/MUON/MCH/Workflow/src/reco-workflow.cxx +++ b/Detectors/MUON/MCH/Workflow/src/reco-workflow.cxx @@ -13,6 +13,7 @@ #include "CommonUtils/ConfigurableParam.h" #include "DetectorsRaw/HBFUtilsInitializer.h" #include "DigitReaderSpec.h" +#include "ErrorMergerSpec.h" #include "EventFinderSpec.h" #include "Framework/CallbacksPolicy.h" #include "Framework/CompletionPolicyHelpers.h" @@ -28,6 +29,7 @@ #include "MCHTracking/TrackFinderSpec.h" #include "MCHWorkflow/ClusterFinderOriginalSpec.h" #include "MCHWorkflow/ClusterWriterSpec.h" +#include "MCHWorkflow/ErrorWriterSpec.h" #include "MCHWorkflow/TrackWriterSpec.h" #include "TrackMCLabelFinderSpec.h" @@ -124,6 +126,12 @@ WorkflowSpec defineDataProcessing(ConfigContext const& configcontext) } } + specs.emplace_back(o2::mch::getErrorMergerSpec("mch-error-merger", true, !disableClustering, + !(disableClustering || disableTracking))); + if (!disableRootOutput) { + specs.emplace_back(o2::mch::getErrorWriterSpec("mch-error-writer")); + } + // configure dpl timer to inject correct firstTForbit: start from the 1st orbit of TF containing 1st sampled orbit o2::raw::HBFUtilsInitializer hbfIni(configcontext, specs);