Project
Loading...
Searching...
No Matches
ChannelCode.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
12#ifndef O2_DATAFORMATS_MCH_CHANNEL_CODE_H_
13#define O2_DATAFORMATS_MCH_CHANNEL_CODE_H_
14
15#include <RtypesCore.h>
16#include <cstdint>
17#include <string>
18#include "Rtypes.h"
19
20namespace o2::mch
21{
47{
48 public:
49 ChannelCode() = default;
57 ChannelCode(uint16_t deId, uint16_t dePadIndex);
69 ChannelCode(uint16_t solarId, uint8_t elinkIndex, uint8_t channel);
70
72 uint16_t getDeId() const;
75 uint16_t getDePadIndex() const;
77 uint16_t getDsId() const;
79 uint16_t getDsIndex() const;
81 uint16_t getSolarId() const;
83 uint16_t getSolarIndex() const;
85 uint8_t getChannel() const;
87 uint8_t getDeIndex() const;
89 uint8_t getElinkId() const;
91 uint8_t getElinkIndex() const { return getElinkId(); }
92
93 /* whether the code is valid.
94 *
95 * Note that the only way to build an invalid ChannelCode is by using
96 * the default constructor, that we cannot suppress
97 * (needed e.g. by Root or by some vector functions)
98 */
99 bool isValid() const { return mValue != sInvalidValue; }
100
101 /* get the actual code */
102 uint64_t value() const { return mValue; }
103
104 private:
105 void set(uint8_t deIndex,
106 uint16_t dePadIndex,
107 uint16_t dsIndex,
108 uint16_t solarIndex,
109 uint8_t elinkIndex,
110 uint8_t channel);
111
112 private:
113 /* marker for an invalid value. */
114 static const uint64_t sInvalidValue{0xFFFFFFFF};
115
125 uint64_t mValue{sInvalidValue};
126
127 ClassDefNV(ChannelCode, 1); // An identifier for a MCH channel
128};
129
131std::string asString(const ChannelCode& cc);
132
133inline bool operator==(const ChannelCode& a, const ChannelCode& b) { return a.value() == b.value(); }
134inline bool operator!=(const ChannelCode& a, const ChannelCode& b) { return a.value() != b.value(); }
135inline bool operator<(const ChannelCode& a, const ChannelCode& b) { return a.value() < b.value(); }
136inline bool operator>(const ChannelCode& a, const ChannelCode& b) { return a.value() > b.value(); }
137inline bool operator<=(const ChannelCode& a, const ChannelCode& b) { return a.value() <= b.value(); }
138inline bool operator>=(const ChannelCode& a, const ChannelCode& b) { return a.value() >= b.value(); }
139
140} // namespace o2::mch
141#endif
bool isValid() const
Definition ChannelCode.h:99
uint16_t getDsIndex() const
uint8_t getDeIndex() const
uint16_t getSolarId() const
uint16_t getDeId() const
uint16_t getSolarIndex() const
uint16_t getDsId() const
uint64_t value() const
uint8_t getElinkId() const
uint8_t getElinkIndex() const
Definition ChannelCode.h:91
uint8_t getChannel() const
uint16_t getDePadIndex() const
GLboolean GLboolean GLboolean b
Definition glcorearb.h:1233
GLboolean GLboolean GLboolean GLboolean a
Definition glcorearb.h:1233
std::string asString(const o2::mch::TrackMCH &t)
Definition TrackMCH.cxx:104
bool operator!=(const observer_ptr< W1 > &p1, const observer_ptr< W2 > &p2)
bool operator<=(const observer_ptr< W1 > &p1, const observer_ptr< W2 > &p2)
bool operator>=(const observer_ptr< W1 > &p1, const observer_ptr< W2 > &p2)
bool operator<(const observer_ptr< W1 > &p1, const observer_ptr< W2 > &p2)
bool operator>(const observer_ptr< W1 > &p1, const observer_ptr< W2 > &p2)
bool operator==(const observer_ptr< W1 > &p1, const observer_ptr< W2 > &p2)
std::vector< o2::mch::ChannelCode > cc