Project
Loading...
Searching...
No Matches
ErrorMergerSpec.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
16
17#include "ErrorMergerSpec.h"
18
19#include <vector>
20
21#include <gsl/span>
22
25#include "Framework/InputSpec.h"
26#include "Framework/Lifetime.h"
27#include "Framework/OutputRef.h"
30#include "Framework/Task.h"
31
32#include "MCHBase/Error.h"
33
34namespace o2
35{
36namespace mch
37{
38
39using namespace o2::framework;
40
42{
43 public:
44 //_________________________________________________________________________________________________
46 ErrorMergerTask(bool preclustering, bool clustering, bool tracking)
47 : mPreclustering{preclustering},
48 mClustering{clustering},
49 mTracking{tracking} {}
50
51 //_________________________________________________________________________________________________
53 void init(InitContext& ic) {}
54
55 //_________________________________________________________________________________________________
58 {
59 auto& errors = pc.outputs().make<std::vector<Error>>(OutputRef{"errors"});
60
61 if (mPreclustering) {
62 auto preclusteringErrors = pc.inputs().get<gsl::span<Error>>("preclustererrors");
63 errors.insert(errors.end(), preclusteringErrors.begin(), preclusteringErrors.end());
64 }
65
66 if (mClustering) {
67 auto clusteringErrors = pc.inputs().get<gsl::span<Error>>("clustererrors");
68 errors.insert(errors.end(), clusteringErrors.begin(), clusteringErrors.end());
69 }
70
71 if (mTracking) {
72 auto trackingErrors = pc.inputs().get<gsl::span<Error>>("trackerrors");
73 errors.insert(errors.end(), trackingErrors.begin(), trackingErrors.end());
74 }
75 }
76
77 private:
78 bool mPreclustering = true;
79 bool mClustering = true;
80 bool mTracking = true;
81};
82
83//_________________________________________________________________________________________________
84DataProcessorSpec getErrorMergerSpec(const char* specName, bool preclustering, bool clustering, bool tracking)
85{
86 std::vector<InputSpec> inputSpecs{};
87 if (preclustering) {
88 inputSpecs.emplace_back(InputSpec{"preclustererrors", "MCH", "PRECLUSTERERRORS", 0, Lifetime::Timeframe});
89 }
90 if (clustering) {
91 inputSpecs.emplace_back(InputSpec{"clustererrors", "MCH", "CLUSTERERRORS", 0, Lifetime::Timeframe});
92 }
93 if (tracking) {
94 inputSpecs.emplace_back(InputSpec{"trackerrors", "MCH", "TRACKERRORS", 0, Lifetime::Timeframe});
95 }
96
97 return DataProcessorSpec{
99 inputSpecs,
100 Outputs{OutputSpec{{"errors"}, "MCH", "PROCERRORS", 0, Lifetime::Timeframe}},
101 adaptFromTask<ErrorMergerTask>(preclustering, clustering, tracking),
102 Options{}};
103}
104
105} // namespace mch
106} // namespace o2
Definition of a data processor to merge the processing errors in one single output.
definition of the MCH processing errors
const char * specName
decltype(auto) make(const Output &spec, Args... args)
decltype(auto) get(R binding, int part=0) const
DataAllocator & outputs()
The data allocator is used to allocate memory for the output data.
InputRecord & inputs()
The inputs associated with this processing context.
void run(ProcessingContext &pc)
run the error merger
ErrorMergerTask(bool preclustering, bool clustering, bool tracking)
constructor
void init(InitContext &ic)
prepare the error merger
Defining PrimaryVertex explicitly as messageable.
Definition TFIDInfo.h:20
std::vector< ConfigParamSpec > Options
std::vector< OutputSpec > Outputs
DataProcessorSpec getErrorMergerSpec(const char *specName, bool preclustering, bool clustering, bool tracking)
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...