Belle II Software development
SendHeader Class Reference

Public Types

enum  { SENDHDR_NWORDS = 6 }
 
enum  {
  POS_NWORDS = 0 ,
  POS_HDR_NWORDS = 1 ,
  POS_NUM_EVE_NUM_NODES = 2 ,
  POS_EXP_RUN_NUM = 3 ,
  POS_EVE_NUM = 4 ,
  POS_NODE_ID = 5
}
 
enum  {
  EXP_MASK = 0xFFC00000 ,
  EXP_SHIFT = 22 ,
  RUNNO_MASK = 0x003FFF00 ,
  RUNNO_SHIFT = 8 ,
  SUBRUNNO_MASK = 0x000000FF
}
 

Public Member Functions

 SendHeader ()
 Default constructor.
 
 SendHeader (int *)
 Constructor using existing pointer to raw data buffer.
 
 ~SendHeader ()
 Destructor.
 
int * GetBuffer (void)
 Get Header contents.
 
void SetBuffer (int *hdr)
 set buffer
 
void Initialize ()
 
void SetNwords (int total_data_nwords)
 initialize Header
 
void SetNumEventsinPacket (int num_events)
 set contents of Header
 
void SetNumNodesinPacket (int num_nodes)
 
void SetEventNumber (int eve_num)
 
void SetNodeID (int node_id)
 
void SetExpRunWord (unsigned int exp_run)
 
void SetRunNum (int run_num)
 
void SetSubRunNum (int subrun_num)
 
void SetExpNum (int exp_num)
 
int GetTotalNwords ()
 
int GetHdrNwords ()
 get contents of Header
 
int GetNumEventsinPacket ()
 get contents of Header
 
int GetNumNodesinPacket ()
 
int GetEventNumber ()
 
int GetNodeID ()
 
int GetRunNum ()
 
int GetSubRunNum ()
 
int GetExpNum ()
 
int GetRunNumSubRunNum ()
 

Private Attributes

int m_buffer [SENDHDR_NWORDS]
 

Detailed Description

Definition at line 21 of file SendHeader.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum

Definition at line 67 of file SendHeader.h.

67 {
68 SENDHDR_NWORDS = 6
69 };

◆ anonymous enum

anonymous enum

Definition at line 72 of file SendHeader.h.

72 {
73 POS_NWORDS = 0,
74 POS_HDR_NWORDS = 1,
75 POS_NUM_EVE_NUM_NODES = 2,
76 POS_EXP_RUN_NUM = 3,
77 POS_EVE_NUM = 4,
78 POS_NODE_ID = 5
79 };

◆ anonymous enum

anonymous enum

Definition at line 82 of file SendHeader.h.

82 {
83 EXP_MASK = 0xFFC00000,
84 EXP_SHIFT = 22,
85 RUNNO_MASK = 0x003FFF00,
86 RUNNO_SHIFT = 8,
87 SUBRUNNO_MASK = 0x000000FF
88 };

Constructor & Destructor Documentation

◆ SendHeader() [1/2]

Default constructor.

Definition at line 16 of file SendHeader.cc.

17{
18 Initialize();
19 // cout << "SendHeader NULL constructor" << endl;
20}

◆ SendHeader() [2/2]

SendHeader ( int *  buffer)

Constructor using existing pointer to raw data buffer.

Definition at line 22 of file SendHeader.cc.

23{
24 // cout << "SendHeader constructor with buffer" << endl;
25 memcpy(m_buffer, buffer, SENDHDR_NWORDS * sizeof(int));
26}

◆ ~SendHeader()

~SendHeader ( )

Destructor.

Definition at line 28 of file SendHeader.cc.

29{
30}

Member Function Documentation

◆ GetBuffer()

int * GetBuffer ( void  )

Get Header contents.

Definition at line 32 of file SendHeader.cc.

33{
34 return m_buffer;
35}

◆ GetEventNumber()

int GetEventNumber ( )

Definition at line 133 of file SendHeader.cc.

133{ return m_buffer[ POS_EVE_NUM ]; }

◆ GetExpNum()

int GetExpNum ( )

Definition at line 155 of file SendHeader.cc.

156{
157
158 return (((unsigned int)(m_buffer[ POS_EXP_RUN_NUM ]) & EXP_MASK) >> EXP_SHIFT);
159}

◆ GetHdrNwords()

int GetHdrNwords ( )

get contents of Header

Definition at line 124 of file SendHeader.cc.

124{ return SENDHDR_NWORDS; }

◆ GetNodeID()

int GetNodeID ( )

Definition at line 135 of file SendHeader.cc.

