ATLAS Offline Software
Loading...
Searching...
No Matches
ZdcSubBlock Class Reference

Zdc Sub Block base class. More...

#include <ZdcSubBlock.h>

Inheritance diagram for ZdcSubBlock:
Collaboration diagram for ZdcSubBlock:

Public Types

enum  SubBlockWordType { HEADER , DATA , STATUS }
enum  DataFormats { NEUTRAL = 0 , UNCOMPRESSED = 1 , COMPRESSED = 2 , SUPERCOMPRESSED = 3 }
enum  UnpackErrorType {
  UNPACK_NONE , UNPACK_VERSION , UNPACK_FORMAT , UNPACK_COMPRESSION_VERSION ,
  UNPACK_COMPRESSION_SLICES , UNPACK_DATA_TRUNCATED , UNPACK_SOURCE_ID , UNPACK_WORD_ID
}

Public Member Functions

 ZdcSubBlock ()
 ~ZdcSubBlock ()
void clear ()
 Clear all data.
int dataWords () const
 Return number of data words.
void setHeader (int wordId, int version, int format, int seqno, int crate, int module, int slices2, int slices1)
 Store header data.
int wordId () const
int version () const
int format () const
int seqno () const
int slice () const
int crate () const
int module () const
int slices2 () const
int slices1 () const
uint32_t failingBCN () const
bool glinkTimeout () const
bool glinkDown () const
bool upstreamError () const
bool daqOverflow () const
bool bcnMismatch () const
bool glinkProtocol () const
bool glinkParity () const
uint32_t subStatus () const
 Return Sub-status word.
void setBunchCrossing (int bc)
 Set the Bunch Crossing number (neutral format only)
int bunchCrossing () const
 Return the Bunch Crossing number (neutral format only)
OFFLINE_FRAGMENTS_NAMESPACE::PointerType read (const OFFLINE_FRAGMENTS_NAMESPACE::PointerType beg, const OFFLINE_FRAGMENTS_NAMESPACE::PointerType end)
 Input complete packed sub-block from ROD array.
void write (FullEventAssembler< ZdcSrcIdMap >::RODDATA *theROD) const
 Output complete packed sub-block to ROD vector.
void setStatus (uint32_t failingBCN, bool glinkTimeout, bool glinkDown, bool upstreamError, bool daqOverflow, bool bcnMismatch, bool glinkProtocol, bool glinkParity)
 Store error status trailer.
void setDaqOverflow (int bit=1)
 Set DAQ FIFO Overflow bit in Sub-status word.
void setGlinkParity (int bit=1)
 Set G-Link Parity bit in Sub-status word.
void setUnpackErrorCode (int code)
 Set the unpacking error code.
int unpackErrorCode () const
 Return the unpacking error code.
std::string unpackErrorMsg () const
 Return the unpacking error message for printing.
void packer (uint32_t datum, int nbits)
 Pack given data into given number of bits.
void packerFlush ()
 Flush the current data word padded with zeros.
void setStreamed ()
 Set continuous bit streaming for compressed formats.
uint32_t unpacker (int nbits)
 Unpack given number of bits of data.
void unpackerInit ()
 Initialise unpacker.
bool unpackerSuccess () const
 Return unpacker success flag.
void packerNeutral (int pin, uint32_t datum, int nbits)
 Pack given neutral data from given pin.
void packerNeutralParity (int pin)
 Pack current G-Link parity bit for given pin.
uint32_t unpackerNeutral (int pin, int nbits)
 Unpack given number of bits of neutral data for given pin.
bool unpackerNeutralParityError (int pin)
 Unpack and test G-Link parity bit for given pin.

Static Public Member Functions

static SubBlockWordType wordType (uint32_t word)
 Word identification.
static int wordId (uint32_t word)
 Return wordID field from given header word.
static int format (uint32_t word)
 Return data format from given header word.
static int seqno (uint32_t word)
 Return seqno field from given header word.
static int module (uint32_t word)
 Return module field from given header word.
static int minBits (uint32_t datum)
 Return the minimum number of bits needed for given data.
static int parityBit (int init, uint32_t datum, int nbits)
 Return the parity bit for given data.

Private Attributes

uint32_t m_header {}
 Sub-Block Header.
uint32_t m_trailer {}
 Sub-Block Status Trailer.
int m_bunchCrossing {}
 Bunch Crossing number (neutral format only)
int m_unpackError {}
 Unpacking error code.
uint32_t m_bitword {}
int m_currentBit {}
int m_maxBits {}
uint32_t m_maxMask {}
bool m_unpackerFlag {}
std::vector< uint32_t >::const_iterator m_dataPos {}
std::vector< uint32_t >::const_iterator m_dataPosEnd {}
std::vector< int > m_currentPinBit
std::vector< int > m_oddParity
int m_dataWords {}
 Current number of data words.
std::vector< uint32_t > m_data
 Sub-Block data.

Static Private Attributes

