9#include <tracking/dataobjects/ROIpayload.h>
11#include <boost/crc.hpp>
13#include <framework/logging/Logger.h>
15#define MAGIC_WORD (0xBE12DA7A)
18using boost::crc_optimal;
22 init(HEADER_SIZE_WITH_LENGTH + 2 * rois + 1);
39 m_data32[OFFSET_MAGIC] = htonl(MAGIC_WORD);
40 m_data32[OFFSET_LENGTH] = htonl(length);
46 unsigned int lengthInBytes =
53 m_data32[OFFSET_MAGIC] = htonl(MAGIC_WORD);
54 m_data32[OFFSET_LENGTH] = htonl(lengthInBytes);
60 unsigned int h = 0xCAFE0000;
61 if (Accepted) h |= 0x8000;
71 m_data32[OFFSET_TRIGNR] = htonl(triggerNumber);
77 rseNumber = (exp & 0x3FF) << 22 | (run & 0x3FFF) << 8 | (subrun & 0xFF) ;
78 m_data32[OFFSET_RUNNR] = htonl(rseNumber);
85 B2ERROR(
"Adding too many ROIs to the ROIpayload." << std::endl <<
86 "Something really fishy is going on");
99 B2ERROR(
"No space left on the ROI payload to write the CRC." << std::endl);
103 crc_optimal<32, 0x04C11DB7, 0, 0, false, false> dhh_crc_32;
105 dhh_crc_32.process_bytes((
void*)(
m_rootdata + OFFSET_HEADER),
106 HEADER_SIZE_WO_LENGTH *
sizeof(uint32_t) +
m_index *
sizeof(uint64_t));
int m_packetLengthByte
packet length in byte
void addROIraw(unsigned long int roiraw)
add a ROIrawID
int m_length
packet length
void setHeader(bool Accepted, bool SendAll, bool SendROIs)
set header
uint32_t * m_data32
transient value
void setRunSubrunExpNumber(int run, int subrun, int exp)
set run/ subrun/exp number
int * m_rootdata
pointer to data packet of m_length words
ROIpayload(int rois=0)
Default constructor.
void setTriggerNumber(unsigned long int triggerNumber)
set trigger number
void init(int length)
initializer
void setPayloadLength()
set payload length
int m_index
transient index
ROIrawID::baseType * m_data64
transient value
uint64_t baseType
base type
Abstract base class for different kinds of events.