ATLAS Offline Software
TgcL1Rdo.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef MUONRDO_TGCL1RDO_H
6 #define MUONRDO_TGCL1RDO_H
7 
8 #include <inttypes.h>
9 #include "MuonRDO/TgcL1RawData.h"
11 #include "AthenaKernel/CLASS_DEF.h"
13 
14 /*
15  TGC collection class used for bare RDO ByteStream Conversion.
16  This class holds one ROD information
17 
18  @author Tadashi Maeno
19  based on the previous one by H.Kurashige
20 */
21 class TgcL1Rdo : public DataVector<TgcL1RawData>
22 {
23 public:
24  // typedef required by container
25  typedef uint16_t ID;
27 /*
28  enum
29  {
30  MAX_N_SIDE = 2, // A and C side
31  MAX_N_ROD = 12, // max number of ROD in each side
32  MAX_ID = MAX_N_SIDE*MAX_N_ROD
33  };
34 */
35  struct Errors
36  {
37  unsigned badBcID:1;
38  unsigned badL1Id:1;
39  unsigned timedout:1;
40  unsigned badData:1;
41  unsigned overflow:1;
42  };
43 
44  struct SRodStatus
45  {
46  unsigned EC_RXsend:1; // Error in request to send an event via RXlink
47  unsigned EC_FELdown:1; // A Front End link has gone down - abandoned
48  unsigned EC_frame:1; // Invalid FE link framing words
49  unsigned EC_Glnk:1; // G-link error
50  unsigned EC_xor:1; // Invalid XOR event checksum
51  unsigned EC_ovfl:1; // Input FE event is too long or FE FIFO overflow
52  unsigned EC_timeout:1; // Timeout expired for at least one FE link
53  unsigned EC_xormezz:1; // Bad XOR checksum from mezz board
54  unsigned EC_wc0:1; // Event has WC=0
55  unsigned EC_L1ID:1; // L1ID mismatch (TTC EVID FIFO vs local).
56  unsigned EC_nohdr:1; // First word is not header
57  unsigned EC_rectype:1; // Unrecognized record type
58  unsigned EC_null:1; // Unexpected nulls in FE input
59  unsigned EC_order:1; // Word is out of order
60  unsigned EC_LDB:1; // Invalid or unexpected Local Data Block ID
61  unsigned EC_RXovfl:1; // RXfifo has overflowed
62  unsigned EC_SSWerr:1; // SSW reports T1C, NRC, T2C, or GlinkNoLock error
63  unsigned EC_sbid:1; // Illegal SB ID
64  unsigned EC_unxsbid:1; // Unexpected SB ID received
65  unsigned EC_dupsb:1; // SB ID is duplicated in the event
66  unsigned EC_ec4:1; // Unexpected SB L1 Event ID(lo 4)
67  unsigned EC_bc:1; // Unexpected SB BCID
68  unsigned EC_celladr:1; // Invalid cell address
69  unsigned EC_hitovfl:1; // Too many hits in event
70  unsigned EC_trgbit:1; // Unexpected trigger bits
71  unsigned EC_badEoE:1; // Bad End-of-event marker received, not 0xFCA
72  unsigned EC_endWCnot0:1; // WC not 0 after EoE marker
73  unsigned EC_noEoE:1; // No End-of-event marker received
74  };
75 
76  struct LocalStatus
77  {
78  unsigned mergedHitBCs:1;
79  unsigned mergedTrackletBCs:1;
80  unsigned sortedHits:1;
81  unsigned sortedTracklets:1;
82  unsigned hasRoI:1;
83  unsigned fakeSsw:1;
84  unsigned fill1:10;
85  };
86 
87  /* Constructors
88  */
90  TgcL1Rdo();
91 
93  TgcL1Rdo(uint16_t id, IdentifierHash idHash);
94 
95  // P1
98  uint16_t bcId,
99  uint16_t l1Id);
100 
101  // Destructor
102  virtual ~TgcL1Rdo()
103  {
104  }
105 
106  // Identifier
108  {
109  return m_id;
110  }
111 
112  // Identifier
114  {
115  return m_idHash;
116  }
117 
118  // set methods
120  {
121  m_l1Id = v;
122  }
124  {
125  m_bcId = v;
126  }
128  {
129  m_triggerType = v;
130  }
132 
133  // get methods
135  {
136  return m_subDetectorId;
137  }
138  uint16_t srodId() const
139  {
140  return m_srodId;
141  }
143  {
144  return m_triggerType;
145  }
146  uint16_t bcId() const
147  {
148  return m_bcId;
149  }
150  uint16_t l1Id() const
151  {
152  return m_l1Id;
153  }
154 
155  // class method for RawData identification
156  static uint16_t identifyRawData (const TgcL1RawData &rawData);
157 
158  const Errors& errors() const
159  {
160  return m_errors;
161  }
163  {
164  // FIXME BUG: This is not portable!
165  // The layout of bitfields in a structure is implementation-defined.
166  union cnvErrors {
167  uint16_t data;
168  Errors errors;
169  } cnv;
170  cnv.data = data;
171  m_errors = cnv.errors;
172  }
173 
174  const SRodStatus& srodStatus() const
175  {
176  return m_srodStatus;
177  }
179  {
180  // FIXME BUG: This is not portable!
181  // The layout of bitfields in a structure is implementation-defined.
182  union cnvSRodStatus {
183  uint16_t data;
185  } cnv;
186  cnv.data = data;
187  m_srodStatus = cnv.srodStatus;
188  }
189 
190  const LocalStatus& localStatus() const
191  {
192  return m_localStatus;
193  }
195  {
196  // FIXME BUG: This is not portable!
197  // The layout of bitfields in a structure is implementation-defined.
198  union cnvLocalStatus {
199  uint16_t data;
201  } cnv;
202  cnv.data = data;
203  m_localStatus = cnv.localStatus;
204  }
205 
206  uint32_t orbit() const
207  {
208  return m_orbit;
209  }
211  {
212  m_orbit = orbit;
213  }
214 
216  {
217  return m_version;
218  }
219 
221  {
222  m_version = version;
223  }
224 
225  void clear();
226 
227  // online ID calculator
229 
230 private:
231  // Returns offset, MAX_N_SROD
232  static std::pair<int, int> initOnlineId();
233 
234  uint16_t m_version = 0U; // starting August 2006 version = 300. Before that, version = 0
235 
238 
241 
242  // online IDs
245 
246  // Trigger Type
248 
249  // BCID and L1ID on ROD
252 
253  struct Errors m_errors{};
257 };
258 
260 std::ostream& operator<<(std::ostream& sl, const TgcL1Rdo& coll);
261 
262 CLASS_DEF(TgcL1Rdo,29142172,0)
263 
264 // Class needed only for persistency
266 CLASS_DEF(TGC_L1RDO_vector, 147069493, 1)
267 
268 #endif
TgcL1Rdo::LocalStatus::fakeSsw
unsigned fakeSsw
Definition: TgcL1Rdo.h:83
TgcL1Rdo::m_srodStatus
Definition: TgcL1Rdo.h:254
TgcL1Rdo::SRodStatus::EC_frame
unsigned EC_frame
Definition: TgcL1Rdo.h:48
TgcL1Rdo::Errors
Definition: TgcL1Rdo.h:36
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
TgcL1Rdo::SRodStatus::EC_wc0
unsigned EC_wc0
Definition: TgcL1Rdo.h:54
TgcL1Rdo::SRodStatus::EC_SSWerr
unsigned EC_SSWerr
Definition: TgcL1Rdo.h:62
TgcL1Rdo::SRodStatus::EC_L1ID
unsigned EC_L1ID
Definition: TgcL1Rdo.h:55
TgcL1Rdo::SRodStatus
Definition: TgcL1Rdo.h:45
TgcL1Rdo::triggerType
uint16_t triggerType() const
Definition: TgcL1Rdo.h:142
TgcL1Rdo::m_l1Id
uint16_t m_l1Id
Definition: TgcL1Rdo.h:251
TgcL1Rdo::setLocalStatus
void setLocalStatus(uint32_t data)
Definition: TgcL1Rdo.h:194
TgcL1Rdo::SRodStatus::EC_LDB
unsigned EC_LDB
Definition: TgcL1Rdo.h:60
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
TgcL1Rdo::m_bcId
uint16_t m_bcId
Definition: TgcL1Rdo.h:250
TgcL1Rdo::m_triggerType
uint16_t m_triggerType
Definition: TgcL1Rdo.h:247
TgcL1Rdo::SRodStatus::EC_rectype
unsigned EC_rectype
Definition: TgcL1Rdo.h:57
TgcL1Rdo::SRodStatus::EC_noEoE
unsigned EC_noEoE
Definition: TgcL1Rdo.h:73
TgcL1Rdo::LocalStatus::sortedHits
unsigned sortedHits
Definition: TgcL1Rdo.h:80
TgcL1Rdo::SRodStatus::EC_timeout
unsigned EC_timeout
Definition: TgcL1Rdo.h:52
TgcL1Rdo::orbit
uint32_t orbit() const
Definition: TgcL1Rdo.h:206
TgcL1Rdo::SRodStatus::EC_Glnk
unsigned EC_Glnk
Definition: TgcL1Rdo.h:49
TgcL1Rdo::SRodStatus::EC_badEoE
unsigned EC_badEoE
Definition: TgcL1Rdo.h:71
TgcL1Rdo::setSRodStatus
void setSRodStatus(uint32_t data)
Definition: TgcL1Rdo.h:178
TgcL1Rdo::l1Id
uint16_t l1Id() const
Definition: TgcL1Rdo.h:150
TgcL1Rdo::Errors::overflow
unsigned overflow
Definition: TgcL1Rdo.h:41
TgcL1Rdo::setVersion
void setVersion(uint16_t version)
Definition: TgcL1Rdo.h:220
TgcL1Rdo::SRodStatus::EC_sbid
unsigned EC_sbid
Definition: TgcL1Rdo.h:63
TgcL1Rdo::m_version
uint16_t m_version
Definition: TgcL1Rdo.h:234
TgcL1Rdo::DIGIT
TgcL1RawData DIGIT
Definition: TgcL1Rdo.h:26
TgcL1Rdo::SRodStatus::EC_endWCnot0
unsigned EC_endWCnot0
Definition: TgcL1Rdo.h:72
TgcL1Rdo::SRodStatus::EC_RXsend
unsigned EC_RXsend
Definition: TgcL1Rdo.h:46
TgcL1Rdo::SRodStatus::EC_FELdown
unsigned EC_FELdown
Definition: TgcL1Rdo.h:47
TgcL1Rdo::SRodStatus::EC_RXovfl
unsigned EC_RXovfl
Definition: TgcL1Rdo.h:61
operator<<
std::ostream & operator<<(std::ostream &sl, const TgcL1Rdo &coll)
Overload of << operator for std::ostream for debug output.
Definition: TgcL1Rdo.cxx:98
TgcL1Rdo::SRodStatus::EC_ec4
unsigned EC_ec4
Definition: TgcL1Rdo.h:66
TgcL1Rdo::SRodStatus::EC_xormezz
unsigned EC_xormezz
Definition: TgcL1Rdo.h:53
TgcL1Rdo::setTriggerType
void setTriggerType(uint16_t v)
Definition: TgcL1Rdo.h:127
TgcL1RawData.h
TgcL1Rdo::SRodStatus::EC_ovfl
unsigned EC_ovfl
Definition: TgcL1Rdo.h:51
TgcL1Rdo::identify
uint16_t identify() const
Definition: TgcL1Rdo.h:107
TgcL1Rdo::identifyRawData
static uint16_t identifyRawData(const TgcL1RawData &rawData)
Definition: TgcL1Rdo.cxx:45
TgcL1Rdo::m_errors
Definition: TgcL1Rdo.h:253
TgcL1Rdo::~TgcL1Rdo
virtual ~TgcL1Rdo()
Definition: TgcL1Rdo.h:102
xAOD::uint16_t
setWord1 uint16_t
Definition: eFexEMRoI_v1.cxx:93
TgcL1Rdo::SRodStatus::EC_null
unsigned EC_null
Definition: TgcL1Rdo.h:58
TgcL1RawData
An unit object of TGC SROD output.
Definition: TgcL1RawData.h:21
TgcL1Rdo::Errors::badData
unsigned badData
Definition: TgcL1Rdo.h:40
TgcL1Rdo::setL1Id
void setL1Id(uint32_t v)
Definition: TgcL1Rdo.h:119
TgcL1Rdo::m_idHash
IdentifierHash m_idHash
OFFLINE hash of this collection.
Definition: TgcL1Rdo.h:240
TgcL1Rdo::version
uint16_t version() const
Definition: TgcL1Rdo.h:215
TgcL1Rdo::LocalStatus::fill1
unsigned fill1
Definition: TgcL1Rdo.h:84
TgcL1Rdo::localStatus
const LocalStatus & localStatus() const
Definition: TgcL1Rdo.h:190
TgcL1Rdo::bcId
uint16_t bcId() const
Definition: TgcL1Rdo.h:146
TgcL1Rdo::Errors::badBcID
unsigned badBcID
Definition: TgcL1Rdo.h:37
TgcL1Rdo::Errors::timedout
unsigned timedout
Definition: TgcL1Rdo.h:39
TgcL1Rdo::initOnlineId
static std::pair< int, int > initOnlineId()
Definition: TgcL1Rdo.cxx:50
DataVector
Derived DataVector<T>.
Definition: DataVector.h:794
TgcL1Rdo::SRodStatus::EC_trgbit
unsigned EC_trgbit
Definition: TgcL1Rdo.h:70
TgcL1Rdo::subDetectorId
uint16_t subDetectorId() const
Definition: TgcL1Rdo.h:134
TgcL1Rdo::setOnlineId
void setOnlineId(uint16_t subDetectorId, uint16_t srodId)
Definition: TgcL1Rdo.cxx:35
TgcL1Rdo::SRodStatus::EC_nohdr
unsigned EC_nohdr
Definition: TgcL1Rdo.h:56
TgcL1Rdo::Errors::badL1Id
unsigned badL1Id
Definition: TgcL1Rdo.h:38
TgcL1Rdo::TgcL1Rdo
TgcL1Rdo()
Default constructor.
Definition: TgcL1Rdo.cxx:9
TgcL1Rdo::setBcId
void setBcId(uint16_t v)
Definition: TgcL1Rdo.h:123
TgcL1Rdo::SRodStatus::EC_hitovfl
unsigned EC_hitovfl
Definition: TgcL1Rdo.h:69
IdentifierHash.h
TgcL1Rdo::m_orbit
uint32_t m_orbit
Definition: TgcL1Rdo.h:256
TgcL1Rdo::SRodStatus::EC_unxsbid
unsigned EC_unxsbid
Definition: TgcL1Rdo.h:64
TgcL1Rdo::m_subDetectorId
uint16_t m_subDetectorId
Definition: TgcL1Rdo.h:243
TgcL1Rdo::m_localStatus
Definition: TgcL1Rdo.h:255
TgcL1Rdo::SRodStatus::EC_xor
unsigned EC_xor
Definition: TgcL1Rdo.h:50
TgcL1Rdo::identifyHash
IdentifierHash identifyHash() const
Definition: TgcL1Rdo.h:113
TgcL1Rdo::m_id
uint16_t m_id
ID of this instance.
Definition: TgcL1Rdo.h:237
TgcL1Rdo::setOrbit
void setOrbit(uint32_t orbit)
Definition: TgcL1Rdo.h:210
python.PyAthena.v
v
Definition: PyAthena.py:154
DataVector.h
An STL vector of pointers that by default owns its pointed-to elements.
TgcL1Rdo::calculateOnlineId
static uint16_t calculateOnlineId(uint16_t subDetectorId, uint16_t rodId)
Definition: TgcL1Rdo.cxx:57
TgcL1Rdo::LocalStatus::hasRoI
unsigned hasRoI
Definition: TgcL1Rdo.h:82
TgcL1Rdo::LocalStatus::sortedTracklets
unsigned sortedTracklets
Definition: TgcL1Rdo.h:81
TgcL1Rdo::clear
void clear()
Definition: TgcL1Rdo.cxx:104
TgcL1Rdo::ID
uint16_t ID
Definition: TgcL1Rdo.h:25
CLASS_DEF
#define CLASS_DEF(NAME, CID, VERSION)
associate a clid and a version to a type eg
Definition: Control/AthenaKernel/AthenaKernel/CLASS_DEF.h:64
TgcL1Rdo::srodId
uint16_t srodId() const
Definition: TgcL1Rdo.h:138
TgcL1Rdo::setErrors
void setErrors(uint16_t data)
Definition: TgcL1Rdo.h:162
TgcL1Rdo::SRodStatus::EC_bc
unsigned EC_bc
Definition: TgcL1Rdo.h:67
TgcL1Rdo::SRodStatus::EC_dupsb
unsigned EC_dupsb
Definition: TgcL1Rdo.h:65
TgcL1Rdo::LocalStatus::mergedTrackletBCs
unsigned mergedTrackletBCs
Definition: TgcL1Rdo.h:79
TgcL1Rdo::m_srodId
uint16_t m_srodId
Definition: TgcL1Rdo.h:244
TgcL1Rdo::SRodStatus::EC_celladr
unsigned EC_celladr
Definition: TgcL1Rdo.h:68
TgcL1Rdo::LocalStatus
Definition: TgcL1Rdo.h:77
IdentifierHash
This is a "hash" representation of an Identifier. This encodes a 32 bit index which can be used to lo...
Definition: IdentifierHash.h:25
CLASS_DEF.h
macros to associate a CLID to a type
TgcL1Rdo::srodStatus
const SRodStatus & srodStatus() const
Definition: TgcL1Rdo.h:174
TgcL1Rdo::LocalStatus::mergedHitBCs
unsigned mergedHitBCs
Definition: TgcL1Rdo.h:78
TgcL1Rdo::errors
const Errors & errors() const
Definition: TgcL1Rdo.h:158
TgcL1Rdo::SRodStatus::EC_order
unsigned EC_order
Definition: TgcL1Rdo.h:59
TgcL1Rdo
Definition: TgcL1Rdo.h:22