9#include "daq/dataobjects/SendHeader.h"
25 memcpy(m_buffer, buffer, SENDHDR_NWORDS *
sizeof(
int));
39 memcpy(m_buffer, bufin, SENDHDR_NWORDS *
sizeof(
int));
42void SendHeader::Initialize()
44 memset(m_buffer, 0,
sizeof(
int)* SENDHDR_NWORDS);
45 m_buffer[ POS_HDR_NWORDS ] = SENDHDR_NWORDS;
53 m_buffer[ POS_NWORDS ] = total_data_nwords;
56void SendHeader::SetExpRunWord(
unsigned int exp_run)
58 m_buffer[ POS_EXP_RUN_NUM ] = exp_run;
63 m_buffer[ POS_NUM_EVE_NUM_NODES ] =
64 (m_buffer[ POS_NUM_EVE_NUM_NODES ] & 0x0000FFFF) |
65 ((num_events << 16) & 0xFFFF0000);
68void SendHeader::SetNumNodesinPacket(
int num_nodes)
70 m_buffer[ POS_NUM_EVE_NUM_NODES ] =
71 (m_buffer[ POS_NUM_EVE_NUM_NODES ] & 0xFFFF0000) |
72 (num_nodes & 0x0000FFFF);
76void SendHeader::SetEventNumber(
int eve_num)
78 m_buffer[ POS_EVE_NUM ] = eve_num;
82void SendHeader::SetNodeID(
int node_id)
84 m_buffer[ POS_NODE_ID ] = node_id;
88void SendHeader::SetRunNum(
int run_num)
91 unsigned int inv_mask = ~((
unsigned int)(RUNNO_MASK));
92 m_buffer[ POS_EXP_RUN_NUM ] =
93 ((
unsigned int)m_buffer[ POS_EXP_RUN_NUM ] & inv_mask) |
94 (((
unsigned int)run_num << RUNNO_SHIFT) & RUNNO_MASK);
99void SendHeader::SetSubRunNum(
int subrun_num)
102 unsigned int inv_mask = ~((
unsigned int)(SUBRUNNO_MASK));
103 m_buffer[ POS_EXP_RUN_NUM ] =
104 ((
unsigned int)m_buffer[ POS_EXP_RUN_NUM ] & inv_mask) | ((
unsigned int)subrun_num & SUBRUNNO_MASK);
108void SendHeader::SetExpNum(
int exp_num)
111 unsigned int inv_mask = ~((
unsigned int)(EXP_MASK));
112 m_buffer[ POS_EXP_RUN_NUM ] =
113 ((
unsigned int)m_buffer[ POS_EXP_RUN_NUM ] & inv_mask) |
114 (((
unsigned int)exp_num << EXP_SHIFT) & EXP_MASK);
123int SendHeader::GetTotalNwords() {
return m_buffer[ POS_NWORDS ];}
128 ((m_buffer[ POS_NUM_EVE_NUM_NODES ] & 0xFFFF0000) >> 16) & 0x0000FFFF;
131int SendHeader::GetNumNodesinPacket() {
return m_buffer[ POS_NUM_EVE_NUM_NODES ] & 0x0000FFFF; }
133int SendHeader::GetEventNumber() {
return m_buffer[ POS_EVE_NUM ]; }
135int SendHeader::GetNodeID() {
return m_buffer[ POS_NODE_ID ]; }
137int SendHeader::GetRunNum()
139 return (((
unsigned int)(m_buffer[ POS_EXP_RUN_NUM ]) & RUNNO_MASK) >> RUNNO_SHIFT);
142int SendHeader::GetSubRunNum()
144 return ((
unsigned int)(m_buffer[ POS_EXP_RUN_NUM ]) & SUBRUNNO_MASK);
147int SendHeader::GetRunNumSubRunNum()
150 return ((
unsigned int)(m_buffer[ POS_EXP_RUN_NUM ]) &
151 (RUNNO_MASK | SUBRUNNO_MASK));
155int SendHeader::GetExpNum()
158 return (((
unsigned int)(m_buffer[ POS_EXP_RUN_NUM ]) & EXP_MASK) >> EXP_SHIFT);
Abstract base class for different kinds of events.