Project
Loading...
Searching...
No Matches
RawReaderMemory.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#ifndef ALICEO2_EMCAL_RAWREADERMEMORY_H
12#define ALICEO2_EMCAL_RAWREADERMEMORY_H
13
14#include <vector>
15#include <gsl/span>
16#include <Rtypes.h>
17
23#include "Headers/RDHAny.h"
24
25namespace o2
26{
27
28namespace emcal
29{
30
39{
40 public:
47 {
48 public:
50 MinorError() = default;
51
55 MinorError(RawDecodingError::ErrorType_t errortype, int feeID) : mErrorType(errortype), mFEEID(feeID) {}
56
58 ~MinorError() = default;
59
62 void setErrorType(RawDecodingError::ErrorType_t errortype) { mErrorType = errortype; }
63
66 void setFEEID(int feeID) { mFEEID = feeID; }
67
70 RawDecodingError::ErrorType_t getErrorType() const { return mErrorType; }
71
74 int getFEEID() const { return mFEEID; }
75
76 private:
78 int mFEEID;
79 };
80
82 RawReaderMemory(const gsl::span<const char> rawmemory);
83
85 ~RawReaderMemory() = default;
86
89 void setRawMemory(const gsl::span<const char> rawmemory);
90
94 void setRangeSRUDDLs(uint16_t minDDL, uint16_t maxDDL)
95 {
96 mMinSRUDDL = minDDL;
97 mMaxSRUDDL = maxDDL;
98 }
99
103 void next();
104
113 void nextPage(bool resetPayload = true);
114
118 const o2::header::RDHAny& getRawHeader() const;
119
123 const RawBuffer& getRawBuffer() const;
124
127 const RawPayload& getPayload() const { return mRawPayload; }
128
131 gsl::span<const MinorError> getMinorErrors() const { return mMinorErrors; }
132
135 int getPayloadSize() const { return mRawPayload.getPayloadSize(); }
136
139 int getFileSize() const noexcept { return mRawMemoryBuffer.size(); }
140
143 bool hasNext() const { return mCurrentPosition < mRawMemoryBuffer.size(); }
144
145 protected:
149 void init();
150
155 o2::header::RDHAny decodeRawHeader(const void* headerwords);
156
157 private:
158 gsl::span<const char> mRawMemoryBuffer;
159 RawBuffer mRawBuffer;
160 o2::header::RDHAny mRawHeader;
161 RawPayload mRawPayload;
162 RCUTrailer mCurrentTrailer;
163 uint64_t mTrailerPayloadWords = 0;
164 uint16_t mMinSRUDDL = 0;
165 uint16_t mMaxSRUDDL = 39;
166 int mCurrentPosition = 0;
167 int mCurrentFEE = -1;
168 bool mRawHeaderInitialized = false;
169 bool mPayloadInitialized = false;
170 std::vector<MinorError> mMinorErrors;
171
172 ClassDefNV(RawReaderMemory, 1);
173};
174
175} // namespace emcal
176
177} // namespace o2
178
179#endif
Definition of the RAW Data Header.
Information stored in the RCU trailer.
Definition RCUTrailer.h:75
Buffer for EMCAL raw pages.
Definition RawBuffer.h:30
ErrorType_t
Codes for different error types.
Class for raw payload excluding raw data headers from one or multiple DMA pages.
Definition RawPayload.h:37
int getPayloadSize() const
Get the size of the payload.
Definition RawPayload.h:78
Minor (non-crashing) raw decoding errors.
RawDecodingError::ErrorType_t getErrorType() const
Get type of the error.
void setErrorType(RawDecodingError::ErrorType_t errortype)
Set the type of the error.
MinorError(RawDecodingError::ErrorType_t errortype, int feeID)
Main constructor.
int getFEEID() const
Get ID of the FEE.
MinorError()=default
Dummy constructor.
void setFEEID(int feeID)
Set the ID of the FEE equipment.
Reader for raw data produced by the Readout application in in-memory format.
bool hasNext() const
check if more pages are available in the raw file
const o2::header::RDHAny & getRawHeader() const
access to the raw header of the current page
void setRangeSRUDDLs(uint16_t minDDL, uint16_t maxDDL)
Set range for DDLs from SRU (for RCU trailer merging)
int getPayloadSize() const
Return size of the payload.
void setRawMemory(const gsl::span< const char > rawmemory)
set new raw memory chunk
const RawBuffer & getRawBuffer() const
access to the raw buffer (single DMA page)
~RawReaderMemory()=default
Destructor.
void init()
Initialize the raw stream.
void next()
Read next payload from the stream.
gsl::span< const MinorError > getMinorErrors() const
Get minor (non-crashing) raw decoding errors.
const RawPayload & getPayload() const
access to the full raw payload (single or multiple DMA pages)
int getFileSize() const noexcept
get the size of the file in bytes
void nextPage(bool resetPayload=true)
Read the next page from the stream (single DMA page)
o2::header::RDHAny decodeRawHeader(const void *headerwords)
Decode raw header words.
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...