Project
Loading...
Searching...
No Matches
PadBadChannelMap.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_FOCAL_PADBADCHANNELMAP_H
12#define ALICEO2_FOCAL_PADBADCHANNELMAP_H
13
14#include <array>
15#include <bitset>
16#include <exception>
17#include <string>
18#include "Rtypes.h"
19
21
22namespace o2::focal
23{
24
26{
27 public:
34
35 class ChannelIndexException final : public std::exception
36 {
37 public:
38 ChannelIndexException(std::size_t layer, std::size_t channel) : mLayer(layer), mChannel(channel)
39 {
40 mMessage = "Access to invalid channel: Layer " + std::to_string(mLayer) + ", channel " + std::to_string(mChannel);
41 }
42 ~ChannelIndexException() noexcept final = default;
43
44 const char* what() const noexcept final { return mMessage.data(); }
45
46 std::size_t getLayer() const noexcept { return mLayer; }
47 std::size_t getChannel() const noexcept { return mChannel; }
48
49 private:
50 std::size_t mLayer;
51 std::size_t mChannel;
52 std::string mMessage;
53 };
54
56 ~PadBadChannelMap() = default;
57
58 void reset();
59
60 void setChannelStatus(std::size_t layer, std::size_t channel, MaskType_t channeltype);
61 void setGoodChannel(std::size_t layer, std::size_t channel) { setChannelStatus(layer, channel, MaskType_t::WARM_CHANNEL); }
62 void setBadChannel(std::size_t layer, std::size_t channel) { setChannelStatus(layer, channel, MaskType_t::BAD_CHANNEL); }
63 void setDeadChannel(std::size_t layer, std::size_t channel) { setChannelStatus(layer, channel, MaskType_t::DEAD_CHANNEL); }
64 void setWarmChannel(std::size_t layer, std::size_t channel) { setChannelStatus(layer, channel, MaskType_t::WARM_CHANNEL); }
65
66 MaskType_t getChannelStatus(std::size_t layer, std::size_t channel) const;
67 bool isGoodChannel(std::size_t layer, std::size_t channel) const { return getChannelStatus(layer, channel) == MaskType_t::GOOD_CHANNEL; }
68 bool isBadChannel(std::size_t layer, std::size_t channel) const { return getChannelStatus(layer, channel) == MaskType_t::GOOD_CHANNEL; }
69 bool isDeadChannel(std::size_t layer, std::size_t channel) const { return getChannelStatus(layer, channel) == MaskType_t::GOOD_CHANNEL; }
70 bool isWarmChannel(std::size_t layer, std::size_t channel) const { return getChannelStatus(layer, channel) == MaskType_t::GOOD_CHANNEL; }
71
72 private:
73 void init();
74 std::size_t getChannelIndex(std::size_t layer, std::size_t channel) const;
75 std::array<uint8_t, constants::PADS_NLAYERS * constants::PADLAYER_MODULE_NCHANNELS> mChannelStatus;
76
77 ClassDefNV(PadBadChannelMap, 1)
78};
79
80} // namespace o2::focal
81#endif // ALICEO2_FOCAL_PADBADCHANNELMAP_H
ChannelIndexException(std::size_t layer, std::size_t channel)
bool isDeadChannel(std::size_t layer, std::size_t channel) const
bool isWarmChannel(std::size_t layer, std::size_t channel) const
bool isBadChannel(std::size_t layer, std::size_t channel) const
void setGoodChannel(std::size_t layer, std::size_t channel)
MaskType_t getChannelStatus(std::size_t layer, std::size_t channel) const
void setWarmChannel(std::size_t layer, std::size_t channel)
void setChannelStatus(std::size_t layer, std::size_t channel, MaskType_t channeltype)
bool isGoodChannel(std::size_t layer, std::size_t channel) const
void setDeadChannel(std::size_t layer, std::size_t channel)
void setBadChannel(std::size_t layer, std::size_t channel)
GLenum GLuint GLint GLint layer
Definition glcorearb.h:1310
std::string to_string(gsl::span< T, Size > span)
Definition common.h:52