ATLAS Offline Software
MdtCablingData.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef MUONMDT_CABLING_MDTCABLINGDATA_H
6 #define MUONMDT_CABLING_MDTCABLINGDATA_H
7 
8 #include <cstdint>
9 #include <iosfwd>
10 /*
11  * @brief: Helper struct containing all information to convert from the offline
12  * identifiers to the online identifiers
13  */
14 
17  MdtCablingOffData() = default;
19  m_cache.hash = other.m_cache.hash;
20  }
22  if (&other != this)
23  m_cache.hash = other.m_cache.hash;
24  return *this;
25  }
26  int8_t& stationIndex{
27  m_cache.cache[0]};
28  int8_t& eta{m_cache.cache[1]};
29  int8_t& phi{m_cache.cache[2]};
30  int8_t& multilayer{m_cache.cache[3]};
31 
33  bool operator==(const MdtCablingOffData& other) const {
34  return m_cache.hash == other.m_cache.hash;
35  }
36  bool operator!=(const MdtCablingOffData& other) const {
37  return m_cache.hash != other.m_cache.hash;
38  }
39  bool operator<(const MdtCablingOffData& other) const {
40  return m_cache.hash < other.m_cache.hash;
41  }
42  bool operator!() const { return !m_cache.hash; }
43 
44  private:
45  union {
46  int hash{0};
47  int8_t cache[4];
48  } m_cache{};
49 };
51  MdtCablingOnData() = default;
52  uint8_t& mrod{m_cache.cache[0]};
53  uint8_t& csm{m_cache.cache[1]};
55 
57  m_cache.hash = other.m_cache.hash;
58  }
60  if (&other != this)
61  m_cache.hash = other.m_cache.hash;
62  return *this;
63  }
64 
65  bool operator==(const MdtCablingOnData& other) const {
66  return m_cache.hash == other.m_cache.hash;
67  }
68  bool operator!=(const MdtCablingOnData& other) const {
69  return m_cache.hash != other.m_cache.hash;
70  }
71  bool operator<(const MdtCablingOnData& other) const {
72  return m_cache.hash < other.m_cache.hash;
73  }
74  bool operator!() const { return !m_cache.hash; }
75 
76  private:
77  union {
78  int hash{0};
80  } m_cache{};
81 };
83  MdtCablingData() = default;
84 
85  int layer{-99};
86  int tube{-99};
87 
89  uint8_t tdcId{0xFF};
91 
93  0xff};
94 
101  static constexpr int legacy_tube_block_size = 100;
102  static constexpr int legacy_layer_block_size = 10;
103 
107 
109  bool operator==(const MdtCablingData& other) const {
110  return this->MdtCablingOffData::operator==(other) &&
111  this->MdtCablingOnData::operator==(other) &&
112  tdcId == other.tdcId && layer == other.layer &&
113  tube == other.tube && channelId == other.channelId;
114  }
115  bool operator!=(const MdtCablingData& other) const {
116  return !((*this) == other);
117  }
118  bool operator<(const MdtCablingData& other) const {
119  if (this->MdtCablingOffData::operator!=(other))
120  return this->MdtCablingOffData::operator<(other);
121  if (this->MdtCablingOnData::operator!=(other))
122  return this->MdtCablingOnData::operator<(other);
123  if (tdcId != other.tdcId)
124  return tdcId < other.tdcId;
125  return channelId < other.channelId;
126  }
127 };
128 
129 std::ostream& operator<<(std::ostream& ostr, const MdtCablingData& obj);
130 
131 std::ostream& operator<<(std::ostream& ostr, const MdtCablingOffData& obj);
132 std::ostream& operator<<(std::ostream& ostr, const MdtCablingOnData& obj);
133 
134 #endif
MdtCablingOnData::operator<
bool operator<(const MdtCablingOnData &other) const
Definition: MdtCablingData.h:71
MdtCablingOffData::MdtCablingOffData
MdtCablingOffData()=default
MdtCablingData::tube
int tube
Layer inside the multilayer.
Definition: MdtCablingData.h:86
xAOD::uint8_t
uint8_t
Definition: Muon_v1.cxx:557
MdtCablingOffData::eta
int8_t & eta
Station of the chamber (i.e, BIL,BIS,etc.)
Definition: MdtCablingData.h:28
MdtCablingOnData
Definition: MdtCablingData.h:50
MdtCablingData::mezzanine_type
uint8_t mezzanine_type
Tube number in the layer.
Definition: MdtCablingData.h:88
MdtCablingOffData::stationIndex
int8_t & stationIndex
Definition: MdtCablingData.h:26
MdtCablingOnData::mrod
uint8_t & mrod
Definition: MdtCablingData.h:52
MdtCablingOnData::cache
uint8_t cache[4]
Definition: MdtCablingData.h:79
MdtCablingData::MdtCablingData
MdtCablingData()=default
MdtCablingOnData::operator==
bool operator==(const MdtCablingOnData &other) const
Definition: MdtCablingData.h:65
MdtCablingOnData::MdtCablingOnData
MdtCablingOnData()=default
MdtCablingOffData::phi
int8_t & phi
Eta of the MDT station.
Definition: MdtCablingData.h:29
MdtCablingData::layer_block
int layer_block
Definition: MdtCablingData.h:106
MdtCablingOffData::operator<
bool operator<(const MdtCablingOffData &other) const
Definition: MdtCablingData.h:39
MdtCablingOffData
Split the offline part of the cabling apart to use it later for sorting.
Definition: MdtCablingData.h:16
MdtCablingOffData::operator==
bool operator==(const MdtCablingOffData &other) const
Multilayer inside the MDT station.
Definition: MdtCablingData.h:33
MdtCablingData::tubes_per_layer
int tubes_per_layer
Helper constants to extract tube,layer, multilayer information.
Definition: MdtCablingData.h:105
MdtCablingOnData::operator!=
bool operator!=(const MdtCablingOnData &other) const
Definition: MdtCablingData.h:68
MdtCablingOffData::m_cache
union MdtCablingOffData::@165 m_cache
MdtCablingData::legacy_layer_block_size
static constexpr int legacy_layer_block_size
Definition: MdtCablingData.h:102
MdtCablingData
Definition: MdtCablingData.h:82
MdtCablingOffData::cache
int8_t cache[4]
Definition: MdtCablingData.h:47
MdtCablingOnData::operator!
bool operator!() const
Definition: MdtCablingData.h:74
MdtCablingOffData::operator=
MdtCablingOffData & operator=(const MdtCablingOffData &other)
Definition: MdtCablingData.h:21
MdtCablingData::tdcId
uint8_t tdcId
Mezzanine type.
Definition: MdtCablingData.h:90
MdtCablingData::layer
int layer
Definition: MdtCablingData.h:85
MdtCablingOnData::csm
uint8_t & csm
MROD number.
Definition: MdtCablingData.h:53
MdtCablingOffData::operator!
bool operator!() const
Definition: MdtCablingData.h:42
MdtCablingData::channelId
uint8_t channelId
Identifier of the corresponding tdc.
Definition: MdtCablingData.h:92
MdtCablingData::operator!=
bool operator!=(const MdtCablingData &other) const
Definition: MdtCablingData.h:115
MdtCablingOffData::multilayer
int8_t & multilayer
Phi sector of the MDT station.
Definition: MdtCablingData.h:30
InDetDD::other
@ other
Definition: InDetDD_Defs.h:16
MdtCablingOnData::operator=
MdtCablingOnData & operator=(const MdtCablingOnData &other)
Definition: MdtCablingData.h:59
MdtCablingData::operator<
bool operator<(const MdtCablingData &other) const
Definition: MdtCablingData.h:118
MdtCablingOnData::subdetectorId
uint8_t & subdetectorId
CSM number.
Definition: MdtCablingData.h:54
MdtCablingData::legacy_tube_block_size
static constexpr int legacy_tube_block_size
Identifier of the corresponding channel on the tdc.
Definition: MdtCablingData.h:101
MdtCablingOffData::hash
int hash
Definition: MdtCablingData.h:46
python.PyAthena.obj
obj
Definition: PyAthena.py:132
MdtCablingOnData::MdtCablingOnData
MdtCablingOnData(const MdtCablingOnData &other)
Subdetector number.
Definition: MdtCablingData.h:56
MdtCablingOnData::m_cache
union MdtCablingOnData::@166 m_cache
MdtCablingData::operator==
bool operator==(const MdtCablingData &other) const
Equality operator.
Definition: MdtCablingData.h:109
operator<<
std::ostream & operator<<(std::ostream &ostr, const MdtCablingData &obj)
Definition: MdtCablingData.cxx:23
MdtCablingOffData::operator!=
bool operator!=(const MdtCablingOffData &other) const
Definition: MdtCablingData.h:36
MdtCablingOffData::MdtCablingOffData
MdtCablingOffData(const MdtCablingOffData &other)
Definition: MdtCablingData.h:18
MdtCablingOnData::hash
int hash
Definition: MdtCablingData.h:78