Project
Loading...
Searching...
No Matches
ChannelScalers.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
16#ifndef O2_MID_CHANNELSCALERS_H
17#define O2_MID_CHANNELSCALERS_H
18
19#include <cstdint>
20#include <unordered_map>
22
23namespace o2
24{
25namespace mid
26{
27
29{
30 public:
33 void count(const ColumnData& patterns);
34
36 void reset() { mScalers.clear(); }
37
39 void merge(const ChannelScalers& other);
40
42 inline uint8_t getDeId(uint32_t uniqueId) const { return ((uniqueId >> 12) & 0x7F); }
44 inline uint8_t getColumnId(uint32_t uniqueId) const { return ((uniqueId >> 8) & 0xF); }
46 inline uint8_t getCathode(uint32_t uniqueId) const { return ((uniqueId >> 6) & 0x1); }
48 inline uint8_t getLineId(uint32_t uniqueId) const { return ((uniqueId >> 4) & 0x3); }
50 inline uint8_t getStrip(uint32_t uniqueId) const { return (uniqueId & 0xF); }
51
53 const std::unordered_map<uint32_t, uint32_t>& getScalers() const { return mScalers; }
54
55 private:
62 void count(uint8_t deId, uint8_t columnId, int lineId, int cathode, uint16_t pattern);
63
70 inline uint32_t getChannelId(uint8_t deId, uint8_t columnId, int lineId, int strip, int cathode) { return strip | (lineId << 4) | (cathode << 6) | (static_cast<uint32_t>(columnId) << 8) | (static_cast<uint32_t>(deId) << 12); }
71
72 std::unordered_map<uint32_t, uint32_t> mScalers{}; // Channel scalers
73};
74
76std::ostream& operator<<(std::ostream& os, const ChannelScalers& channelScalers);
77
78} // namespace mid
79} // namespace o2
80
81#endif /* O2_MID_CHANNELSCALERS_H */
Strip pattern (aka digits)
void merge(const ChannelScalers &other)
Merges two counters.
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.
void reset()
Resets scalers.
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
VectorOfTObjectPtrs other
std::array< uint16_t, 5 > pattern