Project
Loading...
Searching...
No Matches
RawPageTestData.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 FRAMEWORK_UTILS_RAWPAGETESTDATA_H
18#define FRAMEWORK_UTILS_RAWPAGETESTDATA_H
19
21#include "Framework/InputSpan.h"
23#include "Headers/DataHeader.h"
24#include <vector>
25#include <memory>
26
30
31namespace o2::framework::test
32{
34static const size_t PAGESIZE = 8192;
35
39struct DataSet {
40 // not nice with the double vector but for quick unit test ok
41 using Messages = std::vector<std::vector<std::unique_ptr<std::vector<char>>>>;
42 DataSet(std::vector<InputRoute>&& s, Messages&& m, std::vector<int>&& v, ServiceRegistryRef registry)
43 : schema{std::move(s)},
44 messages{std::move(m)},
45 span{[this](size_t i) { return i < this->messages.size() ? messages[i].size() / 2 : 0; },
46 nullptr,
47 [this](size_t i, DataRefIndices idx) {
48 auto header = static_cast<char const*>(this->messages[i].at(idx.headerIdx)->data());
49 auto payload = static_cast<char const*>(this->messages[i].at(idx.payloadIdx)->data());
50 return DataRef{nullptr, header, payload};
51 },
52 [this](size_t i, DataRefIndices current) -> DataRefIndices {
53 size_t next = current.headerIdx + 2;
54 return next < this->messages[i].size() ? DataRefIndices{next, next + 1} : DataRefIndices{size_t(-1), size_t(-1)};
55 },
56 nullptr,
57 this->messages.size()},
58 record{schema, span, registry},
59 values{std::move(v)}
60 {
61 }
62
63 std::vector<InputRoute> schema;
67 std::vector<int> values;
68};
69
70using AmendRawDataHeader = std::function<void(RAWDataHeader&)>;
71DataSet createData(std::vector<InputSpec> const& inputspecs, std::vector<DataHeader> const& dataheaders, AmendRawDataHeader amendRdh = nullptr);
72
73} // namespace o2::framework::test
74#endif // FRAMEWORK_UTILS_RAWPAGETESTDATA_H
std::shared_ptr< arrow::Schema > schema
std::vector< std::string > header
int32_t i
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error s
Definition of the RAW Data Header.
o2::header::RAWDataHeaderV6 RAWDataHeaderV6
auto const PAGESIZE
The input API of the Data Processing Layer This class holds the inputs which are valid for processing...
size_t size() const
Number of elements in the InputSpan.
Definition InputSpan.h:102
const GLfloat * m
Definition glcorearb.h:4066
const GLdouble * v
Definition glcorearb.h:832
GLenum GLsizei GLsizei GLint * values
Definition glcorearb.h:1576
typedef void(APIENTRYP PFNGLCULLFACEPROC)(GLenum mode)
std::function< void(RAWDataHeader &)> AmendRawDataHeader
Simple helper struct to keep the InputRecord and ownership of messages together with some test data.
std::vector< std::vector< std::unique_ptr< std::vector< char > > > > Messages
std::vector< InputRoute > schema
DataSet(std::vector< InputRoute > &&s, Messages &&m, std::vector< int > &&v, ServiceRegistryRef registry)
the main header struct
Definition DataHeader.h:623
a move-only header stack with serialized headers This is the flat buffer where all the headers in a m...
Definition Stack.h:33
DataSet createData()