Project
Loading...
Searching...
No Matches
STUDecoderError.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#include <array>
12#include <iostream>
14
15using namespace o2::emcal;
16
17STUDecoderError::STUDecoderError(int ddlID, ErrorCode_t errcode) : mDDLId(ddlID),
18 mErrorCode(errcode)
19{
20 mMessage = "STU decoding error of type " + getErrorCodeTitle(mErrorCode) + " in DDL " + std::to_string(mDDLId);
21}
22
23void STUDecoderError::printStream(std::ostream& stream) const
24{
25}
26
27std::ostream& o2::emcal::operator<<(std::ostream& stream, const STUDecoderError& error)
28{
29 error.printStream(stream);
30 return stream;
31}
32
34{
35 switch (errorcode) {
37 return 0;
39 return 1;
41 return 2;
43 return 3;
45 return 4;
47 return 5;
49 return 6;
51 return 7;
52 default:
53 return -1;
54 }
55}
57{
58 static constexpr std::size_t NUMERRORCODES = 8;
60 if (errorcode < 0 || errorcode >= NUMERRORCODES) {
62 }
63 return errorcodes[errorcode];
64}
66{
67 switch (errorcode) {
69 return "PageDecoding";
71 return "WordUnexpected";
73 return "IndexUnexpected";
75 return "ADCOverflow";
77 return "FeeIdUnexpected";
79 return "OldPayloadVersion";
81 return "FullPayloadSizeUnexpected";
83 return "ShortPayloadSizeUnexpected";
84 default:
85 return "Unknown";
86 }
87}
89{
90 switch (errorcode) {
92 return "page decoding";
94 return "unexpected word";
96 return "invalid patch index";
98 return "ADC overflow";
100 return "invalid FeeID";
102 return "unsupported old payload version";
104 return "unexpected full payload size";
106 return "unexpected short payload size";
107 default:
108 return "Unknown";
109 }
110}
Handling of STU reconstruction errors.
ErrorCode_t
Error codes of STU decoding.
@ SHORT_PAYLOAD_SIZE_UNEXPECTED
short payload size unexpected
@ UNKNOWN
Unknown error code (needed for conversion to int)
@ INDEX_UNEXPECTED
Patch index unexpected.
@ OLD_PAYLOAD_VERSION
unsupported old payload version
@ PAGE_ERROR
Page decoding failed (missing header)
@ FEEID_UNEXPECTED
FeeID index unexpected.
@ FULL_PAYLOAD_SIZE_UNEXPECTED
full payload size unexpected
static std::string getErrorCodeName(ErrorCode_t errorcode)
Get the name of the error code.
void printStream(std::ostream &stream) const
Print details of the error on the stream.
static ErrorCode_t intToErrorCode(int errorcode)
Convert integer to error code.
STUDecoderError(int ddlID, ErrorCode_t errcode)
Constructor.
static std::string getErrorCodeTitle(ErrorCode_t errorcode)
Get the title of the error code.
static int errorCodeToInt(ErrorCode_t errorcode)
Get integer representation of error code.
GLuint GLuint stream
Definition glcorearb.h:1806
std::ostream & operator<<(std::ostream &stream, const Cell &cell)
Stream operator for EMCAL cell.
Definition Cell.cxx:355
std::string to_string(gsl::span< T, Size > span)
Definition common.h:52