4 #ifndef HTBDAQ_DATA_STANDALONE 19 : m_formatVersion(hd.m_formatVersion), m_rawLength(hd.m_rawLength), m_rawConst(hd.m_rawConst), m_ownData(nullptr) {}
28 const int needed = 0x200;
70 if (tp_lengths !=
nullptr)
71 memset(tp_lengths, 0, 1);
73 int tp_words_total, headerLen, trailerLen;
77 const unsigned short* tpBase =
m_rawConst + headerLen;
79 if (tp_lengths !=
nullptr) {
80 for (wordPtr = 0; wordPtr < tp_words_total; wordPtr++) {
81 tp_samples[tp_lengths[0]] = tpBase[wordPtr];
97 int tp_words_total = 0, headerLen, trailerLen;
104 unsigned short* ptr =
m_ownData + headerLen;
105 if (tp_samples !=
nullptr && tp_lengths !=
nullptr) {
106 for (isample = 0; isample < tp_lengths[0] && isample < 12; isample++) {
107 ptr[tp_words_total] = tp_samples[isample];
113 unsigned short totalLen = headerLen + tp_words_total + trailerLen;
118 m_ownData[totalLen - 4] = tp_words_total;
122 int L1Anumber,
int bcn,
int submodule,
int orbitn,
int pipeline,
int ndd,
int nps,
int firmwareRev) {
124 m_ownData[1] = (L1Anumber & 0xFFFF00) >> 8;
127 m_ownData[3] = ((orbitn & 0x1F) << 11) | (submodule & 0x7FF);
129 m_ownData[5] |= ((nps & 0xF) << 4) | 0x1;
130 m_ownData[6] = ((firmwareRev & 0x70000) >> 3) | (firmwareRev & 0x1FFF);
131 m_ownData[7] = (pipeline & 0xFF) | ((ndd & 0x1F) << 8);
void unpack(unsigned char *tp_lengths, unsigned short *tp_samples) const
Unpack the HTR data into TP and DAQ data sorted by channel.
void adoptData(const unsigned short *data, int length)
unsigned int getFirmwareRevision() const
Get the Merger firmware version.
void allocate(int version_to_create=0)
bool check() const
Check for a good event Requires a minimum length, matching wordcount and length, not an empty event...
CastorMergerData & operator=(const CastorMergerData &)
const unsigned short * m_rawConst
void packHeaderTrailer(int L1Anumber, int bcn, int submodule, int orbitn, int pipeline, int ndd, int nps, int firmwareRev=0)
pack header and trailer (call after pack)
unsigned int getOrbitNumber() const
Get the HTR orbit number.
char data[epos_bytes_allocation]
unsigned short * m_ownData
void determineSectionLengths(int &tpWords, int &headerWords, int &trailerWords) const
void determineStaticLengths(int &headerWords, int &trailerWords) const
void pack(unsigned char *tp_lengths, unsigned short *tp_samples)
Unpack the HTR data into TP and DAQ data sorted by channel.