Project
Loading...
Searching...
No Matches
ChannelScalers.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
19namespace o2
20{
21namespace mid
22{
23void ChannelScalers::count(uint8_t deId, uint8_t columnId, int lineId, int cathode, uint16_t pattern)
24{
25 for (int istrip = 0; istrip < 16; ++istrip) {
26 if (pattern & (1 << istrip)) {
27 ++mScalers[getChannelId(deId, columnId, lineId, istrip, cathode)];
28 }
29 }
30}
31
32void ChannelScalers::count(const ColumnData& patterns)
33{
34 count(patterns.deId, patterns.columnId, 0, 1, patterns.getNonBendPattern());
35 for (int iline = 0; iline < 4; ++iline) {
36 count(patterns.deId, patterns.columnId, iline, 0, patterns.getBendPattern(iline));
37 }
38}
39
41{
42 for (auto& item : other.mScalers) {
43 mScalers[item.first] += item.second;
44 }
45}
46
47std::ostream& operator<<(std::ostream& os, const ChannelScalers& channelScalers)
48{
49 auto scalers = channelScalers.getScalers();
50 for (auto& item : scalers) {
51 os << "DeID: " << channelScalers.getDeId(item.first) << " colID: " << channelScalers.getColumnId(item.first) << " lineID: " << channelScalers.getLineId(item.first) << " strip: " << channelScalers.getStrip(item.first) << " cathode: " << channelScalers.getCathode(item.first) << " counts: " << item.second << "\n";
52 }
53 return os;
54}
55
56} // namespace mid
57} // namespace o2
MID channel scalers.
void merge(const ChannelScalers &other)
Merges two counters.
void count(const ColumnData &patterns)
const std::unordered_map< uint32_t, uint32_t > & getScalers() const
Gets the scalers.
uint8_t getCathode(uint32_t uniqueId) const
Gets cathode from unique Id.
uint8_t getLineId(uint32_t uniqueId) const
Gets lineId from unique Id.
uint8_t getDeId(uint32_t uniqueId) const
Gets deId from unique Id.
uint8_t getColumnId(uint32_t uniqueId) const
Gets columnId from unique Id.
uint8_t getStrip(uint32_t uniqueId) const
Gets strip from unique Id.
GLint GLsizei count
Definition glcorearb.h:399
std::ostream & operator<<(std::ostream &os, const Cluster &data)
Definition Cluster.cxx:27
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
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
uint8_t deId
Index of the detection element.
Definition ColumnData.h:30
uint16_t getNonBendPattern() const
Gets the non-bending plane pattern.
Definition ColumnData.h:42
VectorOfTObjectPtrs other
std::array< uint16_t, 5 > pattern