Project
Loading...
Searching...
No Matches
DataBlock.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
12#ifndef O2_MCH_RAW_ENCODER_DATABLOCK_H
13#define O2_MCH_RAW_ENCODER_DATABLOCK_H
14
15#include <cstdint>
16#include <vector>
17#include <gsl/span>
18#include <functional>
19#include <iostream>
20#include <optional>
21
22namespace o2::mch::raw
23{
24
32
34struct DataBlock {
36 gsl::span<const std::byte> payload;
37 uint64_t size() const
38 {
39 return sizeof(header) + payload.size();
40 }
41};
42
47 std::optional<uint64_t> offset;
48};
49
51void appendDataBlockHeader(std::vector<std::byte>& outBuffer, DataBlockHeader header);
52
54int forEachDataBlockRef(gsl::span<const std::byte> buffer,
55 std::function<void(DataBlockRef blockRef)> f);
56
58int countHeaders(gsl::span<const std::byte> buffer);
59
60std::ostream& operator<<(std::ostream& os, const DataBlockHeader& header);
61std::ostream& operator<<(std::ostream& os, const DataBlockRef& ref);
62std::ostream& operator<<(std::ostream& os, const DataBlock& block);
63
64bool operator<(const DataBlockHeader& a, const DataBlockHeader& b);
65bool operator<(const DataBlockRef& a, const DataBlockRef& rhs);
66
67} // namespace o2::mch::raw
68
69#endif
unsigned short int uint16_t
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 First event to Number of events to Number of iterations to Number of iterations to Number of initial iterations excluded from const char Directory with events to Events directory is and not inside events Show standalone event Run event generator maximum time bin of continuous for triggered for automatic continuous for automatic continuous triggered uint64_t
GLdouble f
Definition glcorearb.h:310
GLboolean GLboolean GLboolean b
Definition glcorearb.h:1233
GLboolean GLboolean GLboolean GLboolean a
Definition glcorearb.h:1233
GLint ref
Definition glcorearb.h:291
int countHeaders(gsl::span< const std::byte > buffer)
Count the headers in the input buffer.
Definition DataBlock.cxx:42
void appendDataBlockHeader(std::vector< std::byte > &outBuffer, DataBlockHeader header)
Convert the header into bytes.
Definition DataBlock.cxx:17
int forEachDataBlockRef(gsl::span< const std::byte > buffer, std::function< void(DataBlockRef ref)> f)
Definition DataBlock.cxx:23
bool operator<(const observer_ptr< W1 > &p1, const observer_ptr< W2 > &p2)
std::ostream & operator<<(std::ostream &stream, o2::InteractionRecord const &ir)
A lightweight struct to describe a MCH Raw Data Block.
Definition DataBlock.h:26
a DataBlockRef is a pair (DataBlock,offset) The offset is an offset into some external buffer
Definition DataBlock.h:45
std::optional< uint64_t > offset
Definition DataBlock.h:47
A DataBlock is a pair (DataBlockHeader,payload)
Definition DataBlock.h:34
uint64_t size() const
Definition DataBlock.h:37
DataBlockHeader header
Definition DataBlock.h:35
gsl::span< const std::byte > payload
Definition DataBlock.h:36