ATLAS Offline Software
Loading...
Searching...
No Matches
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>
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*/
21class TgcRdo : public DataVector<TgcRawData>
22{
23public:
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 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
77 {
78 unsigned mergedHitBCs: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
96 TgcRdo(uint16_t subDetectorId,
97 uint16_t rodId,
98 uint16_t bcId,
99 uint16_t l1Id);
100
101 // Destructor
102 virtual ~TgcRdo()
103 {
104 }
105
106 // Identifier
107 uint16_t identify() const
108 {
109 return m_id;
110 }
111
112 // Identifier
114 {
115 return m_idHash;
116 }
117
118 // set methods
119 void setL1Id(uint32_t v)
120 {
121 m_l1Id = v;
122 }
123 void setBcId(uint16_t v)
124 {
125 m_bcId = v;
126 }
127 void setTriggerType(uint16_t v)
128 {
129 m_triggerType = v;
130 }
131 void setOnlineId (uint16_t subDetectorId, uint16_t rodId);
132
133 // get methods
134 uint16_t subDetectorId() const
135 {
136 return m_subDetectorId;
137 }
138 uint16_t rodId() const
139 {
140 return m_rodId;
141 }
142 uint16_t triggerType() const
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 }
162 void setErrors(uint16_t data)
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;
169 } cnv;
170 cnv.data = data;
171 m_errors = cnv.errors;
172 }
173
174 const RodStatus& rodStatus() const
175 {
176 return m_rodStatus;
177 }
178 void setRodStatus(uint32_t data)
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
191 {
192 return m_localStatus;
193 }
194 void setLocalStatus(uint32_t data)
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 }
210 void setOrbit(uint32_t orbit)
211 {
212 m_orbit = orbit;
213 }
214
215 uint16_t version() const
216 {
217 return m_version;
218 }
219
220 void setVersion(uint16_t version)
221 {
223 }
224
225 // ??? This overrides DataVector::clear() with something that
226 // does something different. Should probably be called
227 // something else.
228 void clear();
229
230 // online ID calculator
231 static uint16_t calculateOnlineId (uint16_t subDetectorId, uint16_t rodId);
232
233private:
234 // Returns offset, MAX_N_ROD
235 static std::pair<int, int> initOnlineId();
236
237 uint16_t m_version = 0U; // starting August 2006 version = 300. Before that, version = 0
238
240 uint16_t m_id = 0U;
241
244
245 // online IDs
246 uint16_t m_subDetectorId = 0U;
247 uint16_t m_rodId = 0U;
248
249 // Trigger Type
250 uint16_t m_triggerType = 0U;
251
252 // BCID and L1ID on ROD
253 uint16_t m_bcId = 0U;
254 uint16_t m_l1Id = 0U;
255
256 struct Errors m_errors{};
259 uint32_t m_orbit = 0U;
260};
261
263std::ostream& operator<<(std::ostream& sl, const TgcRdo& coll);
264
265CLASS_DEF(TgcRdo,4185,0)
266
267// Class needed only for persistency
270
271#endif
macros to associate a CLID to a type
#define CLASS_DEF(NAME, CID, VERSION)
associate a clid and a version to a type eg
An STL vector of pointers that by default owns its pointed-to elements.
char data[hepevt_bytes_allocation_ATLAS]
Definition HepEvt.cxx:11
std::ostream & operator<<(std::ostream &sl, const TgcRdo &coll)
Overload of << operator for std::ostream for debug output.
Definition TgcRdo.cxx:108
DataVector< TgcRdo > TGC_RDO_vector
Definition TgcRdo.h:268
Derived DataVector<T>.
Definition DataVector.h:795
DataVector(SG::OwnershipPolicy ownPolicy=SG::OWN_ELEMENTS, SG::IndexTrackingPolicy trackIndices=SG::DEFAULT_TRACK_INDICES)
This is a "hash" representation of an Identifier.
An unit object of TGC ROD output.
Definition TgcRawData.h:23
uint16_t m_version
Definition TgcRdo.h:237
TgcRawData DIGIT
Definition TgcRdo.h:26
const RodStatus & rodStatus() const
Definition TgcRdo.h:174
uint16_t version() const
Definition TgcRdo.h:215
void clear()
Definition TgcRdo.cxx:114
uint16_t triggerType() const
Definition TgcRdo.h:142
void setLocalStatus(uint32_t data)
Definition TgcRdo.h:194
uint16_t m_bcId
Definition TgcRdo.h:253
uint16_t rodId() const
Definition TgcRdo.h:138
uint16_t m_rodId
Definition TgcRdo.h:247
void setTriggerType(uint16_t v)
Definition TgcRdo.h:127
uint16_t l1Id() const
Definition TgcRdo.h:150
void setVersion(uint16_t version)
Definition TgcRdo.h:220
void setRodStatus(uint32_t data)
Definition TgcRdo.h:178
void setL1Id(uint32_t v)
Definition TgcRdo.h:119
uint16_t m_l1Id
Definition TgcRdo.h:254
uint16_t m_id
ID of this instance.
Definition TgcRdo.h:240
static uint16_t identifyRawData(const TgcRawData &rawData)
Definition TgcRdo.cxx:47
uint32_t m_orbit
Definition TgcRdo.h:259
IdentifierHash m_idHash
OFFLINE hash of this collection.
Definition TgcRdo.h:243
void setOnlineId(uint16_t subDetectorId, uint16_t rodId)
Definition TgcRdo.cxx:37
void setOrbit(uint32_t orbit)
Definition TgcRdo.h:210
uint16_t ID
Definition TgcRdo.h:25
IdentifierHash identifyHash() const
Definition TgcRdo.h:113
void setErrors(uint16_t data)
Definition TgcRdo.h:162
uint16_t m_subDetectorId
Definition TgcRdo.h:246
static std::pair< int, int > initOnlineId()
Definition TgcRdo.cxx:53
uint32_t orbit() const
Definition TgcRdo.h:206
uint16_t subDetectorId() const
Definition TgcRdo.h:134
virtual ~TgcRdo()
Definition TgcRdo.h:102
const Errors & errors() const
Definition TgcRdo.h:158
static uint16_t calculateOnlineId(uint16_t subDetectorId, uint16_t rodId)
Definition TgcRdo.cxx:60
uint16_t m_triggerType
Definition TgcRdo.h:250
const LocalStatus & localStatus() const
Definition TgcRdo.h:190
uint16_t identify() const
Definition TgcRdo.h:107
uint16_t bcId() const
Definition TgcRdo.h:146
TgcRdo()
Default constructor.
Definition TgcRdo.cxx:11
void setBcId(uint16_t v)
Definition TgcRdo.h:123
unsigned timedout
Definition TgcRdo.h:39
unsigned overflow
Definition TgcRdo.h:41
unsigned badBcID
Definition TgcRdo.h:37
unsigned badL1Id
Definition TgcRdo.h:38
unsigned badData
Definition TgcRdo.h:40
unsigned fill1
Definition TgcRdo.h:84
unsigned mergedTrackletBCs
Definition TgcRdo.h:79
unsigned sortedTracklets
Definition TgcRdo.h:81
unsigned fakeSsw
Definition TgcRdo.h:83
unsigned hasRoI
Definition TgcRdo.h:82
unsigned mergedHitBCs
Definition TgcRdo.h:78
unsigned sortedHits
Definition TgcRdo.h:80
unsigned EC_LDB
Definition TgcRdo.h:60
unsigned EC_xor
Definition TgcRdo.h:50
unsigned EC_ovfl
Definition TgcRdo.h:51
unsigned EC_SSWerr
Definition TgcRdo.h:62
unsigned EC_dupsb
Definition TgcRdo.h:65
unsigned EC_badEoE
Definition TgcRdo.h:71
unsigned EC_nohdr
Definition TgcRdo.h:56
unsigned EC_xormezz
Definition TgcRdo.h:53
unsigned EC_rectype
Definition TgcRdo.h:57
unsigned EC_RXsend
Definition TgcRdo.h:46
unsigned EC_celladr
Definition TgcRdo.h:68
unsigned EC_sbid
Definition TgcRdo.h:63
unsigned EC_L1ID
Definition TgcRdo.h:55
unsigned EC_wc0
Definition TgcRdo.h:54
unsigned EC_ec4
Definition TgcRdo.h:66
unsigned EC_frame
Definition TgcRdo.h:48
unsigned EC_RXovfl
Definition TgcRdo.h:61
unsigned EC_noEoE
Definition TgcRdo.h:73
unsigned EC_bc
Definition TgcRdo.h:67
unsigned EC_trgbit
Definition TgcRdo.h:70
unsigned EC_endWCnot0
Definition TgcRdo.h:72
unsigned EC_unxsbid
Definition TgcRdo.h:64
unsigned EC_timeout
Definition TgcRdo.h:52
unsigned EC_order
Definition TgcRdo.h:59
unsigned EC_hitovfl
Definition TgcRdo.h:69
unsigned EC_FELdown
Definition TgcRdo.h:47
unsigned EC_null
Definition TgcRdo.h:58
unsigned EC_Glnk
Definition TgcRdo.h:49