135{ return m_buffer[ POS_NODE_ID ]; }

◆ GetNumEventsinPacket()

int GetNumEventsinPacket ( )

get contents of Header

Definition at line 125 of file SendHeader.cc.

126{
127 return
128 ((m_buffer[ POS_NUM_EVE_NUM_NODES ] & 0xFFFF0000) >> 16) & 0x0000FFFF;
129
130}

◆ GetNumNodesinPacket()

int GetNumNodesinPacket ( )

Definition at line 131 of file SendHeader.cc.

131{ return m_buffer[ POS_NUM_EVE_NUM_NODES ] & 0x0000FFFF; }

◆ GetRunNum()

int GetRunNum ( )

Definition at line 137 of file SendHeader.cc.

138{
139 return (((unsigned int)(m_buffer[ POS_EXP_RUN_NUM ]) & RUNNO_MASK) >> RUNNO_SHIFT);
140}

◆ GetRunNumSubRunNum()

int GetRunNumSubRunNum ( )

Definition at line 147 of file SendHeader.cc.

148{
149
150 return ((unsigned int)(m_buffer[ POS_EXP_RUN_NUM ]) &
151 (RUNNO_MASK | SUBRUNNO_MASK));
152}

◆ GetSubRunNum()

int GetSubRunNum ( )

Definition at line 142 of file SendHeader.cc.

143{
144 return ((unsigned int)(m_buffer[ POS_EXP_RUN_NUM ]) & SUBRUNNO_MASK);
145}

◆ GetTotalNwords()

int GetTotalNwords ( )

Definition at line 123 of file SendHeader.cc.

123{ return m_buffer[ POS_NWORDS ];}

◆ Initialize()

void Initialize ( )

Definition at line 42 of file SendHeader.cc.

43{
44 memset(m_buffer, 0, sizeof(int)* SENDHDR_NWORDS);
45 m_buffer[ POS_HDR_NWORDS ] = SENDHDR_NWORDS;
46}

◆ SetBuffer()

void SetBuffer ( int *  hdr)

set buffer

Definition at line 37 of file SendHeader.cc.

38{
39 memcpy(m_buffer, bufin, SENDHDR_NWORDS * sizeof(int));
40}

◆ SetEventNumber()

void SetEventNumber ( int  eve_num)

Definition at line 76 of file SendHeader.cc.

77{
78 m_buffer[ POS_EVE_NUM ] = eve_num;
79}

◆ SetExpNum()

void SetExpNum ( int  exp_num)

Definition at line 108 of file SendHeader.cc.

109{
110
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);
115
116 return;
117}

◆ SetExpRunWord()

void SetExpRunWord ( unsigned int  exp_run)

Definition at line 56 of file SendHeader.cc.

57{
58 m_buffer[ POS_EXP_RUN_NUM ] = exp_run;
59}

◆ SetNodeID()

void SetNodeID ( int  node_id)

Definition at line 82 of file SendHeader.cc.

83{
84 m_buffer[ POS_NODE_ID ] = node_id;
85}

◆ SetNumEventsinPacket()

void SetNumEventsinPacket ( int  num_events)

set contents of Header

Definition at line 61 of file SendHeader.cc.

62{
63 m_buffer[ POS_NUM_EVE_NUM_NODES ] =
64 (m_buffer[ POS_NUM_EVE_NUM_NODES ] & 0x0000FFFF) |
65 ((num_events << 16) & 0xFFFF0000);
66}

◆ SetNumNodesinPacket()

void SetNumNodesinPacket ( int  num_nodes)

Definition at line 68 of file SendHeader.cc.

69{
70 m_buffer[ POS_NUM_EVE_NUM_NODES ] =
71 (m_buffer[ POS_NUM_EVE_NUM_NODES ] & 0xFFFF0000) |
72 (num_nodes & 0x0000FFFF);
73}

◆ SetNwords()

void SetNwords ( int  total_data_nwords)

initialize Header

Definition at line 51 of file SendHeader.cc.

52{
53 m_buffer[ POS_NWORDS ] = total_data_nwords;
54}

◆ SetRunNum()

void SetRunNum ( int  run_num)

Definition at line 88 of file SendHeader.cc.

89{
90
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);
95
96 return;
97}

◆ SetSubRunNum()

void SetSubRunNum ( int  subrun_num)

Definition at line 99 of file SendHeader.cc.

100{
101
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);
105 return;
106}

Member Data Documentation

◆ m_buffer

int m_buffer[SENDHDR_NWORDS]
private

Definition at line 91 of file SendHeader.h.


The documentation for this class was generated from the following files: