9#include "daq/dataobjects/SndHdrTemp.h"
24 memcpy(m_buffer, buffer, SENDHDR_NWORDS *
sizeof(
int));
38 memcpy(m_buffer, bufin, SENDHDR_NWORDS *
sizeof(
int));
41void SndHdrTemp::Initialize()
43 memset(m_buffer, 0,
sizeof(
int)* SENDHDR_NWORDS);
44 m_buffer[ POS_HDR_NWORDS ] = SENDHDR_NWORDS;
52 m_buffer[ POS_NWORDS ] = total_data_nwords;
55void SndHdrTemp::SetExpRunWord(
unsigned int exp_run)
57 m_buffer[ POS_EXP_RUN_NUM ] = exp_run;
62 m_buffer[ POS_NUM_EVE_NUM_NODES ] =
63 (m_buffer[ POS_NUM_EVE_NUM_NODES ] & 0x0000FFFF) |
64 ((num_events << 16) & 0xFFFF0000);
67void 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);
75void SndHdrTemp::SetEventNumber(
int eve_num)
77 m_buffer[ POS_EVE_NUM ] = eve_num;
81void SndHdrTemp::SetNodeID(
int node_id)
83 m_buffer[ POS_NODE_ID ] = node_id;
87void 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);
98void 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);
107void 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);
122int SndHdrTemp::GetTotalNwords() {
return m_buffer[ POS_NWORDS ];}
127 ((m_buffer[ POS_NUM_EVE_NUM_NODES ] & 0xFFFF0000) >> 16) & 0x0000FFFF;
130int SndHdrTemp::GetNumNodesinPacket() {
return m_buffer[ POS_NUM_EVE_NUM_NODES ] & 0x0000FFFF; }
132int SndHdrTemp::GetEventNumber() {
return m_buffer[ POS_EVE_NUM ]; }
134int SndHdrTemp::GetNodeID() {
return m_buffer[ POS_NODE_ID ]; }
136int SndHdrTemp::GetRunNum()
138 return (((
unsigned int)(m_buffer[ POS_EXP_RUN_NUM ]) & tmp_header.RUNNO_MASK) >> tmp_header.RUNNO_SHIFT);
141int SndHdrTemp::GetSubRunNum()
143 return ((
unsigned int)(m_buffer[ POS_EXP_RUN_NUM ]) & tmp_header.SUBRUNNO_MASK);
146int SndHdrTemp::GetRunNumSubRunNum()
149 return ((
unsigned int)(m_buffer[ POS_EXP_RUN_NUM ]) &
150 (tmp_header.RUNNO_MASK | tmp_header.SUBRUNNO_MASK));
154int SndHdrTemp::GetExpNum()
157 return (((
unsigned int)(m_buffer[ POS_EXP_RUN_NUM ]) & tmp_header.EXP_MASK) >> tmp_header.EXP_SHIFT);
void SetBuffer(int *hdr)
set buffer
void SetNumEventsinPacket(int num_events)
set contents of Header
int GetHdrNwords()
get contents of Header
void SetNwords(int total_data_nwords)
initialize Header
int GetNumEventsinPacket()
get contents of Header
int * GetBuffer(void)
Get Header contents.
SndHdrTemp()
Default constructor.
Abstract base class for different kinds of events.