static const int s_headerBit = 30
 ZdcSubBlock.cxx this is a base class derived (copyed) from LVL1 I do not think we need this this way; either implement directly on PpmSubBlock or link to LVL1.
static const int s_statusBit = 28
static const uint32_t s_headerMask = 0x3
static const uint32_t s_statusMask = 0x1
static const uint32_t s_headerVal = 0x3
static const uint32_t s_statusVal = 0x1
static const int s_wordIdBit = 28
static const int s_versionBit = 25
static const int s_formatBit = 22
static const int s_seqnoBit = 16
static const int s_crateBit = 12
static const int s_moduleBit = 8
static const int s_slices2Bit = 3
static const int s_slices1Bit = 0
static const uint32_t s_wordIdMask = 0xf
static const uint32_t s_versionMask = 0x7
static const uint32_t s_formatMask = 0x7
static const uint32_t s_seqnoMask = 0x3f
static const uint32_t s_crateMask = 0xf
static const uint32_t s_moduleMask = 0xf
static const uint32_t s_slices2Mask = 0x1f
static const uint32_t s_slices1Mask = 0x7
static const int s_failingBcnBit = 22
static const int s_glinkTimeoutBit = 7
static const int s_glinkDownBit = 6
static const int s_upstreamErrorBit = 4
static const int s_daqOverflowBit = 3
static const int s_bcnMismatchBit = 2
static const int s_glinkProtocolBit = 1
static const int s_glinkParityBit = 0
static const uint32_t s_failingBcnMask = 0x3f
static const int s_maxWordBits = 32
static const int s_maxStreamedBits = 31
static const uint32_t s_maxWordMask = 0xffffffff
static const uint32_t s_maxStreamedMask = 0x7fffffff
static const int s_maxPins = 20
static const uint32_t s_glinkDavSet = 0x400000

Detailed Description

Zdc Sub Block base class.

Author
Peter Faulkner

Derived (copied !) from L1Calo Sub-Block base class.

Don't think we need this, as there is only one type of subblock (only PPM) being used by ZDC. Implement at once inside ZdcPpmSubBlock

Marco Leite

TRY_LINK_LVL1

Definition at line 34 of file ZdcSubBlock.h.

Member Enumeration Documentation

◆ DataFormats

Enumerator
NEUTRAL 
UNCOMPRESSED 
COMPRESSED 
SUPERCOMPRESSED 

Definition at line 41 of file ZdcSubBlock.h.

41 { NEUTRAL = 0,
42 UNCOMPRESSED = 1,
43 COMPRESSED = 2,
44 SUPERCOMPRESSED = 3 };

◆ SubBlockWordType

Enumerator
HEADER 
DATA 
STATUS 

Definition at line 37 of file ZdcSubBlock.h.

◆ UnpackErrorType

Enumerator
UNPACK_NONE 
UNPACK_VERSION 
UNPACK_FORMAT 
UNPACK_COMPRESSION_VERSION 
UNPACK_COMPRESSION_SLICES 
UNPACK_DATA_TRUNCATED 
UNPACK_SOURCE_ID 
UNPACK_WORD_ID 

Definition at line 46 of file ZdcSubBlock.h.

Constructor & Destructor Documentation

◆ ZdcSubBlock()

ZdcSubBlock::ZdcSubBlock ( )

Definition at line 66 of file ZdcSubBlock.cxx.

66 : m_header(0), m_trailer(0),
72 m_unpackerFlag(false),
76{
77}
static const int s_maxWordBits
int m_dataWords
Current number of data words.
uint32_t m_header
Sub-Block Header.
std::vector< int > m_oddParity
static const uint32_t s_maxWordMask
uint32_t m_bitword
static const int s_maxPins
bool m_unpackerFlag
int m_unpackError
Unpacking error code.
uint32_t m_maxMask
std::vector< int > m_currentPinBit
int m_bunchCrossing
Bunch Crossing number (neutral format only)
uint32_t m_trailer
Sub-Block Status Trailer.

◆ ~ZdcSubBlock()

ZdcSubBlock::~ZdcSubBlock ( )

Definition at line 79 of file ZdcSubBlock.cxx.

80{
81}

Member Function Documentation

◆ bcnMismatch()

bool ZdcSubBlock::bcnMismatch ( ) const
inline

Definition at line 310 of file ZdcSubBlock.h.

311{
312 return m_trailer & (0x1 << s_bcnMismatchBit);
313}
static const int s_bcnMismatchBit

◆ bunchCrossing()

int ZdcSubBlock::bunchCrossing ( ) const
inline

Return the Bunch Crossing number (neutral format only)

Definition at line 335 of file ZdcSubBlock.h.

336{
337 return m_bunchCrossing;
338}

◆ clear()

void ZdcSubBlock::clear ( )

Clear all data.

Definition at line 85 of file ZdcSubBlock.cxx.

86{
87 m_header = 0;
88 m_trailer = 0;
91 m_bitword = 0;
92 m_currentBit = 0;
93 m_unpackerFlag = false;
94 m_currentPinBit.assign(s_maxPins, 0);
95 m_oddParity.assign(s_maxPins, 1);
96 m_dataWords = 0;
97 m_data.clear();
98}
std::vector< uint32_t > m_data
Sub-Block data.

