Project
Loading...
Searching...
No Matches
ColumnDataSpecsUtils.h
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#ifndef O2_MID_COLUMNDATASPECSUTILS_H
18#define O2_MID_COLUMNDATASPECSUTILS_H
19
20#include <array>
21#include <memory>
22#include <string>
23#include <string_view>
24#include <vector>
25#include <gsl/span>
26#include "fmt/format.h"
27
30#include "Framework/InputSpec.h"
37
38namespace o2
39{
40namespace mid
41{
42namespace specs
43{
44
50std::vector<framework::InputSpec> buildInputSpecs(std::string_view dataBind, std::string_view dataDesc, bool useMC);
51
59std::vector<framework::InputSpec> buildInputSpecs(std::string_view dataBind, std::string_view dataDesc, std::string_view rofDesc, std::string_view labelsDesc, bool useMC);
60
65std::vector<framework::OutputSpec> buildOutputSpecs(std::string_view bind, std::string_view description);
66
72std::vector<framework::OutputSpec> buildStandardOutputSpecs(std::string_view dataBind, std::string_view dataDesc, bool useMC);
73
78template <typename T>
79std::array<gsl::span<const T>, NEvTypes> getInput(framework::ProcessingContext& pc, std::string_view bind)
80{
81 std::array<gsl::span<const T>, 3> data;
82 for (auto const& inputRef : framework::InputRecordWalker(pc.inputs())) {
83 auto const* dh = framework::DataRefUtils::getHeader<o2::header::DataHeader*>(inputRef);
84 auto subSpecIdx = static_cast<size_t>(dh->subSpecification);
85 if (framework::DataRefUtils::match(inputRef, bind.data())) {
86 data[subSpecIdx] = pc.inputs().get<gsl::span<T>>(inputRef);
87 }
88 }
89 return data;
90}
91
95std::vector<framework::Output> buildOutputs(std::vector<framework::OutputSpec> outputSpecs);
96
101std::array<gsl::span<const ColumnData>, NEvTypes> getData(framework::ProcessingContext& pc, std::string_view dataBind);
102
108gsl::span<const ColumnData> getData(framework::ProcessingContext& pc, std::string_view dataBind, EventType eventType);
109
114std::array<gsl::span<const ROFRecord>, NEvTypes> getRofs(framework::ProcessingContext& pc, std::string_view dataBind);
115
121gsl::span<const ROFRecord> getRofs(framework::ProcessingContext& pc, std::string_view dataBind, EventType eventType);
122
127std::unique_ptr<const o2::dataformats::MCTruthContainer<MCLabel>> getLabels(framework::ProcessingContext& pc, std::string_view dataBind);
128
129} // namespace specs
130} // namespace mid
131} // namespace o2
132
133#endif // O2_MID_COLUMNDATASPECSUTILS_H
Strip pattern (aka digits)
Label for MID.
A helper class to iteratate over all parts of all input routes.
Definition of a container to keep Monte Carlo truth external to simulation objects.
Definition of the MID event record.
const auto & getData()
A helper class to iteratate over all parts of all input routes.
decltype(auto) get(R binding, int part=0) const
InputRecord & inputs()
The inputs associated with this processing context.
GLboolean * data
Definition glcorearb.h:298
std::vector< framework::InputSpec > buildInputSpecs(std::string_view dataBind, std::string_view dataDesc, bool useMC)
std::vector< framework::OutputSpec > buildStandardOutputSpecs(std::string_view dataBind, std::string_view dataDesc, bool useMC)
std::vector< framework::Output > buildOutputs(std::vector< framework::OutputSpec > outputSpecs)
std::array< gsl::span< const T >, NEvTypes > getInput(framework::ProcessingContext &pc, std::string_view bind)
std::unique_ptr< const o2::dataformats::MCTruthContainer< MCLabel > > getLabels(framework::ProcessingContext &pc, std::string_view dataBind)
std::vector< framework::OutputSpec > buildOutputSpecs(std::string_view bind, std::string_view description)
std::array< gsl::span< const ROFRecord >, NEvTypes > getRofs(framework::ProcessingContext &pc, std::string_view dataBind)
constexpr uint32_t NEvTypes
Definition ROFRecord.h:37
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
static bool match(DataRef const &ref, const char *binding)