9 #include "daq/dataobjects/SndHdrTemp.h"
15 SndHdrTemp::SndHdrTemp()
21 SndHdrTemp::SndHdrTemp(
int* buffer)
24 memcpy(m_buffer, buffer, SENDHDR_NWORDS *
sizeof(
int));
27 SndHdrTemp::~SndHdrTemp()
31 int* SndHdrTemp::GetBuffer()
36 void SndHdrTemp::SetBuffer(
int* bufin)
38 memcpy(m_buffer, bufin, SENDHDR_NWORDS *
sizeof(
int));
41 void SndHdrTemp::Initialize()
43 memset(m_buffer, 0,
sizeof(
int)* SENDHDR_NWORDS);
44 m_buffer[ POS_HDR_NWORDS ] = SENDHDR_NWORDS;
50 void SndHdrTemp::SetNwords(
int total_data_nwords)
52 m_buffer[ POS_NWORDS ] = total_data_nwords;
55 void SndHdrTemp::SetExpRunWord(
unsigned int exp_run)
57 m_buffer[ POS_EXP_RUN_NUM ] = exp_run;
60 void SndHdrTemp::SetNumEventsinPacket(
int num_events)
62 m_buffer[ POS_NUM_EVE_NUM_NODES ] =
63 (m_buffer[ POS_NUM_EVE_NUM_NODES ] & 0x0000FFFF) |
64 ((num_events << 16) & 0xFFFF0000);
67 void SndHdrTemp::SetNumNodesinPacket(
int num_nodes)
69 m_buffer[ POS_NUM_EVE_NUM_NODES ] =
70 (m_buffer[ POS_NUM_EVE_NUM_NODES ] & 0xFFFF0000) |
71 (num_nodes & 0x0000FFFF);
75 void SndHdrTemp::SetEventNumber(
int eve_num)
77 m_buffer[ POS_EVE_NUM ] = eve_num;
81 void SndHdrTemp::SetNodeID(
int node_id)
83 m_buffer[ POS_NODE_ID ] = node_id;
87 void SndHdrTemp::SetRunNum(
int run_num)
90 unsigned int inv_mask = ~((
unsigned int)(tmp_header.RUNNO_MASK));
91 m_buffer[ POS_EXP_RUN_NUM ] =
92 ((
unsigned int)m_buffer[ POS_EXP_RUN_NUM ] & inv_mask) |
93 (((
unsigned int)run_num << tmp_header.RUNNO_SHIFT) & tmp_header.RUNNO_MASK);
98 void SndHdrTemp::SetSubRunNum(
int subrun_num)
101 unsigned int inv_mask = ~((
unsigned int)(tmp_header.SUBRUNNO_MASK));
102 m_buffer[ POS_EXP_RUN_NUM ] =
103 ((
unsigned int)m_buffer[ POS_EXP_RUN_NUM ] & inv_mask) | ((
unsigned int)subrun_num & tmp_header.SUBRUNNO_MASK);
107 void SndHdrTemp::SetExpNum(
int exp_num)
110 unsigned int inv_mask = ~((
unsigned int)(tmp_header.EXP_MASK));
111 m_buffer[ POS_EXP_RUN_NUM ] =
112 ((
unsigned int)m_buffer[ POS_EXP_RUN_NUM ] & inv_mask) |
113 (((
unsigned int)exp_num << tmp_header.EXP_SHIFT) & tmp_header.EXP_MASK);
122 int SndHdrTemp::GetTotalNwords() {
return m_buffer[ POS_NWORDS ];}
123 int SndHdrTemp::GetHdrNwords() {
return SENDHDR_NWORDS; }
124 int SndHdrTemp::GetNumEventsinPacket()
127 ((m_buffer[ POS_NUM_EVE_NUM_NODES ] & 0xFFFF0000) >> 16) & 0x0000FFFF;
130 int SndHdrTemp::GetNumNodesinPacket() {
return m_buffer[ POS_NUM_EVE_NUM_NODES ] & 0x0000FFFF; }
132 int SndHdrTemp::GetEventNumber() {
return m_buffer[ POS_EVE_NUM ]; }
134 int SndHdrTemp::GetNodeID() {
return m_buffer[ POS_NODE_ID ]; }
136 int SndHdrTemp::GetRunNum()
138 return (((
unsigned int)(m_buffer[ POS_EXP_RUN_NUM ]) & tmp_header.RUNNO_MASK) >> tmp_header.RUNNO_SHIFT);
141 int SndHdrTemp::GetSubRunNum()
143 return ((
unsigned int)(m_buffer[ POS_EXP_RUN_NUM ]) & tmp_header.SUBRUNNO_MASK);
146 int SndHdrTemp::GetRunNumSubRunNum()
149 return ((
unsigned int)(m_buffer[ POS_EXP_RUN_NUM ]) &
150 (tmp_header.RUNNO_MASK | tmp_header.SUBRUNNO_MASK));
154 int SndHdrTemp::GetExpNum()
157 return (((
unsigned int)(m_buffer[ POS_EXP_RUN_NUM ]) & tmp_header.EXP_MASK) >> tmp_header.EXP_SHIFT);
Abstract base class for different kinds of events.