◆ crate()

int ZdcSubBlock::crate ( ) const
inline

Definition at line 265 of file ZdcSubBlock.h.

266{
267 return (m_header >> s_crateBit) & s_crateMask;
268}
static const int s_crateBit
static const uint32_t s_crateMask

◆ daqOverflow()

bool ZdcSubBlock::daqOverflow ( ) const
inline

Definition at line 305 of file ZdcSubBlock.h.

306{
307 return m_trailer & (0x1 << s_daqOverflowBit);
308}
static const int s_daqOverflowBit

◆ dataWords()

int ZdcSubBlock::dataWords ( ) const
inline

Return number of data words.

Definition at line 235 of file ZdcSubBlock.h.

236{
237 return m_dataWords;
238}

◆ failingBCN()

uint32_t ZdcSubBlock::failingBCN ( ) const
inline

Definition at line 285 of file ZdcSubBlock.h.

286{
288}
static const int s_failingBcnBit
static const uint32_t s_failingBcnMask

◆ format() [1/2]

int ZdcSubBlock::format ( ) const
inline

Definition at line 250 of file ZdcSubBlock.h.

251{
252 return (m_header >> s_formatBit) & s_formatMask;
253}
static const int s_formatBit
static const uint32_t s_formatMask

◆ format() [2/2]

int ZdcSubBlock::format ( uint32_t word)
static

Return data format from given header word.

Definition at line 441 of file ZdcSubBlock.cxx.

442{
443 return (word >> s_formatBit) & s_formatMask;
444}

◆ glinkDown()

bool ZdcSubBlock::glinkDown ( ) const
inline

Definition at line 295 of file ZdcSubBlock.h.

296{
297 return m_trailer & (0x1 << s_glinkDownBit);
298}
static const int s_glinkDownBit

◆ glinkParity()

bool ZdcSubBlock::glinkParity ( ) const
inline

Definition at line 320 of file ZdcSubBlock.h.

321{
322 return m_trailer & (0x1 << s_glinkParityBit);
323}
static const int s_glinkParityBit

◆ glinkProtocol()

bool ZdcSubBlock::glinkProtocol ( ) const
inline

Definition at line 315 of file ZdcSubBlock.h.

316{
317 return m_trailer & (0x1 << s_glinkProtocolBit);
318}
static const int s_glinkProtocolBit

◆ glinkTimeout()

bool ZdcSubBlock::glinkTimeout ( ) const
inline

Definition at line 290 of file ZdcSubBlock.h.

291{
292 return m_trailer & (0x1 << s_glinkTimeoutBit);
293}
static const int s_glinkTimeoutBit

◆ minBits()

int ZdcSubBlock::minBits ( uint32_t datum)
static

Return the minimum number of bits needed for given data.

Definition at line 245 of file ZdcSubBlock.cxx.

246{
247 const int maxBits = 32;
248 int nbits = maxBits;
249 for (int i = 0; i < maxBits; ++i) {
250 if ( !(datum >> i)) {
251 nbits = i;
252 break;
253 }
254 }
255 return nbits;
256}

◆ module() [1/2]

int ZdcSubBlock::module ( ) const
inline

Definition at line 270 of file ZdcSubBlock.h.

271{
272 return (m_header >> s_moduleBit) & s_moduleMask;
273}
static const int s_moduleBit
static const uint32_t s_moduleMask

◆ module() [2/2]

int ZdcSubBlock::module ( uint32_t word)
static

Return module field from given header word.

Definition at line 455 of file ZdcSubBlock.cxx.

456{
457 return (word >> s_moduleBit) & s_moduleMask;
458}

◆ packer()

void ZdcSubBlock::packer ( uint32_t datum,
int nbits )

Pack given data into given number of bits.

Definition at line 271 of file ZdcSubBlock.cxx.

272{
273 if (nbits > 0) {
274 uint32_t mask = 0x1;
275 for (int i = 1; i < nbits; ++i) mask |= (mask << 1);
276 m_bitword |= (datum & mask) << m_currentBit;
277 m_currentBit += nbits;
278 if (m_currentBit >= m_maxBits) {
280 m_data.push_back(m_bitword);
281 ++m_dataWords;
282 const int bitsLeft = m_currentBit - m_maxBits;
283 if (bitsLeft > 0) {
284 m_bitword = (datum & mask) >> (nbits - bitsLeft);
285 m_currentBit = bitsLeft;
286 } else {
287 m_bitword = 0;
288 m_currentBit = 0;
289 }
290 }
291 }
292}
setEventNumber uint32_t

◆ packerFlush()

void ZdcSubBlock::packerFlush ( )

Flush the current data word padded with zeros.

Definition at line 296 of file ZdcSubBlock.cxx.

297{
298 if (m_currentBit > 0) {
300 m_data.push_back(m_bitword);
301 ++m_dataWords;
302 m_bitword = 0;
303 m_currentBit = 0;
304 }
305}

