Project
Loading...
Searching...
No Matches
ColumnData.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
16
18
19#include <bitset>
20
21namespace o2
22{
23namespace mid
24{
25
26void ColumnData::setPattern(uint16_t pattern, int cathode, int line)
27{
29 if (cathode == 0) {
31 } else {
33 }
34}
35
36uint16_t ColumnData::getPattern(int cathode, int line) const
37{
39 return (cathode == 0) ? getBendPattern(line) : getNonBendPattern();
40}
41
42void ColumnData::addStrip(int strip, int cathode, int line)
43{
45 int ipat = (cathode == 1) ? 4 : line;
46 patterns[ipat] |= (1 << strip);
47}
48
49bool ColumnData::isStripFired(int istrip, int cathode, int line) const
50{
52 return (cathode == 0) ? isBPStripFired(istrip, line) : isNBPStripFired(istrip);
53}
54
56{
59 if (patterns[4]) {
60 return false;
61 }
62 for (int iline = 0; iline < 4; ++iline) {
63 if (patterns[iline]) {
64 return false;
65 }
66 }
67 return true;
68}
69
71{
73 if (deId != right.deId) {
74 return false;
75 }
76 if (columnId != right.columnId) {
77 return false;
78 }
79 for (size_t ipat = 0; ipat < 5; ++ipat) {
80 if (patterns[ipat] != right.patterns[ipat]) {
81 return false;
82 }
83 }
84 return true;
85}
86
88{
90 if (col1.deId != col2.deId || col1.columnId != col2.columnId) {
91 throw std::runtime_error("Cannot merge ColumnData");
92 }
93 for (size_t ipat = 0; ipat < col1.patterns.size(); ++ipat) {
94 col1.patterns[ipat] |= col2.patterns[ipat];
95 }
96 return col1;
97}
98
99ColumnData operator|(const ColumnData& col1, const ColumnData& col2)
100{
102 ColumnData out = col1;
103 out |= col2;
104 return out;
105}
106
107std::ostream& operator<<(std::ostream& os, const ColumnData& col)
108{
110 os << "deId: " << static_cast<int>(col.deId) << " col: " << static_cast<int>(col.columnId);
111 os << " NBP: " << std::bitset<16>(col.getNonBendPattern());
112 os << " BP: ";
113 for (int iline = 0; iline < 4; ++iline) {
114 os << " " << std::bitset<16>(col.getBendPattern(iline));
115 }
116 return os;
117}
118
119} // namespace mid
120} // namespace o2
Strip pattern (aka digits)
uint32_t col
Definition RawData.h:4
GLdouble GLdouble right
Definition glcorearb.h:4077
ColumnData & operator|=(ColumnData &col1, const ColumnData &col2)
std::ostream & operator<<(std::ostream &os, const Cluster &data)
Definition Cluster.cxx:27
ColumnData operator|(const ColumnData &col1, const ColumnData &col2)
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
Column data structure for MID.
Definition ColumnData.h:29
bool isNBPStripFired(int istrip) const
Checks if strip is fired in the non-bending plane.
Definition ColumnData.h:50
uint8_t columnId
Column in DE.
Definition ColumnData.h:31
uint16_t getBendPattern(int line) const
Gets the bending plane pattern.
Definition ColumnData.h:37
void setPattern(uint16_t pattern, int cathode, int line)
void addStrip(int strip, int cathode, int line)
bool isStripFired(int istrip, int cathode, int line) const
bool isBPStripFired(int istrip, int line) const
Checks if strip is fired in the bending plane.
Definition ColumnData.h:52
uint8_t deId
Index of the detection element.
Definition ColumnData.h:30
bool isEmpty() const
std::array< uint16_t, 5 > patterns
Strip patterns.
Definition ColumnData.h:32
bool operator==(const ColumnData &right) const
void setNonBendPattern(uint16_t pattern)
Sets the non-bending plane pattern.
Definition ColumnData.h:40
void setBendPattern(uint16_t pattern, int line)
Sets the bending plane pattern.
Definition ColumnData.h:35
uint16_t getNonBendPattern() const
Gets the non-bending plane pattern.
Definition ColumnData.h:42
uint16_t getPattern(int cathode, int line) const
std::array< uint16_t, 5 > pattern