113 word |= (
module & s_moduleMask) << s_moduleBit;
129 for (; pos != pose; ++pos) {
130 const uint32_t word = *pos;
151 std::vector<uint32_t>::const_iterator pos;
152 for (pos =
m_data.begin(); pos !=
m_data.end(); ++pos) {
153 theROD->push_back(*pos);
190 else setStatus(0,
false,
false,
false,
true,
false,
false,
false);
200 else setStatus(0,
false,
false,
false,
false,
false,
false,
true);
214 msg =
"Unsupported Data Version";
217 msg =
"Unsupported Data Format";
220 msg =
"Unsupported Compression Version";
223 msg =
"Unsupported Number of Slices for Compression Version";
226 msg =
"Premature End of Sub-block Data";
229 msg =
"Invalid Source ID in Sub-block Data";
232 msg =
"Invalid Word ID in Sub-block Data";
235 msg =
"Unknown Error Code";
247 const int maxBits = 32;
249 for (
int i = 0; i < maxBits; ++i) {
250 if ( !(datum >> i)) {
265 for (
int bit = 0; bit < nbits; ++bit) parity ^= (datum >> bit) & 0x1;
275 for (
int i = 1; i < nbits; ++i) mask |= (mask << 1);
284 m_bitword = (datum & mask) >> (nbits - bitsLeft);
317 int nbitsDone = nbits;
322 for (
int i = 1; i < nbitsDone; ++i) mask |= (mask << 1);
334 const int bitsLeft = nbits - nbitsDone;
341 for (
int i = 1; i < bitsLeft; ++i) mask |= (mask << 1);
367 if (pin >= 0 && pin < s_maxPins && nbits > 0) {
372 for (
int bit = 0; bit < nbits; ++bit) {
395 if (pin >= 0 && pin < s_maxPins && nbits > 0
397 for (
int bit = 0; bit < nbits; ++bit) {
415 error = !(bit == parity);
std::vector< uint32_t > RODDATA
ROD data as a vector of unsigned int.
static int parityBit(int init, uint32_t datum, int nbits)
Return the parity bit for given data.
uint32_t unpackerNeutral(int pin, int nbits)
Unpack given number of bits of neutral data for given pin.
static const int s_versionBit
static const int s_failingBcnBit
bool glinkProtocol() const
static const int s_seqnoBit
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 unpackerInit()
Initialise unpacker.
uint32_t unpacker(int nbits)
Unpack given number of bits of data.
bool glinkTimeout() const
static const uint32_t s_headerVal
static const int s_maxStreamedBits
static const uint32_t s_statusVal
static const int s_glinkParityBit
static const int s_maxWordBits
int m_dataWords
Current number of data words.
void packerNeutral(int pin, uint32_t datum, int nbits)
Pack given neutral data from given pin.
static const int s_formatBit
static const uint32_t s_glinkDavSet
@ UNPACK_COMPRESSION_VERSION
@ UNPACK_COMPRESSION_SLICES
uint32_t m_header
Sub-Block Header.
std::vector< int > m_oddParity
static const int s_glinkDownBit
static const int s_daqOverflowBit
static int minBits(uint32_t datum)
Return the minimum number of bits needed for given data.
static const uint32_t s_formatMask
void write(FullEventAssembler< ZdcSrcIdMap >::RODDATA *theROD) const
Output complete packed sub-block to ROD vector.
static const uint32_t s_maxWordMask
void setDaqOverflow(int bit=1)
Set DAQ FIFO Overflow bit in Sub-status word.
static const int s_maxPins
uint32_t failingBCN() const
void setHeader(int wordId, int version, int format, int seqno, int crate, int module, int slices2, int slices1)
Store header data.
bool unpackerNeutralParityError(int pin)
Unpack and test G-Link parity bit for given pin.
static const uint32_t s_maxStreamedMask
static const uint32_t s_failingBcnMask
static const int s_bcnMismatchBit
std::vector< uint32_t > m_data
Sub-Block data.
static const int s_statusBit
void packer(uint32_t datum, int nbits)
Pack given data into given number of bits.
static const uint32_t s_statusMask
std::string unpackErrorMsg() const
Return the unpacking error message for printing.
int m_unpackError
Unpacking error code.
void packerNeutralParity(int pin)
Pack current G-Link parity bit for given pin.
static const int s_crateBit
static const int s_upstreamErrorBit
void setStatus(uint32_t failingBCN, bool glinkTimeout, bool glinkDown, bool upstreamError, bool daqOverflow, bool bcnMismatch, bool glinkProtocol, bool glinkParity)
Store error status trailer.
static const int s_wordIdBit
static const uint32_t s_versionMask
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_slices1Mask
static const int s_slices1Bit
std::vector< uint32_t >::const_iterator m_dataPos
void packerFlush()
Flush the current data word padded with zeros.
void clear()
Clear all data.
bool upstreamError() const
static SubBlockWordType wordType(uint32_t word)
Word identification.
void setGlinkParity(int bit=1)
Set G-Link Parity bit in Sub-status word.
static const uint32_t s_seqnoMask
static const uint32_t s_headerMask
static const uint32_t s_crateMask
static const int s_moduleBit
static const uint32_t s_wordIdMask
static const int s_slices2Bit
std::vector< int > m_currentPinBit
static const uint32_t s_slices2Mask
static const int s_glinkTimeoutBit
static const int s_glinkProtocolBit
std::vector< uint32_t >::const_iterator m_dataPosEnd
int m_bunchCrossing
Bunch Crossing number (neutral format only)
uint32_t m_trailer
Sub-Block Status Trailer.
static const uint32_t s_moduleMask
const DataType * PointerType