◆ packerNeutral()

void ZdcSubBlock::packerNeutral ( int pin,
uint32_t datum,
int nbits )

Pack given neutral data from given pin.

Definition at line 364 of file ZdcSubBlock.cxx.

366{
367 if (pin >= 0 && pin < s_maxPins && nbits > 0) {
368 if (m_currentPinBit[pin] + nbits > m_dataWords) {
369 m_dataWords = m_currentPinBit[pin] + nbits;
371 }
372 for (int bit = 0; bit < nbits; ++bit) {
373 m_data[m_currentPinBit[pin] + bit] |= ((datum >> bit) & 0x1) << pin;
374 }
375 m_currentPinBit[pin] += nbits;
376 m_oddParity[pin] = parityBit(m_oddParity[pin], datum, nbits);
377 }
378}
static int parityBit(int init, uint32_t datum, int nbits)
Return the parity bit for given data.
static const uint32_t s_glinkDavSet

◆ packerNeutralParity()

void ZdcSubBlock::packerNeutralParity ( int pin)

Pack current G-Link parity bit for given pin.

Definition at line 382 of file ZdcSubBlock.cxx.

383{
384 if (pin >= 0 && pin < s_maxPins) {
385 packerNeutral(pin, m_oddParity[pin], 1);
386 m_oddParity[pin] = 1;
387 }
388}
void packerNeutral(int pin, uint32_t datum, int nbits)
Pack given neutral data from given pin.

◆ parityBit()

int ZdcSubBlock::parityBit ( int init,
uint32_t datum,
int nbits )
static

Return the parity bit for given data.

Definition at line 260 of file ZdcSubBlock.cxx.

262{
263 // set init to 0/1 for even/odd parity
264 int parity = init;
265 for (int bit = 0; bit < nbits; ++bit) parity ^= (datum >> bit) & 0x1;
266 return parity;
267}
init(v_theApp, v_rootStream=None)
Definition PyKernel.py:45

◆ read()

Input complete packed sub-block from ROD array.

Definition at line 121 of file ZdcSubBlock.cxx.

124{
125 m_dataWords = 0;
126 m_unpackerFlag = true;
129 for (; pos != pose; ++pos) {
130 const uint32_t word = *pos;
131 const SubBlockWordType type = wordType(word);
132 if (type == HEADER) {
133 if (m_header) return pos;
134 m_header = word;
135 }
136 else if (type == STATUS) m_trailer = word;
137 else {
138 m_data.push_back(word);
139 ++m_dataWords;
140 }
141 }
142 return pose;
143}
static SubBlockWordType wordType(uint32_t word)
Word identification.
const DataType * PointerType
Definition RawEvent.h:25

◆ seqno() [1/2]

int ZdcSubBlock::seqno ( ) const
inline

Definition at line 255 of file ZdcSubBlock.h.

256{
257 return (m_header >> s_seqnoBit) & s_seqnoMask;
258}
static const int s_seqnoBit
static const uint32_t s_seqnoMask

◆ seqno() [2/2]

int ZdcSubBlock::seqno ( uint32_t word)
static

Return seqno field from given header word.

Definition at line 448 of file ZdcSubBlock.cxx.

449{
450 return (word >> s_seqnoBit) & s_seqnoMask;
451}

◆ setBunchCrossing()

void ZdcSubBlock::setBunchCrossing ( int bc)
inline

Set the Bunch Crossing number (neutral format only)

Definition at line 330 of file ZdcSubBlock.h.

331{
332 if (bc) m_bunchCrossing = bc;
333}

◆ setDaqOverflow()

void ZdcSubBlock::setDaqOverflow ( int bit = 1)

Set DAQ FIFO Overflow bit in Sub-status word.

Definition at line 186 of file ZdcSubBlock.cxx.

187{
188 if (bit) {
189 if (m_trailer) m_trailer |= (1 << s_daqOverflowBit);
190 else setStatus(0, false, false, false, true, false, false, false);
191 }
192}
void setStatus(uint32_t failingBCN, bool glinkTimeout, bool glinkDown, bool upstreamError, bool daqOverflow, bool bcnMismatch, bool glinkProtocol, bool glinkParity)
Store error status trailer.

◆ setGlinkParity()

void ZdcSubBlock::setGlinkParity ( int bit = 1)

Set G-Link Parity bit in Sub-status word.

Definition at line 196 of file ZdcSubBlock.cxx.

197{
198 if (bit) {
199 if (m_trailer) m_trailer |= (1 << s_glinkParityBit);
200 else setStatus(0, false, false, false, false, false, false, true);
201 }
202}

◆ setHeader()

void ZdcSubBlock::setHeader ( int wordId,
int version,
int format,
int seqno,
int crate,
int module,
int slices2,
int slices1 )

Store header data.

Definition at line 102 of file ZdcSubBlock.cxx.

