24ColumnData& ChannelMasksHandler::getMask(uint8_t deId, uint8_t columnId)
27 auto maskIt = mMasks.find(uniqueId);
28 if (maskIt == mMasks.end()) {
29 auto& newMask = mMasks[uniqueId];
31 newMask.columnId = columnId;
32 newMask.patterns.fill(0xFFFF);
35 return maskIt->second;
40 auto&
mask = getMask(deId, columnId);
41 uint16_t
pattern = (1 << strip);
43 mask.setBendPattern(
mask.getBendPattern(lineId) & ~pattern, lineId);
45 mask.setNonBendPattern(
mask.getNonBendPattern() & ~pattern);
53 for (
int iline = 0; iline < 4; ++iline) {
60 for (
auto& bad : badChannelsList) {
68 auto maskIt = mMasks.find(uniqueId);
69 if (maskIt == mMasks.end()) {
72 uint16_t allPatterns = 0;
73 data.setNonBendPattern(
data.getNonBendPattern() & maskIt->second.getNonBendPattern());
74 allPatterns |=
data.getNonBendPattern();
75 for (
int iline = 0; iline < 4; ++iline) {
76 data.setBendPattern(
data.getBendPattern(iline) & maskIt->second.getBendPattern(iline), iline);
77 allPatterns |=
data.getBendPattern(iline);
79 return (allPatterns != 0);
85 std::vector<ColumnData> masks;
86 for (
auto& maskIt : mMasks) {
87 masks.emplace_back(maskIt.second);
96 mMasks[uniqueColumnId] =
mask;
103 for (
auto&
mask : masks) {
109 for (
auto&
mask : masks) {
110 auto& inMask = getMask(
mask.deId,
mask.columnId);
111 inMask.setNonBendPattern(inMask.getNonBendPattern() &
mask.getNonBendPattern());
112 for (
int iline = 0; iline < 4; ++iline) {
113 inMask.setBendPattern(inMask.getBendPattern(iline) &
mask.getBendPattern(iline), iline);
MID channels masks handler.
std::vector< ColumnData > getMasks() const
Gets the masks.
void switchOffChannel(uint8_t deId, uint8_t columnId, int lineId, int strip, int cathode)
void switchOffChannels(const ColumnData &badChannels)
void setFromChannelMask(const ColumnData &mask)
void setFromChannelMasks(const std::vector< ColumnData > &masks)
bool applyMask(ColumnData &data) const
void merge(const std::vector< ColumnData > &masks)
uint16_t getColumnDataUniqueId(uint8_t deId, uint8_t columnId)
Gets an unique ID for the ColumnData.
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
Column data structure for MID.
uint8_t columnId
Column in DE.
uint16_t getBendPattern(int line) const
Gets the bending plane pattern.
uint8_t deId
Index of the detection element.
uint16_t getNonBendPattern() const
Gets the non-bending plane pattern.
std::array< uint16_t, 5 > pattern