ATLAS Offline Software
TgcRdo.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_TGCRDO_H
6 #define MUONRDO_TGCRDO_H 1
7 
8 #include <inttypes.h>
9 #include "MuonRDO/TgcRawData.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 TgcRdo : public DataVector<TgcRawData>
22 {
23 public:
24  // typedef required by container
25  typedef uint16_t ID;
26  typedef TgcRawData DIGIT;
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 RodStatus
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  TgcRdo();
91 
93  TgcRdo(uint16_t id, IdentifierHash idHash);
94 
95  // P1
98  uint16_t bcId,
99  uint16_t l1Id);
100 
101  // Destructor
102  virtual ~TgcRdo()
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 rodId() const
139  {
140  return m_rodId;
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 TgcRawData &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 RodStatus& rodStatus() const
175  {
176  return m_rodStatus;
177  }
179  {
180  // FIXME BUG: This is not portable!
181  // The layout of bitfields in a structure is implementation-defined.
182  union cnvRodStatus {
183  uint16_t data;
185  } cnv;
186  cnv.data = data;
187  m_rodStatus = cnv.rodStatus;
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  // ??? This overrides DataVector::clear() with something that
226  // does something different. Should probably be called
227  // something else.
228  // cppcheck-suppress duplInheritedMember ; false positive
229  void clear();
230 
231  // online ID calculator
233 
234 private:
235  // Returns offset, MAX_N_ROD
236  static std::pair<int, int> initOnlineId();
237 
238  uint16_t m_version = 0U; // starting August 2006 version = 300. Before that, version = 0
239 
242 
245 
246  // online IDs
249 
250  // Trigger Type
252 
253  // BCID and L1ID on ROD
256 
257  struct Errors m_errors{};
261 };
262 
264 std::ostream& operator<<(std::ostream& sl, const TgcRdo& coll);
265 
266 CLASS_DEF(TgcRdo,4185,0)
267 
268 // Class needed only for persistency
270 CLASS_DEF(TGC_RDO_vector, 4182, 1)
271 
272 #endif
TgcRdo::RodStatus::EC_ovfl
unsigned EC_ovfl
Definition: TgcRdo.h:51
TgcRdo::identify
uint16_t identify() const
Definition: TgcRdo.h:107
TgcRdo::identifyRawData
static uint16_t identifyRawData(const TgcRawData &rawData)
Definition: TgcRdo.cxx:45
TgcRdo::m_idHash
IdentifierHash m_idHash
OFFLINE hash of this collection.
Definition: TgcRdo.h:244
TgcRdo::LocalStatus::hasRoI
unsigned hasRoI
Definition: TgcRdo.h:82
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
TgcRdo::m_subDetectorId
uint16_t m_subDetectorId
Definition: TgcRdo.h:247
TgcRdo::RodStatus::EC_RXsend
unsigned EC_RXsend
Definition: TgcRdo.h:46
TgcRdo::RodStatus::EC_null
unsigned EC_null
Definition: TgcRdo.h:58
TgcRdo::LocalStatus::sortedTracklets
unsigned sortedTracklets
Definition: TgcRdo.h:81
TgcRdo::setL1Id
void setL1Id(uint32_t v)
Definition: TgcRdo.h:119
TgcRdo::calculateOnlineId
static uint16_t calculateOnlineId(uint16_t subDetectorId, uint16_t rodId)
Definition: TgcRdo.cxx:58
TgcRdo::setRodStatus
void setRodStatus(uint32_t data)
Definition: TgcRdo.h:178
TgcRawData.h
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
TgcRdo::RodStatus::EC_dupsb
unsigned EC_dupsb
Definition: TgcRdo.h:65
TgcRdo::m_id
uint16_t m_id
ID of this instance.
Definition: TgcRdo.h:241
TgcRdo::localStatus
const LocalStatus & localStatus() const
Definition: TgcRdo.h:190
TgcRdo::RodStatus::EC_nohdr
unsigned EC_nohdr
Definition: TgcRdo.h:56
TgcRdo::Errors::overflow
unsigned overflow
Definition: TgcRdo.h:41
TgcRdo::identifyHash
IdentifierHash identifyHash() const
Definition: TgcRdo.h:113
TgcRdo::m_version
uint16_t m_version
Definition: TgcRdo.h:238
TgcRdo::m_triggerType
uint16_t m_triggerType
Definition: TgcRdo.h:251
TgcRdo::RodStatus::EC_FELdown
unsigned EC_FELdown
Definition: TgcRdo.h:47
TgcRdo::RodStatus::EC_badEoE
unsigned EC_badEoE
Definition: TgcRdo.h:71
TgcRdo::rodStatus
const RodStatus & rodStatus() const
Definition: TgcRdo.h:174
TgcRdo::setTriggerType
void setTriggerType(uint16_t v)
Definition: TgcRdo.h:127
TgcRdo::RodStatus::EC_unxsbid
unsigned EC_unxsbid
Definition: TgcRdo.h:64
TgcRdo::RodStatus::EC_rectype
unsigned EC_rectype
Definition: TgcRdo.h:57
TgcRdo::RodStatus::EC_LDB
unsigned EC_LDB
Definition: TgcRdo.h:60
TgcRdo::triggerType
uint16_t triggerType() const
Definition: TgcRdo.h:142
TgcRdo::l1Id
uint16_t l1Id() const
Definition: TgcRdo.h:150
TgcRdo::Errors::badL1Id
unsigned badL1Id
Definition: TgcRdo.h:38
TgcRdo::RodStatus::EC_celladr
unsigned EC_celladr
Definition: TgcRdo.h:68
TgcRdo::m_orbit
uint32_t m_orbit
Definition: TgcRdo.h:260
TgcRdo::clear
void clear()
Definition: TgcRdo.cxx:112
TgcRdo::LocalStatus
Definition: TgcRdo.h:77
TgcRdo::RodStatus::EC_trgbit
unsigned EC_trgbit
Definition: TgcRdo.h:70
TgcRdo::setErrors
void setErrors(uint16_t data)
Definition: TgcRdo.h:162
TgcRdo::orbit
uint32_t orbit() const
Definition: TgcRdo.h:206
TgcRdo::RodStatus::EC_L1ID
unsigned EC_L1ID
Definition: TgcRdo.h:55
TgcRdo::Errors::badBcID
unsigned badBcID
Definition: TgcRdo.h:37
TgcRdo::LocalStatus::fakeSsw
unsigned fakeSsw
Definition: TgcRdo.h:83
TgcRdo::m_bcId
uint16_t m_bcId
Definition: TgcRdo.h:254
TgcRdo::m_rodId
uint16_t m_rodId
Definition: TgcRdo.h:248
TgcRdo::subDetectorId
uint16_t subDetectorId() const
Definition: TgcRdo.h:134
TgcRdo::setOrbit
void setOrbit(uint32_t orbit)
Definition: TgcRdo.h:210
xAOD::uint16_t
setWord1 uint16_t
Definition: eFexEMRoI_v1.cxx:88
TgcRdo::RodStatus::EC_Glnk
unsigned EC_Glnk
Definition: TgcRdo.h:49
TgcRdo::~TgcRdo
virtual ~TgcRdo()
Definition: TgcRdo.h:102
TgcRdo::RodStatus::EC_order
unsigned EC_order
Definition: TgcRdo.h:59
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
TgcRdo::RodStatus::EC_hitovfl
unsigned EC_hitovfl
Definition: TgcRdo.h:69
TgcRdo::RodStatus::EC_timeout
unsigned EC_timeout
Definition: TgcRdo.h:52
TgcRdo::m_errors
Definition: TgcRdo.h:257
TgcRdo::bcId
uint16_t bcId() const
Definition: TgcRdo.h:146
TgcRdo::RodStatus::EC_ec4
unsigned EC_ec4
Definition: TgcRdo.h:66
TgcRdo::initOnlineId
static std::pair< int, int > initOnlineId()
Definition: TgcRdo.cxx:51
TgcRdo::RodStatus
Definition: TgcRdo.h:45
TgcRdo::Errors::timedout
unsigned timedout
Definition: TgcRdo.h:39
TgcRdo::RodStatus::EC_endWCnot0
unsigned EC_endWCnot0
Definition: TgcRdo.h:72
TgcRdo::RodStatus::EC_wc0
unsigned EC_wc0
Definition: TgcRdo.h:54
TgcRdo::errors
const Errors & errors() const
Definition: TgcRdo.h:158
IdentifierHash.h
TgcRdo::m_localStatus
Definition: TgcRdo.h:259
TgcRdo::RodStatus::EC_frame
unsigned EC_frame
Definition: TgcRdo.h:48
TgcRdo::setOnlineId
void setOnlineId(uint16_t subDetectorId, uint16_t rodId)
Definition: TgcRdo.cxx:35
TgcRdo::RodStatus::EC_sbid
unsigned EC_sbid
Definition: TgcRdo.h:63
TgcRdo::m_l1Id
uint16_t m_l1Id
Definition: TgcRdo.h:255
TgcRdo::RodStatus::EC_xormezz
unsigned EC_xormezz
Definition: TgcRdo.h:53
python.PyAthena.v
v
Definition: PyAthena.py:154
DataVector.h
An STL vector of pointers that by default owns its pointed-to elements.
TgcRdo::version
uint16_t version() const
Definition: TgcRdo.h:215
TgcRdo::TgcRdo
TgcRdo()
Default constructor.
Definition: TgcRdo.cxx:9
TgcRdo::RodStatus::EC_bc
unsigned EC_bc
Definition: TgcRdo.h:67
TgcRdo::RodStatus::EC_noEoE
unsigned EC_noEoE
Definition: TgcRdo.h:73
TgcRawData
An unit object of TGC ROD output.
Definition: TgcRawData.h:23
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
TgcRdo::setVersion
void setVersion(uint16_t version)
Definition: TgcRdo.h:220
TgcRdo::LocalStatus::fill1
unsigned fill1
Definition: TgcRdo.h:84
TgcRdo::RodStatus::EC_xor
unsigned EC_xor
Definition: TgcRdo.h:50
TgcRdo::RodStatus::EC_RXovfl
unsigned EC_RXovfl
Definition: TgcRdo.h:61
TgcRdo::LocalStatus::sortedHits
unsigned sortedHits
Definition: TgcRdo.h:80
TgcRdo::setBcId
void setBcId(uint16_t v)
Definition: TgcRdo.h:123
TgcRdo::LocalStatus::mergedHitBCs
unsigned mergedHitBCs
Definition: TgcRdo.h:78
TgcRdo::setLocalStatus
void setLocalStatus(uint32_t data)
Definition: TgcRdo.h:194
TgcRdo
Definition: TgcRdo.h:22
TgcRdo::LocalStatus::mergedTrackletBCs
unsigned mergedTrackletBCs
Definition: TgcRdo.h:79
TgcRdo::DIGIT
TgcRawData DIGIT
Definition: TgcRdo.h:26
TgcRdo::Errors::badData
unsigned badData
Definition: TgcRdo.h:40
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
TgcRdo::RodStatus::EC_SSWerr
unsigned EC_SSWerr
Definition: TgcRdo.h:62
TgcRdo::rodId
uint16_t rodId() const
Definition: TgcRdo.h:138
CLASS_DEF.h
macros to associate a CLID to a type
operator<<
std::ostream & operator<<(std::ostream &sl, const TgcRdo &coll)
Overload of << operator for std::ostream for debug output.
Definition: TgcRdo.cxx:106
TgcRdo::m_rodStatus
Definition: TgcRdo.h:258
TgcRdo::Errors
Definition: TgcRdo.h:36
TgcRdo::ID
uint16_t ID
Definition: TgcRdo.h:25