106{
107 uint32_t word = 0;
108 word |= (wordId & s_wordIdMask) << s_wordIdBit;
109 word |= (version & s_versionMask) << s_versionBit;
110 word |= (format & s_formatMask) << s_formatBit;
111 word |= (seqno & s_seqnoMask) << s_seqnoBit;
112 word |= (crate & s_crateMask) << s_crateBit;
113 word |= (module & s_moduleMask) << s_moduleBit;
114 word |= (slices2 & s_slices2Mask) << s_slices2Bit;
115 word |= (slices1 & s_slices1Mask) << s_slices1Bit;
116 m_header = word;
117}
int slices2() const
static const int s_versionBit
int version() const
int wordId() const
int format() const
int slices1() const
int crate() const
static const int s_wordIdBit
static const uint32_t s_versionMask
static const uint32_t s_slices1Mask
static const int s_slices1Bit
int seqno() const
static const uint32_t s_wordIdMask
static const int s_slices2Bit
static const uint32_t s_slices2Mask

◆ setStatus()

void ZdcSubBlock::setStatus ( uint32_t failingBCN,
bool glinkTimeout,
bool glinkDown,
bool upstreamError,
bool daqOverflow,
bool bcnMismatch,
bool glinkProtocol,
bool glinkParity )

Store error status trailer.

Definition at line 160 of file ZdcSubBlock.cxx.

164{
165 uint32_t word = 0;
168 word |= glinkDown << s_glinkDownBit;
170 word |= daqOverflow << s_daqOverflowBit;
171 word |= bcnMismatch << s_bcnMismatchBit;
173 word |= glinkParity << s_glinkParityBit;
174 if (word) {
175 word |= (wordId() & s_wordIdMask) << s_wordIdBit;
176 word |= (s_statusVal & s_statusMask) << s_statusBit;
177 word |= (seqno() & s_seqnoMask) << s_seqnoBit;
178 word |= (crate() & s_crateMask) << s_crateBit;
179 word |= (module() & s_moduleMask) << s_moduleBit;
180 }
181 m_trailer = word;
182}
bool glinkDown() const
bool glinkProtocol() const
bool glinkTimeout() const
static const uint32_t s_statusVal
uint32_t failingBCN() const
bool bcnMismatch() const
bool glinkParity() const
static const int s_statusBit
static const uint32_t s_statusMask
static const int s_upstreamErrorBit
bool upstreamError() const
int module() const
bool daqOverflow() const

◆ setStreamed()

void ZdcSubBlock::setStreamed ( )
inline

Set continuous bit streaming for compressed formats.

Definition at line 350 of file ZdcSubBlock.h.

351{
354}
static const int s_maxStreamedBits
static const uint32_t s_maxStreamedMask

◆ setUnpackErrorCode()

void ZdcSubBlock::setUnpackErrorCode ( int code)
inline

Set the unpacking error code.

Definition at line 340 of file ZdcSubBlock.h.

341{
343}

◆ slice()

int ZdcSubBlock::slice ( ) const
inline

Definition at line 260 of file ZdcSubBlock.h.

261{
262 return seqno();
263}

◆ slices1()

int ZdcSubBlock::slices1 ( ) const
inline

Definition at line 280 of file ZdcSubBlock.h.

281{
282 return (m_header >> s_slices1Bit) & s_slices1Mask;
283}

◆ slices2()

int ZdcSubBlock::slices2 ( ) const
inline

Definition at line 275 of file ZdcSubBlock.h.

276{
277 return (m_header >> s_slices2Bit) & s_slices2Mask;
278}

◆ subStatus()

uint32_t ZdcSubBlock::subStatus ( ) const
inline

Return Sub-status word.

Definition at line 325 of file ZdcSubBlock.h.

326{
327 return m_trailer;
328}

◆ unpacker()

uint32_t ZdcSubBlock::unpacker ( int nbits)

Unpack given number of bits of data.

Definition at line 309 of file ZdcSubBlock.cxx.

310{
311 uint32_t word = 0;
312 if (nbits > 0) {
313 if (m_dataPos == m_dataPosEnd) {
314 m_unpackerFlag = false;
315 return 0;
316 }
317 int nbitsDone = nbits;
318 if (nbitsDone > m_maxBits - m_currentBit) {
319 nbitsDone = m_maxBits - m_currentBit;
320 }
321 uint32_t mask = 0x1;
322 for (int i = 1; i < nbitsDone; ++i) mask |= (mask << 1);
323 word = (m_bitword >> m_currentBit) & mask;
324 m_currentBit += nbits;
325 if (m_currentBit >= m_maxBits) {
326 m_bitword = 0;
327 if (m_dataPos != m_dataPosEnd) {
328 ++m_dataPos;
329 if (m_dataPos != m_dataPosEnd) {
331 }
332 }
333 m_currentBit = 0;
334 const int bitsLeft = nbits - nbitsDone;
335 if (bitsLeft > 0) {
336 if (m_dataPos == m_dataPosEnd) {
337 m_unpackerFlag = false;
338 return word;
339 }
340 mask = 0x1;
341 for (int i = 1; i < bitsLeft; ++i) mask |= (mask << 1);
342 word |= (m_bitword & mask) << nbitsDone;
343 m_currentBit = bitsLeft;
344 }
345 }
346 }
347 return word;
348}
std::vector< uint32_t >::const_iterator m_dataPos
std::vector< uint32_t >::const_iterator m_dataPosEnd

