Project
Loading...
Searching...
No Matches
RawDataMetric.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// file RawDataMetric.h class Struct for collecting metrics during decoding
13// with Artur.Furs@cern.ch
14//
15#ifndef ALICEO2_FIT_RAWDATAMETRIC_H_
16#define ALICEO2_FIT_RAWDATAMETRIC_H_
17
18#include <array>
19#include <map>
20#include <string>
21#include <cstdint>
22
23namespace o2
24{
25namespace fit
26{
28 RawDataMetric(uint8_t linkID, uint8_t EPID, uint16_t FEEID, bool isRegisteredFEE = true) : mLinkID(linkID), mEPID(EPID), mFEEID(FEEID), mIsRegisteredFEE(isRegisteredFEE) {}
29 ~RawDataMetric() = default;
30
32 kIncompletePayload, // Incomplete payload
33 kWrongDescriptor, // Wrong descriptors in header
34 kWrongChannelMapping, // Wrong channel mapping
35 kEmptyDataBlock, // Only header in data block
36 kDecodedDataBlock // Decoded w/o any issue data block
37 };
38 typedef uint8_t Status_t;
39 constexpr static uint8_t sNbits = 5;
40 inline bool checkBadDataBlock(Status_t metric)
41 {
43 if (!result) { // Incomplete payload has high priority among errors
45 // Lets just check this for a while, w/o any decision for data block
46 // result |= checkStatusBit(metric,EStatusBits::kWrongDescriptor);
48 }
49 return result;
50 }
51 inline void addStatusBit(EStatusBits statusBit, bool val = true)
52 {
53 mBitStats[statusBit] += static_cast<int>(val);
54 }
55
56 inline bool checkStatusBit(Status_t metric, EStatusBits statusBit)
57 {
58 const bool result = (metric & (1 << statusBit)) > 0;
59 mBitStats[statusBit] += static_cast<int>(result);
60 return result;
61 }
62
63 inline static bool isBitActive(Status_t metric, EStatusBits statusBit)
64 {
65 return (metric & (1 << statusBit)) > 0;
66 }
67
68 inline static void setStatusBit(Status_t& metric, EStatusBits statusBit, bool val = true)
69 {
70 metric |= (static_cast<uint8_t>(val) << statusBit);
71 }
72 void print() const;
74 uint8_t mLinkID;
75 uint8_t mEPID;
76 uint16_t mFEEID;
78 std::array<std::size_t, sNbits> mBitStats{};
79 const static std::map<unsigned int, std::string> sMapBitsToNames;
80};
81} // namespace fit
82} // namespace o2
83#endif
GLuint64EXT * result
Definition glcorearb.h:5662
GLuint GLfloat * val
Definition glcorearb.h:1582
TFitResultPtr fit(const size_t nBins, const T *arr, const T xMin, const T xMax, TF1 &func, std::string_view option="")
Definition fit.h:59
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
static bool isBitActive(Status_t metric, EStatusBits statusBit)
bool checkBadDataBlock(Status_t metric)
static const std::map< unsigned int, std::string > sMapBitsToNames
std::array< std::size_t, sNbits > mBitStats
RawDataMetric(uint8_t linkID, uint8_t EPID, uint16_t FEEID, bool isRegisteredFEE=true)
void addStatusBit(EStatusBits statusBit, bool val=true)
static Status_t getAllBitsActivated()
bool checkStatusBit(Status_t metric, EStatusBits statusBit)
static void setStatusBit(Status_t &metric, EStatusBits statusBit, bool val=true)
static constexpr uint8_t sNbits