ATLAS Offline Software
MdtCablingData.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2025 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  }
21  // cppcheck-suppress operatorEqVarError; stationIndex, etc intentionally not copied.
23  if (&other != this)
24  m_cache.hash = other.m_cache.hash;
25  return *this;
26  }
27  int8_t& stationIndex{
28  m_cache.cache[0]};
29  int8_t& eta{m_cache.cache[1]};
30  int8_t& phi{m_cache.cache[2]};
31  int8_t& multilayer{m_cache.cache[3]};
32 
34  bool operator==(const MdtCablingOffData& other) const {
35  return m_cache.hash == other.m_cache.hash;
36  }
37  bool operator!=(const MdtCablingOffData& other) const {
38  return m_cache.hash != other.m_cache.hash;
39  }
40  bool operator<(const MdtCablingOffData& other) const {
41  return m_cache.hash < other.m_cache.hash;
42  }
43  bool operator!() const { return !m_cache.hash; }
44 
45  private:
46  union {
47  int hash{0};
48  int8_t cache[4];
49  } m_cache{};
50 };
52  MdtCablingOnData() = default;
53  uint8_t& mrod{m_cache.cache[0]};
54  uint8_t& csm{m_cache.cache[1]};
56 
58  m_cache.hash = other.m_cache.hash;
59  }
60  // cppcheck-suppress operatorEqVarError; subDetectorId, etc intentionally not copied.
62  if (&other != this)
63  m_cache.hash = other.m_cache.hash;
64  return *this;
65  }
66 
67  bool operator==(const MdtCablingOnData& other) const {
68  return m_cache.hash == other.m_cache.hash;
69  }
70  bool operator!=(const MdtCablingOnData& other) const {
71  return m_cache.hash != other.m_cache.hash;
72  }
73  bool operator<(const MdtCablingOnData& other) const {
74  return m_cache.hash < other.m_cache.hash;
75  }
76  bool operator!() const { return !m_cache.hash; }
77 
78  private:
79  union {
80  int hash{0};
82  } m_cache{};
83 };
85  MdtCablingData() = default;
86 
87  int layer{-99};
88  int tube{-99};
89 
91  uint8_t tdcId{0xFF};
93 
95  0xff};
96 
103  static constexpr int legacy_tube_block_size = 100;
104  static constexpr int legacy_layer_block_size = 10;
105 
109 
111  bool operator==(const MdtCablingData& other) const {
112  return this->MdtCablingOffData::operator==(other) &&
113  this->MdtCablingOnData::operator==(other) &&
114  tdcId == other.tdcId && layer == other.layer &&
115  tube == other.tube && channelId == other.channelId;
116  }
117  bool operator!=(const MdtCablingData& other) const {
118  return !((*this) == other);
119  }
120  bool operator<(const MdtCablingData& other) const {
121  if (this->MdtCablingOffData::operator!=(other))
122  return this->MdtCablingOffData::operator<(other);
123  if (this->MdtCablingOnData::operator!=(other))
124  return this->MdtCablingOnData::operator<(other);
125  if (tdcId != other.tdcId)
126  return tdcId < other.tdcId;
127  return channelId < other.channelId;
128  }
129 };
130 
131 std::ostream& operator<<(std::ostream& ostr, const MdtCablingData& obj);
132 
133 std::ostream& operator<<(std::ostream& ostr, const MdtCablingOffData& obj);
134 std::ostream& operator<<(std::ostream& ostr, const MdtCablingOnData& obj);
135 
136 #endif
MdtCablingOnData::operator<
bool operator<(const MdtCablingOnData &other) const
Definition: MdtCablingData.h:73
MdtCablingOffData::MdtCablingOffData
MdtCablingOffData()=default
MdtCablingData::tube
int tube
Layer inside the multilayer.
Definition: MdtCablingData.h:88
xAOD::uint8_t
uint8_t
Definition: Muon_v1.cxx:558
MdtCablingOffData::eta
int8_t & eta
Station of the chamber (i.e, BIL,BIS,etc.)
Definition: MdtCablingData.h:29
MdtCablingOnData
Definition: MdtCablingData.h:51
MdtCablingData::mezzanine_type
uint8_t mezzanine_type
Tube number in the layer.
Definition: MdtCablingData.h:90
MdtCablingOffData::stationIndex
int8_t & stationIndex
Definition: MdtCablingData.h:27
MdtCablingOnData::mrod
uint8_t & mrod
Definition: MdtCablingData.h:53
MdtCablingOnData::cache
uint8_t cache[4]
Definition: MdtCablingData.h:81
MdtCablingOnData::m_cache
union MdtCablingOnData::@167 m_cache
MdtCablingOffData::m_cache
union MdtCablingOffData::@166 m_cache
MdtCablingData::MdtCablingData
MdtCablingData()=default
MdtCablingOnData::operator==
bool operator==(const MdtCablingOnData &other) const
Definition: MdtCablingData.h:67
MdtCablingOnData::MdtCablingOnData
MdtCablingOnData()=default
MdtCablingOffData::phi
int8_t & phi
Eta of the MDT station.
Definition: MdtCablingData.h:30
MdtCablingData::layer_block
int layer_block
Definition: MdtCablingData.h:108
MdtCablingOffData::operator<
bool operator<(const MdtCablingOffData &other) const
Definition: MdtCablingData.h:40
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:34
MdtCablingData::tubes_per_layer
int tubes_per_layer
Helper constants to extract tube,layer, multilayer information.
Definition: MdtCablingData.h:107
MdtCablingOnData::operator!=
bool operator!=(const MdtCablingOnData &other) const
Definition: MdtCablingData.h:70
MdtCablingData::legacy_layer_block_size
static constexpr int legacy_layer_block_size
Definition: MdtCablingData.h:104
MdtCablingData
Definition: MdtCablingData.h:84
MdtCablingOffData::cache
int8_t cache[4]
Definition: MdtCablingData.h:48
MdtCablingOnData::operator!
bool operator!() const
Definition: MdtCablingData.h:76
MdtCablingOffData::operator=
MdtCablingOffData & operator=(const MdtCablingOffData &other)
Definition: MdtCablingData.h:22
MdtCablingData::tdcId
uint8_t tdcId
Mezzanine type.
Definition: MdtCablingData.h:92
MdtCablingData::layer
int layer
Definition: MdtCablingData.h:87
MdtCablingOnData::csm
uint8_t & csm
MROD number.
Definition: MdtCablingData.h:54
MdtCablingOffData::operator!
bool operator!() const
Definition: MdtCablingData.h:43
MdtCablingData::channelId
uint8_t channelId
Identifier of the corresponding tdc.
Definition: MdtCablingData.h:94
MdtCablingData::operator!=
bool operator!=(const MdtCablingData &other) const
Definition: MdtCablingData.h:117
MdtCablingOffData::multilayer
int8_t & multilayer
Phi sector of the MDT station.
Definition: MdtCablingData.h:31
InDetDD::other
@ other
Definition: InDetDD_Defs.h:16
MdtCablingOnData::operator=
MdtCablingOnData & operator=(const MdtCablingOnData &other)
Definition: MdtCablingData.h:61
MdtCablingData::operator<
bool operator<(const MdtCablingData &other) const
Definition: MdtCablingData.h:120
MdtCablingOnData::subdetectorId
uint8_t & subdetectorId
CSM number.
Definition: MdtCablingData.h:55
MdtCablingData::legacy_tube_block_size
static constexpr int legacy_tube_block_size
Identifier of the corresponding channel on the tdc.
Definition: MdtCablingData.h:103
MdtCablingOffData::hash
int hash
Definition: MdtCablingData.h:47
python.PyAthena.obj
obj
Definition: PyAthena.py:132
MdtCablingOnData::MdtCablingOnData
MdtCablingOnData(const MdtCablingOnData &other)
Subdetector number.
Definition: MdtCablingData.h:57
MdtCablingData::operator==
bool operator==(const MdtCablingData &other) const
Equality operator.
Definition: MdtCablingData.h:111
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:37
MdtCablingOffData::MdtCablingOffData
MdtCablingOffData(const MdtCablingOffData &other)
Definition: MdtCablingData.h:18
MdtCablingOnData::hash
int hash
Definition: MdtCablingData.h:80