◆ unpackerInit()

void ZdcSubBlock::unpackerInit ( )

Initialise unpacker.

Definition at line 352 of file ZdcSubBlock.cxx.

353{
354 m_bitword = 0;
355 m_currentBit = 0;
356 m_unpackerFlag = true;
357 m_dataPos = m_data.begin();
358 m_dataPosEnd = m_data.end();
360}

◆ unpackerNeutral()

uint32_t ZdcSubBlock::unpackerNeutral ( int pin,
int nbits )

Unpack given number of bits of neutral data for given pin.

Definition at line 392 of file ZdcSubBlock.cxx.

393{
394 uint32_t word = 0;
395 if (pin >= 0 && pin < s_maxPins && nbits > 0
396 && m_currentPinBit[pin] + nbits <= m_dataWords) {
397 for (int bit = 0; bit < nbits; ++bit) {
398 word |= ((m_data[m_currentPinBit[pin] + bit] >> pin) & 0x1) << bit;
399 }
400 m_currentPinBit[pin] += nbits;
401 m_oddParity[pin] = parityBit(m_oddParity[pin], word, nbits);
402 } else m_unpackerFlag = false;
403 return word;
404}

◆ unpackerNeutralParityError()

bool ZdcSubBlock::unpackerNeutralParityError ( int pin)

Unpack and test G-Link parity bit for given pin.

Definition at line 408 of file ZdcSubBlock.cxx.

409{
410 bool error = true;
411 if (pin >= 0 && pin < s_maxPins) {
412 int parity = m_oddParity[pin];
413 int bit = unpackerNeutral(pin, 1);
414 m_oddParity[pin] = 1;
415 error = !(bit == parity);
416 }
417 return error;
418}
uint32_t unpackerNeutral(int pin, int nbits)
Unpack given number of bits of neutral data for given pin.

◆ unpackErrorCode()

int ZdcSubBlock::unpackErrorCode ( ) const
inline

Return the unpacking error code.

Definition at line 345 of file ZdcSubBlock.h.

346{
347 return m_unpackError;
348}

◆ unpackErrorMsg()

std::string ZdcSubBlock::unpackErrorMsg ( ) const

Return the unpacking error message for printing.

Definition at line 206 of file ZdcSubBlock.cxx.

207{
208 std::string msg;
209 switch (m_unpackError) {
210 case UNPACK_NONE:
211 msg = "No error";
212 break;
213 case UNPACK_VERSION:
214 msg = "Unsupported Data Version";
215 break;
216 case UNPACK_FORMAT:
217 msg = "Unsupported Data Format";
218 break;
220 msg = "Unsupported Compression Version";
221 break;
223 msg = "Unsupported Number of Slices for Compression Version";
224 break;
226 msg = "Premature End of Sub-block Data";
227 break;
228 case UNPACK_SOURCE_ID:
229 msg = "Invalid Source ID in Sub-block Data";
230 break;
231 case UNPACK_WORD_ID:
232 msg = "Invalid Word ID in Sub-block Data";
233 break;
234 default:
235 msg = "Unknown Error Code";
236 break;
237 }
238 return msg;
239}
MsgStream & msg
Definition testRead.cxx:32

◆ unpackerSuccess()

bool ZdcSubBlock::unpackerSuccess ( ) const
inline

Return unpacker success flag.

Definition at line 356 of file ZdcSubBlock.h.

357{
358 return m_unpackerFlag;
359}

◆ upstreamError()

bool ZdcSubBlock::upstreamError ( ) const
inline

Definition at line 300 of file ZdcSubBlock.h.

301{
302 return m_trailer & (0x1 << s_upstreamErrorBit);
303}

◆ version()

int ZdcSubBlock::version ( ) const
inline

Definition at line 245 of file ZdcSubBlock.h.

246{
247 return (m_header >> s_versionBit) & s_versionMask;
248}

◆ wordId() [1/2]

int ZdcSubBlock::wordId ( ) const
inline

Definition at line 240 of file ZdcSubBlock.h.

241{
242 return (m_header >> s_wordIdBit) & s_wordIdMask;
243}

◆ wordId() [2/2]

int ZdcSubBlock::wordId ( uint32_t word)
static

Return wordID field from given header word.

Definition at line 434 of file ZdcSubBlock.cxx.

435{
436 return (word >> s_wordIdBit) & s_wordIdMask;
437}

◆ wordType()

ZdcSubBlock::SubBlockWordType ZdcSubBlock::wordType ( uint32_t word)
static

Word identification.

Definition at line 422 of file ZdcSubBlock.cxx.

