ATLAS Offline Software
NrpcCablingData.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef MUON_CABLING_NRPCCABLINGDATA_H
6 #define MUON_CABLING_NRPCCABLINGDATA_H
7 
8 #include <cstdint>
9 #include <iostream>
10 #include <set>
11 /*
12  * @brief: Helper struct containing all information to convert from the offline
13  * identifiers to the online identifiers
14  */
15 
18 #define CABLING_OPERATORS(CL_NAME) \
19  bool operator<(const CL_NAME& other) const { return m_cache.hash < other.m_cache.hash; } \
20  bool operator==(const CL_NAME& other) const {return m_cache.hash == other.m_cache.hash; } \
21  bool operator!=(const CL_NAME& other) const { return m_cache.hash != other.m_cache.hash; } \
22  bool operator!() const {return !m_cache.hash;} \
23  \
24  CL_NAME() = default; \
25  CL_NAME( const CL_NAME& other): CL_NAME() { \
26  m_cache.hash = other.m_cache.hash; \
27  } \
28  CL_NAME& operator=(const CL_NAME& other) { \
29  if (&other != this) m_cache.hash = other.m_cache.hash; \
30  return *this; \
31  }
32 
36 
37  int8_t& stationIndex{m_cache.cache[0]};
38  int8_t& eta{m_cache.cache[1]};
39  int8_t& phi{m_cache.cache[2]};
40  int8_t& doubletR{m_cache.cache[3]};
41 
42  int8_t& doubletPhi{m_cache.cache[4]};
43  int8_t& doubletZ{m_cache.cache[5]};
44  int8_t& gasGap{m_cache.cache[6]};
45 
50  static constexpr int8_t measPhiBit = 1 << 0;
51  static constexpr int8_t stripSideBit = 1 << 1;
52 
54  bool measuresPhi() const { return m_measPhiStrip & measPhiBit; }
56  bool stripSide() const { return m_measPhiStrip & stripSideBit; }
60  void setMeasPhiAndSide(bool measPhi, bool stripSide) {
62  }
63  private:
64  union {
65  long int hash{0};
66  int8_t cache[8];
67  } m_cache{};
68 
69  int8_t& m_measPhiStrip{m_cache.cache[7]};
70 
71 };
72 
81  int16_t& tdc{m_cache.cache[2]};
82  private:
83  union {
84  int64_t hash{0};
86  } m_cache{};
87 };
88 
96  public:
102  bool operator<(const NrpcTdcStripRange& other ) const{
103  return lastStrip < other.firstStrip;
104  }
105  };
106 
109  public:
115  bool operator<(const NrpcTdcChannelRange& other) const{
116  return lastChannel < other.firstChannel;
117  }
118 };
119 
122  NrpcCablingData() = default;
123  uint8_t strip{0}; // Offline strip number
124  uint8_t channelId{0}; // Online tdc channel number
125 
127  bool operator<(const NrpcCablingData&) const {return false; }
129  bool operator==(const NrpcCablingData& other) const {
130  return strip == other.strip && channelId == other.channelId &&
131  static_cast<const NrpcCablingOfflineID&>(*this) == other &&
132  static_cast<const NrpcCablingOnlineID&>(*this) == other;
133  }
134  bool operator!=(NrpcCablingData& other) const {return ! ((*this) == other);}
135 };
136 
141  NrpcCablingCoolData() = default;
143  bool operator<(const NrpcCablingCoolData&) const { return false;}
144 };
152 
155  if (static_cast<const NrpcCablingOnlineID&>(*this) != other) {
156  return static_cast<const NrpcCablingOnlineID&>(*this) < other;
157  }
158  return static_cast<const NrpcTdcStripRange&>(*this) < other;
159  }
160 };
163  NrpcCablOnDataByTdc() = default;
168 
170  bool operator<(const NrpcCablOnDataByTdc& other) const{
171  if (static_cast<const NrpcCablingOnlineID&>(*this) != other) {
172  return static_cast<const NrpcCablingOnlineID&>(*this) < other;
173  }
174  return static_cast<const NrpcTdcChannelRange&>(*this) < other;
175  }
176 };
177 
179 inline bool operator<(const NrpcCablOnDataByStrip& a,const NrpcCablingData& b) {
180  return a.lastStrip < b.strip;
181 }
182 inline bool operator<(const NrpcCablingData& a, const NrpcCablOnDataByStrip& b) {
183  return a.strip < b.firstStrip;
184 }
186  if (static_cast<const NrpcCablingOnlineID&>(a) != static_cast<const NrpcCablingOnlineID&>(b)) {
187  return static_cast<const NrpcCablingOnlineID&>(a) < b;
188  }
189  return static_cast<const NrpcTdcStripRange&>(a) < b;
190 }
192  if (static_cast<const NrpcCablingOnlineID&>(a) != b) return static_cast<const NrpcCablingOnlineID&>(a) < b;
193  return static_cast<const NrpcTdcStripRange&>(a) < b;
194 }
195 
196 inline bool operator<(const NrpcCablOnDataByTdc& a, const NrpcCablingData& b) {
197  if (static_cast<const NrpcCablingOnlineID&>(a) != b) return static_cast<const NrpcCablingOnlineID&>(a) < b;
198  return a.lastChannel < b.channelId;
199 }
200 inline bool operator<(const NrpcCablingData& a, const NrpcCablOnDataByTdc& b) {
201  if (static_cast<const NrpcCablingOnlineID&>(a) != b) return static_cast<const NrpcCablingOnlineID&>(a) < b;
202  return a.channelId < b.firstChannel;
203 }
204 using NrpcCablOnDataByStripSet = std::set<NrpcCablOnDataByStrip, std::less<>>;
205 
206 
208 std::ostream& operator<<(std::ostream& ostr, const NrpcCablingOfflineID& obj);
209 std::ostream& operator<<(std::ostream& ostr, const NrpcCablingOnlineID& obj);
210 std::ostream& operator<<(std::ostream& ostr, const NrpcTdcStripRange& obj);
211 std::ostream& operator<<(std::ostream& ostr, const NrpcTdcChannelRange& obj);
212 std::ostream& operator<<(std::ostream& ostr, const NrpcCablingData& obj);
213 std::ostream& operator<<(std::ostream& ostr, const NrpcCablingCoolData& obj);
214 std::ostream& operator<<(std::ostream& ostr, const NrpcCablOnDataByTdc& obj);
215 std::ostream& operator<<(std::ostream& ostr, const NrpcCablOnDataByStrip& obj);
216 
217 #undef CABLING_OPERATORS
218 #endif
NrpcTdcStripRange::firstStrip
uint8_t firstStrip
First strip covered by the Tdc chip.
Definition: NrpcCablingData.h:98
NrpcCablOnDataByTdc::NrpcCablOnDataByTdc
NrpcCablOnDataByTdc()=default
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
NrpcCablingOfflineID::doubletZ
int8_t & doubletZ
doublet Phi -> 1,2
Definition: NrpcCablingData.h:43
NrpcCablingOfflineID::gasGap
int8_t & gasGap
doublet Z -> 1,2
Definition: NrpcCablingData.h:44
NrpcCablOnDataByTdc
Struct to build the online -> offline map.
Definition: NrpcCablingData.h:162
NrpcCablingOfflineID
Representation of the offline Identifier in a more tangible format.
Definition: NrpcCablingData.h:34
xAOD::uint8_t
uint8_t
Definition: Muon_v1.cxx:575
NrpcCablOnDataByTdc::NrpcCablOnDataByTdc
NrpcCablOnDataByTdc(const NrpcCablingCoolData &data)
Definition: NrpcCablingData.h:164
NrpcCablingCoolData
Struct to represent all cabling information coming from the cabling database per channel.
Definition: NrpcCablingData.h:140
NrpcCablingData::operator!=
bool operator!=(NrpcCablingData &other) const
Definition: NrpcCablingData.h:134
NrpcCablingOnlineID::hash
int64_t hash
Definition: NrpcCablingData.h:84
NrpcCablingOnlineID::subDetector
int16_t & subDetector
Identifier of the subdetector region in the readout BA / BC etc.
Definition: NrpcCablingData.h:77
NrpcCablingOfflineID::eta
int8_t & eta
Station of the chamber (i.e, BIL,BIS,etc.)
Definition: NrpcCablingData.h:38
NrpcCablOnDataByStrip::operator<
bool operator<(const NrpcCablOnDataByStrip &other) const
Equality operator of all Identifier fields.
Definition: NrpcCablingData.h:154
NrpcCablingOfflineID::hash
long int hash
Definition: NrpcCablingData.h:65
xAOD::int16_t
setScaleOne setStatusOne setSaturated int16_t
Definition: gFexGlobalRoI_v1.cxx:55
NrpcCablingOnlineID::cache
int16_t cache[4]
Definition: NrpcCablingData.h:85
NrpcCablOnDataByStrip::NrpcCablOnDataByStrip
NrpcCablOnDataByStrip()=default
NrpcCablingOfflineID::m_measPhiStrip
int8_t & m_measPhiStrip
Definition: NrpcCablingData.h:69
NrpcCablingOfflineID::measuresPhi
bool measuresPhi() const
: Does the channel measure phi
Definition: NrpcCablingData.h:54
NrpcCablingOfflineID::measPhiBit
static constexpr int8_t measPhiBit
gas gap -> 1-3
Definition: NrpcCablingData.h:50
NrpcCablingOfflineID::cache
int8_t cache[8]
Definition: NrpcCablingData.h:66
NrpcCablingData::NrpcCablingData
NrpcCablingData()=default
NrpcCablingOfflineID::setMeasPhiAndSide
void setMeasPhiAndSide(bool measPhi, bool stripSide)
Sets the measuresPhi & stripSide fields of the cabling data object.
Definition: NrpcCablingData.h:60
NrpcCablingData
Cabling information shipped around the Digi <-> Rdo conversions.
Definition: NrpcCablingData.h:121
NrpcCablOnDataByStripSet
std::set< NrpcCablOnDataByStrip, std::less<> > NrpcCablOnDataByStripSet
Definition: NrpcCablingData.h:204
NrpcCablingOfflineID::m_cache
union NrpcCablingOfflineID::@169 m_cache
NrpcCablingCoolData::operator<
bool operator<(const NrpcCablingCoolData &) const
Delete the smaller operator.
Definition: NrpcCablingData.h:143
NrpcCablingCoolData::NrpcCablingCoolData
NrpcCablingCoolData()=default
CABLING_OPERATORS
#define CABLING_OPERATORS(CL_NAME)
Helper macro to define the constructors and comparison operators of the Online & Offline Identifiers ...
Definition: NrpcCablingData.h:18
NrpcCablingOfflineID::stationIndex
int8_t & stationIndex
Definition: NrpcCablingData.h:37
NrpcCablOnDataByStrip::NrpcCablOnDataByStrip
NrpcCablOnDataByStrip(const NrpcCablingCoolData &data)
Definition: NrpcCablingData.h:148
NrpcCablingData::operator==
bool operator==(const NrpcCablingData &other) const
Equality operator of all Identifier fields.
Definition: NrpcCablingData.h:129
NrpcCablOnDataByTdc::operator<
bool operator<(const NrpcCablOnDataByTdc &other) const
Equality operator of all Identifier fields.
Definition: NrpcCablingData.h:170
operator<
bool operator<(const NrpcCablOnDataByStrip &a, const NrpcCablingData &b)
Let's define the operator needed to read the cabling sets.
Definition: NrpcCablingData.h:179
NrpcTdcChannelRange::firstChannel
uint8_t firstChannel
First tdc channel.
Definition: NrpcCablingData.h:111
NrpcTdcStripRange
Depending on whether the cabling map shall convert offline -> online or online -> offline extra infor...
Definition: NrpcCablingData.h:95
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
NrpcTdcStripRange::lastStrip
uint8_t lastStrip
Last strip covered by the Tdc chip (inclusive)
Definition: NrpcCablingData.h:100
NrpcCablingData::channelId
uint8_t channelId
Definition: NrpcCablingData.h:124
operator<<
std::ostream & operator<<(std::ostream &ostr, const NrpcCablingOfflineID &obj)
Outstream operators.
Definition: NrpcCablingData.cxx:7
NrpcCablingOnlineID::tdcSector
int16_t & tdcSector
Unique Identifier of the Rpc chamber from an online perspective.
Definition: NrpcCablingData.h:79
NrpcCablingOfflineID::doubletPhi
int8_t & doubletPhi
doublet R -> 1,2
Definition: NrpcCablingData.h:42
NrpcCablingData::operator<
bool operator<(const NrpcCablingData &) const
Deactivate the sorting operator here.
Definition: NrpcCablingData.h:127
a
TList * a
Definition: liststreamerinfos.cxx:10
InDetDD::other
@ other
Definition: InDetDD_Defs.h:16
NrpcCablingOfflineID::stripSideBit
static constexpr int8_t stripSideBit
Definition: NrpcCablingData.h:51
NrpcTdcStripRange::operator<
bool operator<(const NrpcTdcStripRange &other) const
Sorting operator. Needed to build consistent sets.
Definition: NrpcCablingData.h:102
NrpcCablingOnlineID::tdc
int16_t & tdc
TDC chip.
Definition: NrpcCablingData.h:81
NrpcTdcChannelRange
Covered channels by the Online Identifier Object.
Definition: NrpcCablingData.h:108
NrpcCablOnDataByStrip
Struct to build the offline -> online map.
Definition: NrpcCablingData.h:146
NrpcTdcChannelRange::lastChannel
uint8_t lastChannel
Last tdc channel (inclusive)
Definition: NrpcCablingData.h:113
NrpcCablingOnlineID
Struct summarizing all the Identifier fields to uniquely Identify a Nrpc TDC chip.
Definition: NrpcCablingData.h:74
NrpcCablingOfflineID::phi
int8_t & phi
Eta of the RPC station.
Definition: NrpcCablingData.h:39
NrpcCablingOfflineID::doubletR
int8_t & doubletR
Phi sector of the RPC station.
Definition: NrpcCablingData.h:40
python.PyAthena.obj
obj
Definition: PyAthena.py:135
NrpcCablingOfflineID::stripSide
bool stripSide() const
: Is the strip readout on the opposite side
Definition: NrpcCablingData.h:56
NrpcTdcChannelRange::operator<
bool operator<(const NrpcTdcChannelRange &other) const
Sorting operator. Needed to build consistent sets.
Definition: NrpcCablingData.h:115
NrpcCablingOnlineID::m_cache
union NrpcCablingOnlineID::@170 m_cache
NrpcCablingData::strip
uint8_t strip
Definition: NrpcCablingData.h:123