423{
425 if (((word >> s_headerBit) & s_headerMask) == s_headerVal) {
426 if (((word >> s_statusBit) & s_statusMask) == s_statusVal) type = STATUS;
427 else type = HEADER;
428 }
429 return type;
430}
static const uint32_t s_headerVal
static const int s_headerBit
ZdcSubBlock.cxx this is a base class derived (copyed) from LVL1 I do not think we need this this way;...
static const uint32_t s_headerMask

◆ write()

void ZdcSubBlock::write ( FullEventAssembler< ZdcSrcIdMap >::RODDATA * theROD) const

Output complete packed sub-block to ROD vector.

Definition at line 147 of file ZdcSubBlock.cxx.

149{
150 theROD->push_back(m_header);
151 std::vector<uint32_t>::const_iterator pos;
152 for (pos = m_data.begin(); pos != m_data.end(); ++pos) {
153 theROD->push_back(*pos);
154 }
155 if (m_trailer) theROD->push_back(m_trailer);
156}

Member Data Documentation

◆ m_bitword

uint32_t ZdcSubBlock::m_bitword {}
private

Definition at line 218 of file ZdcSubBlock.h.

218{};

◆ m_bunchCrossing

int ZdcSubBlock::m_bunchCrossing {}
private

Bunch Crossing number (neutral format only)

Definition at line 214 of file ZdcSubBlock.h.

214{};

◆ m_currentBit

int ZdcSubBlock::m_currentBit {}
private

Definition at line 219 of file ZdcSubBlock.h.

219{};

◆ m_currentPinBit

std::vector<int> ZdcSubBlock::m_currentPinBit
private

Definition at line 226 of file ZdcSubBlock.h.

◆ m_data

std::vector<uint32_t> ZdcSubBlock::m_data
private

Sub-Block data.

Definition at line 231 of file ZdcSubBlock.h.

◆ m_dataPos

std::vector<uint32_t>::const_iterator ZdcSubBlock::m_dataPos {}
private

Definition at line 223 of file ZdcSubBlock.h.

223{};

◆ m_dataPosEnd

std::vector<uint32_t>::const_iterator ZdcSubBlock::m_dataPosEnd {}
private

Definition at line 224 of file ZdcSubBlock.h.

224{};

◆ m_dataWords

int ZdcSubBlock::m_dataWords {}
private

Current number of data words.

Definition at line 229 of file ZdcSubBlock.h.

229{};

◆ m_header

uint32_t ZdcSubBlock::m_header {}
private

Sub-Block Header.

Definition at line 210 of file ZdcSubBlock.h.

210{};

◆ m_maxBits

int ZdcSubBlock::m_maxBits {}
private

Definition at line 220 of file ZdcSubBlock.h.

220{};

◆ m_maxMask

uint32_t ZdcSubBlock::m_maxMask {}
private

Definition at line 221 of file ZdcSubBlock.h.

221{};

◆ m_oddParity

std::vector<int> ZdcSubBlock::m_oddParity
private

Definition at line 227 of file ZdcSubBlock.h.

◆ m_trailer

uint32_t ZdcSubBlock::m_trailer {}
private

Sub-Block Status Trailer.

Definition at line 212 of file ZdcSubBlock.h.

212{};

◆ m_unpackerFlag

bool ZdcSubBlock::m_unpackerFlag {}
private

Definition at line 222 of file ZdcSubBlock.h.

222{};

◆ m_unpackError

int ZdcSubBlock::m_unpackError {}
private

Unpacking error code.

Definition at line 216 of file ZdcSubBlock.h.

216{};

◆ s_bcnMismatchBit

const int ZdcSubBlock::s_bcnMismatchBit = 2
staticprivate

Definition at line 196 of file ZdcSubBlock.h.

◆ s_crateBit

const int ZdcSubBlock::s_crateBit = 12
staticprivate

Definition at line 178 of file ZdcSubBlock.h.

◆ s_crateMask

const uint32_t ZdcSubBlock::s_crateMask = 0xf
staticprivate

Definition at line 186 of file ZdcSubBlock.h.

◆ s_daqOverflowBit

const int ZdcSubBlock::s_daqOverflowBit = 3
staticprivate

Definition at line 195 of file ZdcSubBlock.h.

◆ s_failingBcnBit

const int ZdcSubBlock::s_failingBcnBit = 22
staticprivate

Definition at line 191 of file ZdcSubBlock.h.

◆ s_failingBcnMask

const uint32_t ZdcSubBlock::s_failingBcnMask = 0x3f
staticprivate

Definition at line 199 of file ZdcSubBlock.h.

◆ s_formatBit

const int ZdcSubBlock::s_formatBit = 22
staticprivate

Definition at line 176 of file ZdcSubBlock.h.

◆ s_formatMask

const uint32_t ZdcSubBlock::s_formatMask = 0x7
staticprivate

Definition at line 184 of file ZdcSubBlock.h.

◆ s_glinkDavSet

const uint32_t ZdcSubBlock::s_glinkDavSet = 0x400000
staticprivate

Definition at line 207 of file ZdcSubBlock.h.

◆ s_glinkDownBit

const int ZdcSubBlock::s_glinkDownBit = 6
staticprivate

Definition at line 193 of file ZdcSubBlock.h.

◆ s_glinkParityBit

const int ZdcSubBlock::s_glinkParityBit = 0
staticprivate

Definition at line 198 of file ZdcSubBlock.h.

◆ s_glinkProtocolBit

const int ZdcSubBlock::s_glinkProtocolBit = 1
staticprivate

Definition at line 197 of file ZdcSubBlock.h.

◆ s_glinkTimeoutBit

const int ZdcSubBlock::s_glinkTimeoutBit = 7
staticprivate

Definition at line 192 of file ZdcSubBlock.h.

◆ s_headerBit

const int ZdcSubBlock::s_headerBit = 30
staticprivate

ZdcSubBlock.cxx this is a base class derived (copyed) from LVL1 I do not think we need this this way; either implement directly on PpmSubBlock or link to LVL1.

TRY_LINK_LVL1

Marco Leite 27 May 2009

Definition at line 167 of file ZdcSubBlock.h.

◆ s_headerMask

const uint32_t ZdcSubBlock::s_headerMask = 0x3
staticprivate

Definition at line 169 of file ZdcSubBlock.h.

◆ s_headerVal

const uint32_t ZdcSubBlock::s_headerVal = 0x3
staticprivate

Definition at line 171 of file ZdcSubBlock.h.

◆ s_maxPins

const int ZdcSubBlock::s_maxPins = 20
staticprivate

Definition at line 206 of file ZdcSubBlock.h.

◆ s_maxStreamedBits

const int ZdcSubBlock::s_maxStreamedBits = 31
staticprivate

Definition at line 202 of file ZdcSubBlock.h.

◆ s_maxStreamedMask

const uint32_t ZdcSubBlock::s_maxStreamedMask = 0x7fffffff
staticprivate

Definition at line 204 of file ZdcSubBlock.h.

◆ s_maxWordBits

const int ZdcSubBlock::s_maxWordBits = 32
staticprivate

Definition at line 201 of file ZdcSubBlock.h.

◆ s_maxWordMask

const uint32_t ZdcSubBlock::s_maxWordMask = 0xffffffff
staticprivate

Definition at line 203 of file ZdcSubBlock.h.

◆ s_moduleBit

const int ZdcSubBlock::s_moduleBit = 8
staticprivate

Definition at line 179 of file ZdcSubBlock.h.

◆ s_moduleMask

const uint32_t ZdcSubBlock::s_moduleMask = 0xf
staticprivate

Definition at line 187 of file ZdcSubBlock.h.

◆ s_seqnoBit

const int ZdcSubBlock::s_seqnoBit = 16
staticprivate

Definition at line 177 of file ZdcSubBlock.h.

◆ s_seqnoMask

const uint32_t ZdcSubBlock::s_seqnoMask = 0x3f
staticprivate

Definition at line 185 of file ZdcSubBlock.h.

◆ s_slices1Bit

const int ZdcSubBlock::s_slices1Bit = 0
staticprivate

Definition at line 181 of file ZdcSubBlock.h.

◆ s_slices1Mask

const uint32_t ZdcSubBlock::s_slices1Mask = 0x7
staticprivate

Definition at line 189 of file ZdcSubBlock.h.

◆ s_slices2Bit

const int ZdcSubBlock::s_slices2Bit = 3
staticprivate

Definition at line 180 of file ZdcSubBlock.h.

◆ s_slices2Mask

const uint32_t ZdcSubBlock::s_slices2Mask = 0x1f
staticprivate

Definition at line 188 of file ZdcSubBlock.h.

◆ s_statusBit

const int ZdcSubBlock::s_statusBit = 28
staticprivate

Definition at line 168 of file ZdcSubBlock.h.

◆ s_statusMask

const uint32_t ZdcSubBlock::s_statusMask = 0x1
staticprivate

Definition at line 170 of file ZdcSubBlock.h.

◆ s_statusVal

const uint32_t ZdcSubBlock::s_statusVal = 0x1
staticprivate

Definition at line 172 of file ZdcSubBlock.h.

◆ s_upstreamErrorBit

const int ZdcSubBlock::s_upstreamErrorBit = 4
staticprivate

Definition at line 194 of file ZdcSubBlock.h.

◆ s_versionBit

const int ZdcSubBlock::s_versionBit = 25
staticprivate

Definition at line 175 of file ZdcSubBlock.h.

◆ s_versionMask

const uint32_t ZdcSubBlock::s_versionMask = 0x7
staticprivate

Definition at line 183 of file ZdcSubBlock.h.

◆ s_wordIdBit

const int ZdcSubBlock::s_wordIdBit = 28
staticprivate

Definition at line 174 of file ZdcSubBlock.h.

◆ s_wordIdMask

const uint32_t ZdcSubBlock::s_wordIdMask = 0xf
staticprivate

Definition at line 182 of file ZdcSubBlock.h.


The documentation for this class was generated from the following files: